Skip to content

Array fields always as any if type specified as array #893

@hlavavit

Description

@hlavavit

I got this kind of property on my object

        permissions:
          type: 
            - array
          items:
            enum:
              - DEBUG
              - EDIT
            type: string

it end up being generated as

  permissions: any[];

but when i change it to

        permissions:
          type: array
          items:
            enum:
              - DEBUG
              - EDIT
            type: string

it suddenly works and generates as

permissions: ("DEBUG" | "EDIT")[];

Happens with objects as well not just enums.

And it happens with json format as well there it works with "type":"array" and does not with "type":["array"]

Its needed for nullable arrays for example "type":["array","null"] since nullable has been removed with 3.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions