swagger-parser
swagger-parser copied to clipboard
[OpenAPI v3.1] Arrays now (incorrectly?) parse to JsonSchema rather than ArraySchema
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: https://github.com/dominic-jones/swagger-parser/commit/bec6fab4e4458e4294b97df488139d70261136f7