swagger-typescript-api icon indicating copy to clipboard operation
swagger-typescript-api copied to clipboard

allOf fails on enums

Open brookjordan opened this issue 4 years ago • 0 comments

The following code:

components:
  schemas:
    Digit:
      type: string
      enum:
        - zero
        - one
        - two
        - three
        - four
        - five
        - six
        - seven
        - eight
        - nine
    Even:
      allOf:
        - $ref: '#/components/schemas/Digit'
        - type: string
          enum:
            - zero
            - two
            - four
            - six
            - eight

Compiles to:

export declare type Digit =
  | 'zero'
  | 'one'
  | 'two'
  | 'three'
  | 'four'
  | 'five'
  | 'six'
  | 'seven'
  | 'eight'
  | 'nine';
export declare type Even = (Digit & 'zero') | 'two' | 'four' | 'six' | 'eight';

Even should be:

export declare type Even = Digit & ('zero' | 'two' | 'four' | 'six' | 'eight');

brookjordan avatar Dec 01 '21 03:12 brookjordan