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
In the openapi.yml, for the PetType definition, "id" property is marked as readOnly:
PetType:
title: Pet type
description: A pet type.
allOf:
- $ref: '#/components/schemas/PetTypeFields'
- type: object
properties:
id:
title: ID
...
readOnly: true
required:
- id
According to the OpenAPI specification, this means:
Declares the property as "read only". This means that it MAY be sent as part of a response but SHOULD NOT be sent as part of the request.
This means: when I call "addPet" operation to create a new Pet, by specification I shouldn't be able to specify Pet -> type -> id field. Though it is this particular field which is responsible for handling association.
Example of a problem that may occur - is the OpenAPI client generator.
See this change: OpenAPITools/openapi-generator#1582
If using this code generator, the generated PetType pojo will not have a PetType#setId() attribute.
Summary:
I think that readOnly flag is misused in this schema, and it shouldn't be used, for objects that are used as request parameters.
The text was updated successfully, but these errors were encountered:
I don't know if the readOnly flag is misused or not, but when we call the POST /api/owners/{ownerId}/pets endpoint without giving pet id and name we have an error 400. Thus there is an issue that we have to fix.
In the openapi.yml, for the PetType definition, "id" property is marked as readOnly:
According to the OpenAPI specification, this means:
see https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.2.md#fixed-fields-20
This means: when I call "addPet" operation to create a new Pet, by specification I shouldn't be able to specify Pet -> type -> id field. Though it is this particular field which is responsible for handling association.
Example of a problem that may occur - is the OpenAPI client generator.
See this change: OpenAPITools/openapi-generator#1582
If using this code generator, the generated PetType pojo will not have a PetType#setId() attribute.
Summary:
I think that readOnly flag is misused in this schema, and it shouldn't be used, for objects that are used as request parameters.
The text was updated successfully, but these errors were encountered: