mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2026-03-18 23:59:12 +00:00
Improve "allOf" support (#1169)
* Add test case which reproduces issue340 * Take the first $ref we find in the allOf-List
This commit is contained in:
committed by
William Cheng
parent
aa31e42ce7
commit
a1d242595e
@@ -4215,12 +4215,12 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
|
||||
protected String getParentName(ComposedSchema composedSchema, Map<String, Schema> allSchemas) {
|
||||
if (composedSchema.getAllOf() != null && !composedSchema.getAllOf().isEmpty()) {
|
||||
Schema schema = composedSchema.getAllOf().get(0);
|
||||
String ref = schema.get$ref();
|
||||
if (StringUtils.isBlank(ref)) {
|
||||
return null;
|
||||
for (Schema schema : composedSchema.getAllOf()) {
|
||||
String ref = schema.get$ref();
|
||||
if (!StringUtils.isBlank(ref)) {
|
||||
return ModelUtils.getSimpleRef(ref);
|
||||
}
|
||||
}
|
||||
return ModelUtils.getSimpleRef(ref);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user