acacode/swagger-typescript-api

Enum names with `Nullable` suffix

Opened this issue · 0 comments

Thank you for the amazing package.

Problem

I'm finding that enums are sometimes generated with a Nullable suffix in the name when they belong to properties of objects which are optional.

This is really unhelpful because it causes type mismatches where they just shouldn't exist.

For Example

Here are some generated enums

export enum QuestionType {
  Text = 'text',
  Numeric = 'numeric',
  Currency = 'currency',
  Checkbox = 'checkbox',
  Radio = 'radio',
  Autocomplete = 'autocomplete',
  Select = 'select',
  DatePicker = 'datePicker',
}

export enum QuestionTypeNullable {
  Text = 'text',
  Numeric = 'numeric',
  Currency = 'currency',
  Checkbox = 'checkbox',
  Radio = 'radio',
  Autocomplete = 'autocomplete',
  Select = 'select',
  DatePicker = 'datePicker',
}

Those two enums are the same (obviously), but are causing type mismatches.

Is there a way of stopping this from happening?