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

Shankar Ramamoorthy commented on CAMEL-15503:
---------------------------------------------

I've created a pull request on Github which is linked from this Jira. Would be 
great if it can be reviewed. If I'm going about this wrong, please let me know.

I've used `io.swagger.core.v3:swagger-core` to create OpenAPI schema elements 
for Java classes referenced by the request and response objects of the Camel 
rest endpoints. The translation from the OpenAPI scherma to APICurio models is 
straightforward. Existing code was generating the rest of the schema - rest 
endpoints, security schema, correctly. JSON Jackson annotations appear to be 
respected, though I've only checked that required fields can be specified using 
`@JsonProperty(required = true)`.

It's also possible to parse the referenced Java classes to JSON schema and then 
translate the JSON schema to APICurio models. Can be done using either 
jackson-module-jsonschema or victools json-schema-generator. I have an 
implentation using victools, but the swagger implementation is simpler.

To generate the APICurio models directly from Java classes without going 
through an intermediate format - whether OpenAPI or JSON schema - is a larger 
and more complicated undertaking.  

> camel-openapi-java - Schema Definitions not generating correctly
> ----------------------------------------------------------------
>
>                 Key: CAMEL-15503
>                 URL: https://issues.apache.org/jira/browse/CAMEL-15503
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-openapi-java
>    Affects Versions: 3.4.3
>            Reporter: Kate Hennessy
>            Assignee: Viral Gohel
>            Priority: Major
>             Fix For: 3.10.0
>
>         Attachments: camelOpenAPITest.zip
>
>
> Classes defined in RestDefinition _type_ and _outType_ are not generating 
> correctly in openapi schema. This worked in the older older 
> camel-swagger-java component, the schema was generating with all object 
> definitions correctly. 
>  
> Please see this question on stack overflow for more details. 
> [https://stackoverflow.com/questions/63691670/apache-camel-camel-openapi-java-schema-definitions-not-generating-correctly]
>  
> Sample project with the issue happening is attached. 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to