Skip to content

Commit f45ec31

Browse files
committed
Updated as requested to use isMapModel
1 parent dd4b1af commit f45ec31

3 files changed

Lines changed: 3 additions & 4 deletions

File tree

modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenModel.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public class CodegenModel {
5858
public Set<String> allMandatory;
5959

6060
public Set<String> imports = new TreeSet<String>();
61-
public boolean hasVars, emptyVars, hasMoreModels, hasEnums, isEnum, hasRequired, hasOptional, isArrayModel, hasChildren, isCollectionModel;
61+
public boolean hasVars, emptyVars, hasMoreModels, hasEnums, isEnum, hasRequired, hasOptional, isArrayModel, hasChildren, isMapModel;
6262
public boolean hasOnlyReadOnly = true; // true if all properties are read-only
6363
public ExternalDocumentation externalDocumentation;
6464

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1412,7 +1412,6 @@ public CodegenModel fromModel(String name, Schema schema, Map<String, Schema> al
14121412

14131413
if (ModelUtils.isArraySchema(schema)) {
14141414
m.isArrayModel = true;
1415-
m.isCollectionModel = true;
14161415
m.arrayModelType = fromProperty(name, schema).complexType;
14171416
addParentContainer(m, name, schema);
14181417
} else if (schema instanceof ComposedSchema) {
@@ -1522,7 +1521,7 @@ public CodegenModel fromModel(String name, Schema schema, Map<String, Schema> al
15221521
}
15231522
if (ModelUtils.isMapSchema(schema)) {
15241523
addAdditionPropertiesToCodeGenModel(m, schema);
1525-
m.isCollectionModel = true;
1524+
m.isMapModel = true;
15261525
}
15271526
addVars(m, schema.getProperties(), schema.getRequired());
15281527
}

modules/openapi-generator/src/main/resources/aspnetcore/model.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ namespace {{packageName}}.Models
5656
/// Returns the JSON string presentation of the object
5757
/// </summary>
5858
/// <returns>JSON string presentation of the object</returns>
59-
public {{#parent}}{{^isCollectionModel}}new {{/isCollectionModel}}{{/parent}}string ToJson()
59+
public {{#parent}}{{^isMapModel}}{{^isArrayModel}}new {{/isArrayModel}}{{/isMapModel}}{{/parent}}string ToJson()
6060
{
6161
return JsonConvert.SerializeObject(this, Formatting.Indented);
6262
}

0 commit comments

Comments
 (0)