Skip to content
This repository was archived by the owner on Dec 25, 2024. It is now read-only.

Commit 6be08f8

Browse files
authored
Java fix (#94)
1 parent de31b68 commit 6be08f8

File tree

1 file changed

+4
-11
lines changed
  • modules/openapi-json-schema-generator/src/main/java/org/openapitools/codegen

1 file changed

+4
-11
lines changed

modules/openapi-json-schema-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2934,8 +2934,7 @@ public CodegenModel fromModel(String name, Schema schema) {
29342934
m.setFormat(schema.getFormat());
29352935
m.setComposedSchemas(getComposedSchemas(schema));
29362936
if (ModelUtils.isArraySchema(schema)) {
2937-
String itemName = getItemsName(null, name);
2938-
CodegenProperty arrayProperty = fromProperty(itemName, schema, false);
2937+
CodegenProperty arrayProperty = fromProperty(name, schema, false);
29392938
m.setItems(arrayProperty.items);
29402939
m.arrayModelType = arrayProperty.complexType;
29412940
addParentContainer(m, name, schema);
@@ -7910,16 +7909,10 @@ public List<VendorExtension> getSupportedVendorExtensions() {
79107909
protected String handleSpecialCharacters(String name) { return name; }
79117910

79127911
public String getItemsName(Schema containingSchema, String containingSchemaName) {
7913-
String itemName = null;
7914-
if (containingSchema != null) {
7915-
// fromProperty use case
7916-
if (containingSchema.getExtensions() != null && containingSchema.getExtensions().get("x-item-name") != null) {
7917-
return containingSchema.getExtensions().get("x-item-name").toString();
7918-
}
7919-
return toVarName(containingSchemaName);
7912+
if (containingSchema.getExtensions() != null && containingSchema.getExtensions().get("x-item-name") != null) {
7913+
return containingSchema.getExtensions().get("x-item-name").toString();
79207914
}
7921-
// fromModel use case
7922-
return containingSchemaName;
7915+
return toVarName(containingSchemaName);
79237916
}
79247917

79257918
public String getAdditionalPropertiesName() {

0 commit comments

Comments
 (0)