[ 
https://issues.apache.org/jira/browse/CAMEL-21076?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17873247#comment-17873247
 ] 

Claus Ibsen commented on CAMEL-21076:
-------------------------------------

Thanks for the patch

> camel-openapi-java: Incorrect schema is generated for array type request 
> -------------------------------------------------------------------------
>
>                 Key: CAMEL-21076
>                 URL: https://issues.apache.org/jira/browse/CAMEL-21076
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-openapi-java
>    Affects Versions: 3.x, 4.x
>            Reporter: Iliya Grushevskiy
>            Assignee: Claus Ibsen
>            Priority: Major
>             Fix For: 4.8.0
>
>         Attachments: 
> CAMEL-21076_Fix_REST_route_definition_and_OpenAPI_schema_generation_for_array_type_request.patch,
>  
> CAMEL-21076_Fix_REST_route_definition_and_OpenAPI_schema_generation_for_array_type_request1.patch
>
>
> When specifying an array of objects as a request type (in PUT/POST methods), 
> the generated OpenAPI schema does not match the expected result.
> For example:
> {code:java}
> .post()
>   .type(User[].class)
>   .to("bean:...."){code}
> Will generate:
> {code:java}
> "requestBody" : {
>   "description" : "",
>   "content" : {
>     "application/json" : {
>       "schema" : {
>         "type" : "string"
>       }
>     }
>   },
>   "required" : true
> }, {code}
> While expected schema should be:
> {code:java}
> "requestBody" : {
>   "description" : "",
>   "content" : {
>     "application/json" : {
>       "schema" : {
>         "type" : "array",
>         "items" : {
>           "$ref" : "#/components/schemas/User"
>         }
>       }
>     }
>   },
>   "required" : true
> } {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to