Hello.
I'm trying to parse a swagger file which is converted to OpenApi object. It seems to run properly, but when I try to extract properties from complex schemas that use allOf then the properties that are not included in the referenced schema are ignored.
For instance, I have this definition of a request body parameter:
parameters:
- in: body
name: request_body
schema:
$ref: "#/definitions/identificacion_usuario_aplicacion"
required: true
The referenced definition looks like this:
identificacion_usuario_aplicacion:
allOf:
- $ref: '#/definitions/identificacion_usuario'
properties:
aplicacion:
type: string
description: some description
example: some example value
Thus I intend to keep all the properties of identificacion_usuario and add a new aplicacion property to the request body. The problem is that this new property is not parsed by the swagger converter. When I call
OpenApi openApi = new OpenAPIV3Parser().read(swaggerFileLocation);
I get an OpenApi object that seems to be ok, but it's not. After inspecting the OpenApi object I found that components->schemas had a LinkedHashMapEntry with key identificacion_usuario_aplicacion that had as value a ComposedSchema with an allOf Schema set. But, unfortunately, ComposedSchema properties were set to null.
Taking a deep dive into the libraries I think the issue comes from io.swagger.parser.util SwaggerDeserializer.Class contained on swagger-parser-1.0.45.jar. The definition method, lines 771 to 773, calls to allOfModel method:
if(node.get("allOf") != null) {
return allOfModel(node, location, result);
}
allOfModel method, contained in the same class, receives an object node which contains two children nodes: allOf and properties. The properties child node is ignored in this method, which processes and returns only the allOf child node.
I think the problem is there, but I'm not completely sure of it. And also I'm not completely sure about the way to fix it.
Could you please review the issue.
Thank you very much.
Hello.
I'm trying to parse a swagger file which is converted to OpenApi object. It seems to run properly, but when I try to extract properties from complex schemas that use allOf then the properties that are not included in the referenced schema are ignored.
For instance, I have this definition of a request body parameter:
The referenced definition looks like this:
Thus I intend to keep all the properties of identificacion_usuario and add a new aplicacion property to the request body. The problem is that this new property is not parsed by the swagger converter. When I call
I get an OpenApi object that seems to be ok, but it's not. After inspecting the OpenApi object I found that components->schemas had a LinkedHashMapEntry with key identificacion_usuario_aplicacion that had as value a ComposedSchema with an allOf Schema set. But, unfortunately, ComposedSchema properties were set to null.
Taking a deep dive into the libraries I think the issue comes from io.swagger.parser.util SwaggerDeserializer.Class contained on swagger-parser-1.0.45.jar. The definition method, lines 771 to 773, calls to allOfModel method:
allOfModel method, contained in the same class, receives an object node which contains two children nodes: allOf and properties. The properties child node is ignored in this method, which processes and returns only the allOf child node.
I think the problem is there, but I'm not completely sure of it. And also I'm not completely sure about the way to fix it.
Could you please review the issue.
Thank you very much.