Merge pull request #385 from etherealjoy/fix_new_keyword_collection

[aspnetcore] Fix new keyword collection
This commit is contained in:
Jean-François Côté 2018-06-27 08:07:38 -04:00 committed by GitHub
commit 9990ddbe52
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 18 additions and 17 deletions

View File

@ -58,7 +58,7 @@ public class CodegenModel {
public Set<String> allMandatory;
public Set<String> imports = new TreeSet<String>();
public boolean hasVars, emptyVars, hasMoreModels, hasEnums, isEnum, hasRequired, hasOptional, isArrayModel, hasChildren;
public boolean hasVars, emptyVars, hasMoreModels, hasEnums, isEnum, hasRequired, hasOptional, isArrayModel, hasChildren, isMapModel;
public boolean hasOnlyReadOnly = true; // true if all properties are read-only
public ExternalDocumentation externalDocumentation;

View File

@ -218,7 +218,7 @@ public class DefaultCodegen implements CodegenConfig {
}
parent.getChildren().add(cm);
if (parent.getDiscriminator() == null) {
parent = allModels.get(parent.parent);
parent = allModels.get(parent.getParent());
} else {
parent = null;
}
@ -1521,6 +1521,7 @@ public class DefaultCodegen implements CodegenConfig {
}
if (ModelUtils.isMapSchema(schema)) {
addAdditionPropertiesToCodeGenModel(m, schema);
m.isMapModel = true;
}
addVars(m, schema.getProperties(), schema.getRequired());
}

View File

@ -56,7 +56,7 @@ namespace {{packageName}}.Models
/// Returns the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public {{#parent}} new {{/parent}}string ToJson()
public {{#parent}}{{^isMapModel}}{{^isArrayModel}}new {{/isArrayModel}}{{/isMapModel}}{{/parent}}string ToJson()
{
return JsonConvert.SerializeObject(this, Formatting.Indented);
}
@ -68,7 +68,7 @@ namespace {{packageName}}.Models
/// <returns>Boolean</returns>
public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj)) return false;
if (obj is null) return false;
if (ReferenceEquals(this, obj)) return true;
return obj.GetType() == GetType() && Equals(({{classname}})obj);
}
@ -80,7 +80,7 @@ namespace {{packageName}}.Models
/// <returns>Boolean</returns>
public bool Equals({{classname}} other)
{
if (ReferenceEquals(null, other)) return false;
if (other is null) return false;
if (ReferenceEquals(this, other)) return true;
return {{#vars}}{{#isNotContainer}}

View File

@ -73,7 +73,7 @@ namespace Org.OpenAPITools.Models
/// <returns>Boolean</returns>
public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj)) return false;
if (obj is null) return false;
if (ReferenceEquals(this, obj)) return true;
return obj.GetType() == GetType() && Equals((ApiResponse)obj);
}
@ -85,7 +85,7 @@ namespace Org.OpenAPITools.Models
/// <returns>Boolean</returns>
public bool Equals(ApiResponse other)
{
if (ReferenceEquals(null, other)) return false;
if (other is null) return false;
if (ReferenceEquals(this, other)) return true;
return

View File

@ -66,7 +66,7 @@ namespace Org.OpenAPITools.Models
/// <returns>Boolean</returns>
public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj)) return false;
if (obj is null) return false;
if (ReferenceEquals(this, obj)) return true;
return obj.GetType() == GetType() && Equals((Category)obj);
}
@ -78,7 +78,7 @@ namespace Org.OpenAPITools.Models
/// <returns>Boolean</returns>
public bool Equals(Category other)
{
if (ReferenceEquals(null, other)) return false;
if (other is null) return false;
if (ReferenceEquals(this, other)) return true;
return

View File

@ -122,7 +122,7 @@ namespace Org.OpenAPITools.Models
/// <returns>Boolean</returns>
public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj)) return false;
if (obj is null) return false;
if (ReferenceEquals(this, obj)) return true;
return obj.GetType() == GetType() && Equals((Order)obj);
}
@ -134,7 +134,7 @@ namespace Org.OpenAPITools.Models
/// <returns>Boolean</returns>
public bool Equals(Order other)
{
if (ReferenceEquals(null, other)) return false;
if (other is null) return false;
if (ReferenceEquals(this, other)) return true;
return

View File

@ -124,7 +124,7 @@ namespace Org.OpenAPITools.Models
/// <returns>Boolean</returns>
public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj)) return false;
if (obj is null) return false;
if (ReferenceEquals(this, obj)) return true;
return obj.GetType() == GetType() && Equals((Pet)obj);
}
@ -136,7 +136,7 @@ namespace Org.OpenAPITools.Models
/// <returns>Boolean</returns>
public bool Equals(Pet other)
{
if (ReferenceEquals(null, other)) return false;
if (other is null) return false;
if (ReferenceEquals(this, other)) return true;
return

View File

@ -66,7 +66,7 @@ namespace Org.OpenAPITools.Models
/// <returns>Boolean</returns>
public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj)) return false;
if (obj is null) return false;
if (ReferenceEquals(this, obj)) return true;
return obj.GetType() == GetType() && Equals((Tag)obj);
}
@ -78,7 +78,7 @@ namespace Org.OpenAPITools.Models
/// <returns>Boolean</returns>
public bool Equals(Tag other)
{
if (ReferenceEquals(null, other)) return false;
if (other is null) return false;
if (ReferenceEquals(this, other)) return true;
return

View File

@ -109,7 +109,7 @@ namespace Org.OpenAPITools.Models
/// <returns>Boolean</returns>
public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj)) return false;
if (obj is null) return false;
if (ReferenceEquals(this, obj)) return true;
return obj.GetType() == GetType() && Equals((User)obj);
}
@ -121,7 +121,7 @@ namespace Org.OpenAPITools.Models
/// <returns>Boolean</returns>
public bool Equals(User other)
{
if (ReferenceEquals(null, other)) return false;
if (other is null) return false;
if (ReferenceEquals(this, other)) return true;
return