[
https://issues.apache.org/jira/browse/CAMEL-15503?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17212900#comment-17212900
]
Claus Ibsen commented on CAMEL-15503:
-------------------------------------
This can also be seen by comparing camel-swagger-java and camel-openapi-java in
the unit test RestOpenApiReaderModelBookOrderTest
swagger outputs:
{code}
{
"swagger" : "2.0",
"host" : "localhost:8080",
"basePath" : "/api",
"tags" : [ {
"name" : "dude",
"description" : "Book order service"
} ],
"schemes" : [ "http" ],
"paths" : {
"/books/{id}" : {
"get" : {
"tags" : [ "dude" ],
"summary" : "Find order by id",
"operationId" : "verb1",
"consumes" : [ "application/json" ],
"produces" : [ "application/json" ],
"parameters" : [ {
"name" : "id",
"in" : "path",
"description" : "The id of the order to get",
"required" : true,
"type" : "integer"
} ],
"responses" : {
"200" : {
"description" : "The order returned",
"responseSchema" : {
"originalRef" : "BookOrder",
"$ref" : "#/definitions/BookOrder"
},
"schema" : {
"originalRef" : "BookOrder",
"$ref" : "#/definitions/BookOrder"
}
}
},
"x-camelContextId" : "camel-1",
"x-routeId" : "route1"
}
},
"/books/books/{id}/line/{lineNum}" : {
"get" : {
"tags" : [ "dude" ],
"operationId" : "verb2",
"consumes" : [ "application/json" ],
"produces" : [ "application/json" ],
"parameters" : [ {
"name" : "id",
"in" : "path",
"required" : true,
"type" : "string"
}, {
"name" : "lineNum",
"in" : "path",
"required" : true,
"type" : "string"
} ],
"responses" : {
"200" : {
"description" : "Output type",
"responseSchema" : {
"originalRef" : "LineItem",
"$ref" : "#/definitions/LineItem"
},
"schema" : {
"originalRef" : "LineItem",
"$ref" : "#/definitions/LineItem"
}
}
},
"x-camelContextId" : "camel-1",
"x-routeId" : "route2"
}
}
},
"definitions" : {
"LineItem" : {
"type" : "object",
"required" : [ "isbn", "name" ],
"properties" : {
"isbn" : {
"type" : "string",
"description" : "ISBN of the book"
},
"name" : {
"type" : "string",
"description" : "Name of the book"
}
},
"description" : "Order line",
"x-className" : {
"type" : "string",
"format" : "org.apache.camel.swagger.LineItem"
}
},
"BookOrder" : {
"type" : "object",
"required" : [ "id", "items" ],
"properties" : {
"id" : {
"type" : "string",
"description" : "The id of the order"
},
"items" : {
"type" : "array",
"description" : "The books ordered",
"items" : {
"originalRef" : "LineItem",
"$ref" : "#/definitions/LineItem"
}
}
},
"description" : "Represents a book order",
"x-className" : {
"type" : "string",
"format" : "org.apache.camel.swagger.BookOrder"
}
}
}
}
{code}
openapi outputs
{code}
{
"swagger" : "2.0",
"host" : "localhost:8080",
"basePath" : "/api",
"schemes" : [ "http" ],
"paths" : {
"/books/{id}" : {
"get" : {
"consumes" : [ "application/json" ],
"produces" : [ "application/json" ],
"tags" : [ "dude" ],
"parameters" : [ {
"name" : "id",
"description" : "The id of the order to get",
"in" : "path",
"required" : true,
"type" : "integer"
} ],
"responses" : {
"200" : {
"description" : "The order returned",
"schema" : {
"$ref" : "#/definitions/BookOrder"
}
}
},
"operationId" : "verb1",
"summary" : "Find order by id",
"x-camelContextId" : "camel-1",
"x-routeId" : "route1"
}
},
"/books/books/{id}/line/{lineNum}" : {
"get" : {
"consumes" : [ "application/json" ],
"produces" : [ "application/json" ],
"tags" : [ "dude" ],
"parameters" : [ {
"name" : "id",
"in" : "path",
"required" : true,
"type" : "string"
}, {
"name" : "lineNum",
"in" : "path",
"required" : true,
"type" : "string"
} ],
"responses" : {
"200" : {
"description" : "Output type",
"schema" : {
"$ref" : "#/definitions/LineItem"
}
}
},
"operationId" : "verb2",
"x-camelContextId" : "camel-1",
"x-routeId" : "route2"
}
}
},
"definitions" : {
"BookOrder" : {
"type" : "BookOrder",
"x-className" : {
"format" : "org.apache.camel.openapi.BookOrder",
"type" : "string"
}
},
"LineItem" : {
"type" : "LineItem",
"x-className" : {
"format" : "org.apache.camel.openapi.LineItem",
"type" : "string"
}
}
},
"tags" : [ {
"name" : "dude",
"description" : "Book order service"
} ]
}
{code}
> Apache Camel camel-openapi-java Schema Definitions not generating correctly
> ---------------------------------------------------------------------------
>
> Key: CAMEL-15503
> URL: https://issues.apache.org/jira/browse/CAMEL-15503
> Project: Camel
> Issue Type: Bug
> Components: camel-openapi-java
> Affects Versions: 3.4.3
> Reporter: Kate Hennessy
> Assignee: Viral Gohel
> Priority: Major
> Fix For: 3.6.0, 3.4.5
>
> 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)