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

Claus Ibsen commented on CAMEL-21478:
-------------------------------------

You are welcome to work on this

> camel-rest-openapi: Input and output types binding to java classes using $ref 
> or title of the schema
> ----------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-21478
>                 URL: https://issues.apache.org/jira/browse/CAMEL-21478
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-rest-openapi
>    Affects Versions: 4.8.0, 4.8.1
>            Reporter: Chamodya Dias
>            Priority: Minor
>             Fix For: 4.9.0
>
>
> Currently, camel resolves the Java class names for RestBindingConfiguration 
> from Schema XML attribute.
> Implemented at: org.apache.camel.component.rest.openapi.RestOpenApiProcessor
> ```
> private RestBindingConfiguration createRestBindingConfiguration(Operation o) 
> throws Exception {
> ...
> ...
> Schema s = m.getValue().getSchema();
> // $ref is null, so we need to know the schema name via XML
> if (s != null && s.getXml() != null) {
> String ref = s.getXml().getName();
> ...
> ```
>  
> But the documentation says Camel can resolve the schema from the schema name: 
> [https://camel.apache.org/manual/rest-dsl-openapi.html#_binding_to_pojo_classes]
>  
> This improvement suggests adding an `else-if` condition that to above code 
> that uses `$ref` to resolve the schema name if available and another 
> `else-if` condition that uses the `title` attribute 
> (https://github.com/OAI/OpenAPI-Specification/blob/3.0.2/versions/3.0.2.md#schema-object)
>  of the schema to get the class name if available.
>  
> Also, the current implementation doesn't resolve class names when using the 
> `requestBodies` component directly in the OAS. It only uses `content` 
> attribute.
>  
> example:
> ```
> requestBody:
>   $ref: '#/components/requestBodies/createProduct'
> ```
> This improvement suggests the capability to add this also.



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

Reply via email to