Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Arrays of enum values #29

Closed
arkraft opened this issue Aug 13, 2019 · 0 comments
Closed

Arrays of enum values #29

arkraft opened this issue Aug 13, 2019 · 0 comments
Labels
bug Something isn't working

Comments

@arkraft
Copy link
Contributor

arkraft commented Aug 13, 2019

I have a swagger configuration where one attribute is an array of enum values (number). This enum is correctly translated into a type, but the property itself is not an array anymore. For example:

 features:
        type: array
        uniqueItems: true
        items:
          type: number
          enum:
            - 10
            - 11
            - 20
            - 30
            - 40
            - 50
            - 51
            - 61
            - 71
            - 72

creates the following enum type:

type StructureDtoFeatures = 10 | 11 | 20 | 30 | 40 | 50 | 51 | 61 | 71 | 72;

but the property itself is this:

...
  features: StructureDtoFeatures;
...

which is not an array.

This part works fine in the Swagger Editor and when creating a client with typescript-angular, the Class is also correct.

...
    features?: Array<number>;
...
@Manweill Manweill added the bug Something isn't working label Aug 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants