You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
References in the mapping key of discriminator schema component is not resolved during the openapi-merge with dispute prefix.
References are not renamed properly and the final openapi file is invalid.
For example
The first openapi file openapi1.yml
openapi: 3.0.3info:
title: Swaggerdescription: descriptionversion: 1.0.0servers:
- url: http://example.comtags:
- name: petdescription: Everything about your PetsexternalDocs:
description: Find out moreurl: http://swagger.iopaths:
/pet:
post:
tags:
- petsummary: Add a new pet to the storedescription: Add a new pet to the storeoperationId: addPetrequestBody:
description: Create a new pet in the storecontent:
application/json:
schema:
oneOf:
- $ref: '#/components/schemas/Pet'
- $ref: '#/components/schemas/Pet2'discriminator:
propertyName: namemapping:
pet: '#/components/schemas/Pet'pet2: '#/components/schemas/Pet2'required: trueresponses:
'200':
description: Successful operationcontent:
application/json:
schema:
$ref: '#/components/schemas/Pet'components:
schemas:
Pet:
required:
- id
- nametype: objectproperties:
id:
type: integerformat: int64example: 10name:
type: stringexample: doggiePet2:
required:
- id
- name
- lastNametype: objectproperties:
id:
type: integerformat: int64example: 10name:
type: stringexample: doggielastName:
type: stringexample: dooglerequestBodies:
Pet:
description: Pet object that needs to be added to the storecontent:
application/json:
schema:
$ref: '#/components/schemas/Pet'
The second openapifile : openapi2.yml
openapi: 3.0.3info:
title: Swaggerdescription: descriptionversion: 1.0.0servers:
- url: http://example.comtags:
- name: petdescription: Everything about your PetsexternalDocs:
description: Find out moreurl: http://swagger.iopaths:
/pet2:
post:
tags:
- petsummary: Add a new pet to the storedescription: Add a new pet to the storeoperationId: addPetrequestBody:
description: Create a new pet in the storecontent:
application/json:
schema:
oneOf:
- $ref: '#/components/schemas/Pet'
- $ref: '#/components/schemas/Pet2'discriminator:
propertyName: namemapping:
pet: '#/components/schemas/Pet'pet2: '#/components/schemas/Pet2'required: trueresponses:
'200':
description: Successful operationcontent:
application/json:
schema:
$ref: '#/components/schemas/Pet'components:
schemas:
Pet:
required:
- id
- nametype: objectproperties:
id:
type: integerformat: int64example: 10name:
type: stringexample: doggiePet2:
required:
- id
- name
- lastNametype: objectproperties:
id:
type: integerformat: int64example: 10name:
type: stringexample: doggielastName:
type: stringexample: dooglerequestBodies:
Pet:
description: Pet object that needs to be added to the storecontent:
application/json:
schema:
$ref: '#/components/schemas/Pet'
And the merge configuration : (according to the openapi-merge-cli package)
openapi: 3.0.3info:
title: Swaggerdescription: descriptionversion: 1.0.0servers:
- url: 'http://example.com'tags:
- name: petdescription: Everything about your PetsexternalDocs:
description: Find out moreurl: 'http://swagger.io'paths:
/pet:
post:
tags:
- petsummary: Add a new pet to the storedescription: Add a new pet to the storeoperationId: addPetrequestBody:
description: Create a new pet in the storecontent:
application/json:
schema:
oneOf:
- $ref: '#/components/schemas/openapi1Pet'
- $ref: '#/components/schemas/openapi1Pet2'discriminator:
propertyName: namemapping:
pet: '#/components/schemas/Pet'pet2: '#/components/schemas/Pet2'required: trueresponses:
'200':
description: Successful operationcontent:
application/json:
schema:
$ref: '#/components/schemas/openapi1Pet'/pet2:
post:
tags:
- petsummary: Add a new pet to the storedescription: Add a new pet to the storeoperationId: openapi2addPetrequestBody:
description: Create a new pet in the storecontent:
application/json:
schema:
oneOf:
- $ref: '#/components/schemas/openapi2Pet'
- $ref: '#/components/schemas/openapi2Pet2'discriminator:
propertyName: namemapping:
pet: '#/components/schemas/Pet'pet2: '#/components/schemas/Pet2'required: trueresponses:
'200':
description: Successful operationcontent:
application/json:
schema:
$ref: '#/components/schemas/openapi2Pet'components:
schemas:
openapi1Pet:
required:
- id
- nametype: objectproperties:
id:
type: integerformat: int64example: 10name:
type: stringexample: doggieopenapi1Pet2:
required:
- id
- name
- lastNametype: objectproperties:
id:
type: integerformat: int64example: 10name:
type: stringexample: doggielastName:
type: stringexample: doogleopenapi2Pet:
required:
- id
- nametype: objectproperties:
id:
type: integerformat: int64example: 10name:
type: stringexample: doggieopenapi2Pet2:
required:
- id
- name
- lastNametype: objectproperties:
id:
type: integerformat: int64example: 10name:
type: stringexample: doggielastName:
type: stringexample: dooglerequestBodies:
openapi1Pet:
description: Pet object that needs to be added to the storecontent:
application/json:
schema:
$ref: '#/components/schemas/openapi1Pet'openapi2Pet:
description: Pet object that needs to be added to the storecontent:
application/json:
schema:
$ref: '#/components/schemas/openapi2Pet'
References in the mapping key of discriminator schema component is not resolved during the openapi-merge with dispute prefix.
References are not renamed properly and the final openapi file is invalid.
For example
The first openapi file
openapi1.yml
The second openapifile : openapi2.yml
And the merge configuration : (according to the openapi-merge-cli package)
The result is :
Where the following content is invalid :
Reference of components are well renamed in the oneOf property but not in the mapping discriminator.
The text was updated successfully, but these errors were encountered: