Skip to content

Commit cb6d034

Browse files
authored
Merge pull request #536 from swagger-api/cc-19544
Add schema properties to vars also for composed schema
2 parents 89f6a53 + 25bd8e2 commit cb6d034

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/main/java/io/swagger/codegen/v3/generators/DefaultCodegenConfig.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1456,21 +1456,21 @@ protected void addAdditionPropertiesToCodeGenModel(CodegenModel codegenModel, Sc
14561456
}
14571457

14581458
protected void addProperties(Map<String, Schema> properties, List<String> required, Schema schema, Map<String, Schema> allSchemas) {
1459-
if(schema instanceof ComposedSchema) {
1460-
ComposedSchema composedSchema = (ComposedSchema) schema;
1461-
if(composedSchema.getAllOf() == null || composedSchema.getAllOf().isEmpty() || composedSchema.getAllOf().size() == 1) {
1462-
return;
1463-
}
1464-
for (int i = 1; i < composedSchema.getAllOf().size(); i++) {
1465-
addProperties(properties, required, composedSchema.getAllOf().get(i), allSchemas);
1466-
}
1467-
return;
1468-
}
14691459
if(StringUtils.isNotBlank(schema.get$ref())) {
14701460
Schema interfaceSchema = allSchemas.get(OpenAPIUtil.getSimpleRef(schema.get$ref()));
14711461
addProperties(properties, required, interfaceSchema, allSchemas);
14721462
return;
14731463
}
1464+
1465+
if(schema instanceof ComposedSchema) {
1466+
ComposedSchema composedSchema = (ComposedSchema) schema;
1467+
if(!(composedSchema.getAllOf() == null || composedSchema.getAllOf().isEmpty() || composedSchema.getAllOf().size() == 1)) {
1468+
for (int i = 1; i < composedSchema.getAllOf().size(); i++) {
1469+
addProperties(properties, required, composedSchema.getAllOf().get(i), allSchemas);
1470+
}
1471+
}
1472+
}
1473+
14741474
if(schema.getProperties() != null) {
14751475
properties.putAll(schema.getProperties());
14761476
}

0 commit comments

Comments
 (0)