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
When using AllOf for polymorphism, when a property references a parent schema using ref and a change is done to a child schema which is not referenced directly anywhere in the OAS file, changes done to child schema are ignored in the differ output.
Example schema:
openapi: 3.0.0servers:
- url: 'http://petstore.swagger.io/v2'info:
description: >- This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.version: 1.0.0title: Swagger PetstoretermsOfService: 'http://swagger.io/terms/'contact:
email: [email protected]license:
name: Apache 2.0url: 'http://www.apache.org/licenses/LICENSE-2.0.html'tags:
- name: petdescription: Everything about your PetsexternalDocs:
description: Find out moreurl: 'http://swagger.io'
- name: storedescription: Access to Petstore orders
- name: userdescription: Operations about userexternalDocs:
description: Find out more about our storeurl: 'http://swagger.io'paths:
/pet/findByStatus:
get:
tags:
- petsummary: Finds Pets by statusdescription: Multiple status values can be provided with comma separated stringsoperationId: findPetsByStatusparameters:
- name: statusin: querydescription: Status values that need to be considered for filterrequired: trueexplode: trueschema:
type: arrayitems:
type: stringenum:
- available
- pending
- solddefault: availableresponses:
'200':
description: successful operationcontent:
application/json:
schema:
type: objectproperties:
pets:
type: arrayitems:
$ref: '#/components/schemas/Pet''400':
description: Invalid status valuesecurity:
- petstore_auth:
- 'write:pets'
- 'read:pets'externalDocs:
description: Find out more about Swaggerurl: 'http://swagger.io'components:
requestBodies:
Pet:
content:
application/json:
schema:
$ref: '#/components/schemas/Pet'description: Pet object that needs to be added to the storerequired: truesecuritySchemes:
petstore_auth:
type: oauth2flows:
implicit:
authorizationUrl: 'http://petstore.swagger.io/oauth/dialog'scopes:
'write:pets': modify pets in your account'read:pets': read your petsapi_key:
type: apiKeyname: api_keyin: headerschemas:
BasePet:
type: objectproperties:
pet_color:
type: stringPet:
allOf:
- $ref: '#/components/schemas/BasePet'type: objectdiscriminator:
propertyName: pet_typemapping:
dog: '#/components/schemas/Dog'cat: '#/components/schemas/Cat'required:
- pet_typeproperties:
pet_type:
nullable: falseallOf:
- type: stringCat:
description: Cat classallOf:
- $ref: '#/components/schemas/Pet'type: objectdiscriminator:
propertyName: pet_typemapping:
dog: '#/components/schemas/Cat'properties:
name:
type: stringtoy:
$ref: '#/components/schemas/Toy'Dog:
description: Dog classallOf:
- $ref: '#/components/schemas/Pet'type: objectdiscriminator:
propertyName: pet_typemapping:
dog: '#/components/schemas/Cat'properties:
bark:
type: stringToy:
description: Toy classtype: objectdiscriminator:
propertyName: toy_typemapping:
ball: '#/components/schemas/Ball'properties:
toy_type:
type: stringprice:
type: numberBall:
description: Ball classallOf:
- $ref: '#/components/schemas/Toy'
- type: objectproperties:
size:
type: stringdiscriminator:
propertyName: toy_typemapping:
ball: '#/components/schemas/Ball'
If I add new property material to Ball, I would expect to see changes in GET /pet/findByStatus operation, while the actual situation is, that the changes are ignored.
Tested with 2.1.0-SNAPSHOT.
The text was updated successfully, but these errors were encountered:
Tried to fix this by moving the Discriminator mapping diff code from ComposedSchemaDiffResult to SchemaDiffResult, however the result was that only the model change was created as a result of a second pass (deferred processing), while there was no operation change. Seems like the deferred processing doesn't generate operation changes, which would be a bigger issues than just this bug in polymorphism.
When using AllOf for polymorphism, when a property references a parent schema using ref and a change is done to a child schema which is not referenced directly anywhere in the OAS file, changes done to child schema are ignored in the differ output.
Example schema:
If I add new property material to Ball, I would expect to see changes in GET /pet/findByStatus operation, while the actual situation is, that the changes are ignored.
Tested with 2.1.0-SNAPSHOT.
The text was updated successfully, but these errors were encountered: