mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-07-02 21:50:55 +00:00
fix inline schema without object type (#5992)
This commit is contained in:
parent
da149e1204
commit
f8911700c7
@ -362,8 +362,10 @@ public class InlineModelResolver {
|
||||
ListIterator<Schema> listIterator = children.listIterator();
|
||||
while (listIterator.hasNext()) {
|
||||
Schema component = listIterator.next();
|
||||
if (component instanceof ObjectSchema) {
|
||||
ObjectSchema op = (ObjectSchema) component;
|
||||
if (component instanceof ObjectSchema || // for inline schema with type:object
|
||||
(component != null && component.getProperties() != null &&
|
||||
!component.getProperties().isEmpty())) { // for inline schema without type:object
|
||||
Schema op = component;
|
||||
if (op.get$ref() == null && op.getProperties() != null && op.getProperties().size() > 0) {
|
||||
// If a `title` attribute is defined in the inline schema, codegen uses it to name the
|
||||
// inline schema. Otherwise, we'll use the default naming such as InlineObject1, etc.
|
||||
@ -390,6 +392,8 @@ public class InlineModelResolver {
|
||||
listIterator.set(schema);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// likely a reference to schema (not inline schema)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -607,7 +611,7 @@ public class InlineModelResolver {
|
||||
}
|
||||
}
|
||||
|
||||
private Schema modelFromProperty(ObjectSchema object, String path) {
|
||||
private Schema modelFromProperty(Schema object, String path) {
|
||||
String description = object.getDescription();
|
||||
String example = null;
|
||||
Object obj = object.getExample();
|
||||
|
Loading…
x
Reference in New Issue
Block a user