[
https://issues.apache.org/jira/browse/CAMEL-20353?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17810390#comment-17810390
]
James Netherton commented on CAMEL-20353:
-----------------------------------------
There must be a change in the validation behaviour. The 3.1 spec for the pet
store definition for POST /pet states that 'id' is required in the Pet JSON
request body.
{code}
"post" : {
"tags" : [ "pet" ],
"summary" : "Add a new pet to the store",
"description" : "Add a new pet to the store",
"operationId" : "addPet",
"requestBody" : {
"description" : "Create a new pet in the store",
"content" : {
"application/json" : {
"schema" : {
"$ref" : "#/components/schemas/Pet",
"description" : "A Pet in JSON Format",
"required" : [ "id" ],
"writeOnly" : true
}
},
"application/xml" : {
"schema" : {
"$ref" : "#/components/schemas/Pet",
"description" : "A Pet in XML Format",
"required" : [ "id" ],
"writeOnly" : true
}
}
},
"required" : true
},
{code}
And that now seems to override the validation options specified on Pet object
{code}
Pet:
$schema: https://json-schema.org/draft/2020-12/schema
description: Pet
required:
- name
- photoUrls
{code}
Somewhat weirdly on the Swagger UI, you can remove the 'id' and other required
fields and make a successful request.
https://petstore31.swagger.io/#/pet/addPet
So given that, I'll tweak the 3.1 pet store spec file and remove the "required"
: [ "id" ] bits to restore the previous (IMO correct) behaviour.
> camel-rest-openapi: test broken after swagger upgrade
> -----------------------------------------------------
>
> Key: CAMEL-20353
> URL: https://issues.apache.org/jira/browse/CAMEL-20353
> Project: Camel
> Issue Type: Test
> Components: camel-rest-openapi
> Affects Versions: 4.4.0
> Reporter: Otavio Rodolfo Piske
> Assignee: James Netherton
> Priority: Major
> Labels: easy, help-wanted
>
> This upgrade broke RestOpenApiRequestValidationTest:
> https://github.com/apache/camel/commit/394084605ec909f1aed514734166dd45da35af97
--
This message was sent by Atlassian Jira
(v8.20.10#820010)