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

Fixes fromModel arrayModel items assignment #94

Merged
merged 1 commit into from
Nov 23, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2934,8 +2934,7 @@ public CodegenModel fromModel(String name, Schema schema) {
m.setFormat(schema.getFormat());
m.setComposedSchemas(getComposedSchemas(schema));
if (ModelUtils.isArraySchema(schema)) {
String itemName = getItemsName(null, name);
CodegenProperty arrayProperty = fromProperty(itemName, schema, false);
CodegenProperty arrayProperty = fromProperty(name, schema, false);
m.setItems(arrayProperty.items);
m.arrayModelType = arrayProperty.complexType;
addParentContainer(m, name, schema);
Expand Down Expand Up @@ -7910,16 +7909,10 @@ public List<VendorExtension> getSupportedVendorExtensions() {
protected String handleSpecialCharacters(String name) { return name; }

public String getItemsName(Schema containingSchema, String containingSchemaName) {
String itemName = null;
if (containingSchema != null) {
// fromProperty use case
if (containingSchema.getExtensions() != null && containingSchema.getExtensions().get("x-item-name") != null) {
return containingSchema.getExtensions().get("x-item-name").toString();
}
return toVarName(containingSchemaName);
if (containingSchema.getExtensions() != null && containingSchema.getExtensions().get("x-item-name") != null) {
return containingSchema.getExtensions().get("x-item-name").toString();
}
// fromModel use case
return containingSchemaName;
return toVarName(containingSchemaName);
}

public String getAdditionalPropertiesName() {
Expand Down