Skip to content

[OpenAPI v3.1] Arrays now (incorrectly?) parse to JsonSchema rather than ArraySchema #2172

@dominic-jones

Description

@dominic-jones

In attempted to use swagger-codegen to read a 3.1.0 schema vs a 3.0.x schema, a notable change has occurred in how arrays are handled.

For example when provided the following path:

  /pets:
    post:
      requestBody:
        content:
          application/json:
            schema:
              type: array
              items:
                $ref: '#/components/schemas/Pet'
        required: true
      responses:
        '204':
          description: 'No Content'

This parses to an ArraySchema in 3.0.x, but now parses to JsonSchema in 3.1.0. This could be intentional, as it sounds like some changes occurred in the structure of these objects for 3.1.0, but I'm not yet sure. I'm already multiple layers deep from my organisation, and our change will be to use 3.0.x for the time being, but leaving a report here.

swagger-codegen relies on this ArraySchema usage. The resultant codegen defaults to Object instead.

Example displaying this issue: dominic-jones@bec6fab

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