forked from loafle/openapi-generator-original
Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
8ecf9e352d | ||
|
07d4f7d534 | ||
|
659885f509 |
@ -153,6 +153,23 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
|
||||
*/
|
||||
public boolean isAdditionalPropertiesTrue;
|
||||
|
||||
/**
|
||||
* True if additional properties is set to any type
|
||||
*/
|
||||
public boolean isAdditionalPropertiesAnyType;
|
||||
|
||||
/**
|
||||
* True if additional properties is set to free form object
|
||||
*/
|
||||
public boolean isAdditionalPropertiesFreeFormObject;
|
||||
|
||||
/**
|
||||
* True if additional properties is enabled (boolean or any type)
|
||||
*/
|
||||
public boolean isAdditionalPropertiesEnabled() {
|
||||
return isAdditionalPropertiesTrue || isAdditionalPropertiesAnyType || isAdditionalPropertiesFreeFormObject;
|
||||
}
|
||||
|
||||
private Integer maxProperties;
|
||||
private Integer minProperties;
|
||||
private boolean uniqueItems;
|
||||
@ -1088,6 +1105,9 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
|
||||
Objects.equals(externalDocumentation, that.externalDocumentation) &&
|
||||
Objects.equals(vendorExtensions, that.vendorExtensions) &&
|
||||
Objects.equals(additionalPropertiesType, that.additionalPropertiesType) &&
|
||||
Objects.equals(isAdditionalPropertiesAnyType, that.isAdditionalPropertiesAnyType) &&
|
||||
Objects.equals(isAdditionalPropertiesFreeFormObject, that.isAdditionalPropertiesFreeFormObject) &&
|
||||
Objects.equals(isAdditionalPropertiesTrue, that.isAdditionalPropertiesTrue) &&
|
||||
Objects.equals(getMaxProperties(), that.getMaxProperties()) &&
|
||||
Objects.equals(getMinProperties(), that.getMinProperties()) &&
|
||||
Objects.equals(getMaxItems(), that.getMaxItems()) &&
|
||||
@ -1121,7 +1141,8 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
|
||||
getAdditionalPropertiesIsAnyType(), hasDiscriminatorWithNonEmptyMapping,
|
||||
isAnyType, getComposedSchemas(), hasMultipleTypes, isDecimal, isUuid, requiredVarsMap, ref,
|
||||
uniqueItemsBoolean, schemaIsFromAdditionalProperties, isBooleanSchemaTrue, isBooleanSchemaFalse,
|
||||
format, dependentRequired, contains);
|
||||
format, dependentRequired, contains, isAdditionalPropertiesTrue, isAdditionalPropertiesFreeFormObject,
|
||||
isAdditionalPropertiesFreeFormObject);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -1227,6 +1248,9 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
|
||||
sb.append(", format=").append(format);
|
||||
sb.append(", dependentRequired=").append(dependentRequired);
|
||||
sb.append(", contains=").append(contains);
|
||||
sb.append(", isAdditionalPropertiesAnyType=").append(isAdditionalPropertiesAnyType);
|
||||
sb.append(", isAdditionalPropertiesFreeFormObject=").append(isAdditionalPropertiesFreeFormObject);
|
||||
sb.append(", isAdditionalPropertiesTrue=").append(isAdditionalPropertiesTrue);
|
||||
sb.append('}');
|
||||
return sb.toString();
|
||||
}
|
||||
|
@ -3167,13 +3167,16 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
// if we are trying to set additionalProperties on an empty schema stop recursing
|
||||
return;
|
||||
}
|
||||
|
||||
boolean additionalPropertiesIsAnyType = false;
|
||||
boolean isAdditionalPropertiesTrue = false;
|
||||
boolean isAdditionalPropertiesFreeFormObject = false;
|
||||
|
||||
CodegenModel m = null;
|
||||
if (property instanceof CodegenModel) {
|
||||
m = (CodegenModel) property;
|
||||
}
|
||||
CodegenProperty addPropProp = null;
|
||||
boolean isAdditionalPropertiesTrue = false;
|
||||
if (schema.getAdditionalProperties() == null) {
|
||||
if (!disallowAdditionalPropertiesIfNotPresent) {
|
||||
isAdditionalPropertiesTrue = true;
|
||||
@ -3183,20 +3186,25 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
} else if (schema.getAdditionalProperties() instanceof Boolean) {
|
||||
if (Boolean.TRUE.equals(schema.getAdditionalProperties())) {
|
||||
isAdditionalPropertiesTrue = true;
|
||||
addPropProp = fromProperty(getAdditionalPropertiesName(), new Schema(), false);
|
||||
additionalPropertiesIsAnyType = true;
|
||||
}
|
||||
} else {
|
||||
addPropProp = fromProperty(getAdditionalPropertiesName(), (Schema) schema.getAdditionalProperties(), false);
|
||||
if (ModelUtils.isAnyType((Schema) schema.getAdditionalProperties())) {
|
||||
isAdditionalPropertiesTrue = true;
|
||||
additionalPropertiesIsAnyType = true;
|
||||
}
|
||||
|
||||
if (ModelUtils.isFreeFormObject((Schema) schema.getAdditionalProperties())) {
|
||||
isAdditionalPropertiesFreeFormObject = true;
|
||||
}
|
||||
}
|
||||
if (additionalPropertiesIsAnyType) {
|
||||
property.setAdditionalPropertiesIsAnyType(true);
|
||||
}
|
||||
if (m != null && isAdditionalPropertiesTrue) {
|
||||
m.isAdditionalPropertiesTrue = true;
|
||||
if (m != null) {
|
||||
m.isAdditionalPropertiesTrue = isAdditionalPropertiesTrue;
|
||||
m.isAdditionalPropertiesAnyType = additionalPropertiesIsAnyType;
|
||||
m.isAdditionalPropertiesFreeFormObject = isAdditionalPropertiesFreeFormObject;
|
||||
}
|
||||
if (ModelUtils.isComposedSchema(schema) && !supportsAdditionalPropertiesWithComposedSchema) {
|
||||
return;
|
||||
|
@ -1,4 +1,4 @@
|
||||
{{#isAdditionalPropertiesTrue}}
|
||||
{{#isAdditionalPropertiesEnabled}}
|
||||
/**
|
||||
* A container for additional, undeclared properties.
|
||||
* This is a holder for any undeclared properties as specified with
|
||||
@ -43,4 +43,4 @@
|
||||
}
|
||||
return this.additionalProperties.get(key);
|
||||
}
|
||||
{{/isAdditionalPropertiesTrue}}
|
||||
{{/isAdditionalPropertiesEnabled}}
|
||||
|
@ -314,8 +314,8 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
|
||||
}{{#hasVars}}
|
||||
{{classname}} {{classVarName}} = ({{classname}}) o;
|
||||
return {{#vars}}{{#vendorExtensions.x-is-jackson-optional-nullable}}equalsNullable(this.{{name}}, {{classVarName}}.{{name}}){{/vendorExtensions.x-is-jackson-optional-nullable}}{{^vendorExtensions.x-is-jackson-optional-nullable}}{{#isByteArray}}Arrays{{/isByteArray}}{{^isByteArray}}Objects{{/isByteArray}}.equals(this.{{name}}, {{classVarName}}.{{name}}){{/vendorExtensions.x-is-jackson-optional-nullable}}{{^-last}} &&
|
||||
{{/-last}}{{/vars}}{{#isAdditionalPropertiesTrue}}&&
|
||||
Objects.equals(this.additionalProperties, {{classVarName}}.additionalProperties){{/isAdditionalPropertiesTrue}}{{#parent}} &&
|
||||
{{/-last}}{{/vars}}{{#isAdditionalPropertiesEnabled}}&&
|
||||
Objects.equals(this.additionalProperties, {{classVarName}}.additionalProperties){{/isAdditionalPropertiesEnabled}}{{#parent}} &&
|
||||
super.equals(o){{/parent}};{{/hasVars}}{{^hasVars}}
|
||||
return {{#parent}}super.equals(o){{/parent}}{{^parent}}true{{/parent}};{{/hasVars}}
|
||||
{{/useReflectionEqualsHashCode}}
|
||||
@ -331,7 +331,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
|
||||
return HashCodeBuilder.reflectionHashCode(this);
|
||||
{{/useReflectionEqualsHashCode}}
|
||||
{{^useReflectionEqualsHashCode}}
|
||||
return Objects.hash({{#vars}}{{#vendorExtensions.x-is-jackson-optional-nullable}}hashCodeNullable({{name}}){{/vendorExtensions.x-is-jackson-optional-nullable}}{{^vendorExtensions.x-is-jackson-optional-nullable}}{{^isByteArray}}{{name}}{{/isByteArray}}{{#isByteArray}}Arrays.hashCode({{name}}){{/isByteArray}}{{/vendorExtensions.x-is-jackson-optional-nullable}}{{^-last}}, {{/-last}}{{/vars}}{{#parent}}{{#hasVars}}, {{/hasVars}}super.hashCode(){{/parent}}{{#isAdditionalPropertiesTrue}}{{#hasVars}}, {{/hasVars}}{{^hasVars}}{{#parent}}, {{/parent}}{{/hasVars}}additionalProperties{{/isAdditionalPropertiesTrue}});
|
||||
return Objects.hash({{#vars}}{{#vendorExtensions.x-is-jackson-optional-nullable}}hashCodeNullable({{name}}){{/vendorExtensions.x-is-jackson-optional-nullable}}{{^vendorExtensions.x-is-jackson-optional-nullable}}{{^isByteArray}}{{name}}{{/isByteArray}}{{#isByteArray}}Arrays.hashCode({{name}}){{/isByteArray}}{{/vendorExtensions.x-is-jackson-optional-nullable}}{{^-last}}, {{/-last}}{{/vars}}{{#parent}}{{#hasVars}}, {{/hasVars}}super.hashCode(){{/parent}}{{#isAdditionalPropertiesEnabled}}{{#hasVars}}, {{/hasVars}}{{^hasVars}}{{#parent}}, {{/parent}}{{/hasVars}}additionalProperties{{/isAdditionalPropertiesEnabled}});
|
||||
{{/useReflectionEqualsHashCode}}
|
||||
}{{#vendorExtensions.x-jackson-optional-nullable-helpers}}
|
||||
|
||||
@ -352,9 +352,9 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
|
||||
{{#vars}}
|
||||
sb.append(" {{name}}: ").append(toIndentedString({{name}})).append("\n");
|
||||
{{/vars}}
|
||||
{{#isAdditionalPropertiesTrue}}
|
||||
{{#isAdditionalPropertiesEnabled}}
|
||||
sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n");
|
||||
{{/isAdditionalPropertiesTrue}}
|
||||
{{/isAdditionalPropertiesEnabled}}
|
||||
sb.append("}");
|
||||
return sb.toString();
|
||||
}
|
||||
@ -460,7 +460,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
|
||||
}
|
||||
}
|
||||
{{^hasChildren}}
|
||||
{{^isAdditionalPropertiesTrue}}
|
||||
{{^isAdditionalPropertiesEnabled}}
|
||||
|
||||
Set<Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet();
|
||||
// check to see if the JSON string contains additional fields
|
||||
@ -469,7 +469,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
|
||||
throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `{{classname}}` properties. JSON: %s", entry.getKey(), jsonElement.toString()));
|
||||
}
|
||||
}
|
||||
{{/isAdditionalPropertiesTrue}}
|
||||
{{/isAdditionalPropertiesEnabled}}
|
||||
{{#requiredVars}}
|
||||
{{#-first}}
|
||||
|
||||
@ -589,7 +589,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
|
||||
@Override
|
||||
public void write(JsonWriter out, {{classname}} value) throws IOException {
|
||||
JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject();
|
||||
{{#isAdditionalPropertiesTrue}}
|
||||
{{#isAdditionalPropertiesEnabled}}
|
||||
obj.remove("additionalProperties");
|
||||
// serialize additional properties
|
||||
if (value.getAdditionalProperties() != null) {
|
||||
@ -607,7 +607,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
|
||||
}
|
||||
}
|
||||
}
|
||||
{{/isAdditionalPropertiesTrue}}
|
||||
{{/isAdditionalPropertiesEnabled}}
|
||||
elementAdapter.write(out, obj);
|
||||
}
|
||||
|
||||
@ -615,7 +615,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
|
||||
public {{classname}} read(JsonReader in) throws IOException {
|
||||
JsonElement jsonElement = elementAdapter.read(in);
|
||||
validateJsonElement(jsonElement);
|
||||
{{#isAdditionalPropertiesTrue}}
|
||||
{{#isAdditionalPropertiesEnabled}}
|
||||
JsonObject jsonObj = jsonElement.getAsJsonObject();
|
||||
// store additional fields in the deserialized instance
|
||||
{{classname}} instance = thisAdapter.fromJsonTree(jsonObj);
|
||||
@ -638,10 +638,10 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens
|
||||
}
|
||||
}
|
||||
return instance;
|
||||
{{/isAdditionalPropertiesTrue}}
|
||||
{{^isAdditionalPropertiesTrue}}
|
||||
{{/isAdditionalPropertiesEnabled}}
|
||||
{{^isAdditionalPropertiesEnabled}}
|
||||
return thisAdapter.fromJsonTree(jsonElement);
|
||||
{{/isAdditionalPropertiesTrue}}
|
||||
{{/isAdditionalPropertiesEnabled}}
|
||||
}
|
||||
|
||||
}.nullSafe();
|
||||
|
@ -97,15 +97,15 @@
|
||||
/// Initializes a new instance of the <see cref="{{classname}}" /> class.
|
||||
/// </summary>
|
||||
[JsonConstructorAttribute]
|
||||
{{^isAdditionalPropertiesTrue}}
|
||||
{{^isAdditionalPropertiesEnabled}}
|
||||
protected {{classname}}() { }
|
||||
{{/isAdditionalPropertiesTrue}}
|
||||
{{#isAdditionalPropertiesTrue}}
|
||||
{{/isAdditionalPropertiesEnabled}}
|
||||
{{#isAdditionalPropertiesEnabled}}
|
||||
protected {{classname}}()
|
||||
{
|
||||
this.AdditionalProperties = new Dictionary<string, object>();
|
||||
}
|
||||
{{/isAdditionalPropertiesTrue}}
|
||||
{{/isAdditionalPropertiesEnabled}}
|
||||
{{/hasOnlyReadOnly}}
|
||||
{{/hasRequired}}
|
||||
/// <summary>
|
||||
@ -170,9 +170,9 @@
|
||||
{{/isReadOnly}}
|
||||
{{/isInherited}}
|
||||
{{/vars}}
|
||||
{{#isAdditionalPropertiesTrue}}
|
||||
{{#isAdditionalPropertiesEnabled}}
|
||||
this.AdditionalProperties = new Dictionary<string, object>();
|
||||
{{/isAdditionalPropertiesTrue}}
|
||||
{{/isAdditionalPropertiesEnabled}}
|
||||
}
|
||||
|
||||
{{#vars}}
|
||||
@ -250,14 +250,14 @@
|
||||
{{/isEnum}}
|
||||
{{/isInherited}}
|
||||
{{/vars}}
|
||||
{{#isAdditionalPropertiesTrue}}
|
||||
{{#isAdditionalPropertiesEnabled}}
|
||||
/// <summary>
|
||||
/// Gets or Sets additional properties
|
||||
/// </summary>
|
||||
[JsonExtensionData]
|
||||
public IDictionary<string, object> AdditionalProperties { get; set; }
|
||||
|
||||
{{/isAdditionalPropertiesTrue}}
|
||||
{{/isAdditionalPropertiesEnabled}}
|
||||
/// <summary>
|
||||
/// Returns the string presentation of the object
|
||||
/// </summary>
|
||||
@ -272,9 +272,9 @@
|
||||
{{#vars}}
|
||||
sb.Append(" {{name}}: ").Append({{name}}).Append("\n");
|
||||
{{/vars}}
|
||||
{{#isAdditionalPropertiesTrue}}
|
||||
{{#isAdditionalPropertiesEnabled}}
|
||||
sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n");
|
||||
{{/isAdditionalPropertiesTrue}}
|
||||
{{/isAdditionalPropertiesEnabled}}
|
||||
sb.Append("}\n");
|
||||
return sb.ToString();
|
||||
}
|
||||
@ -333,10 +333,10 @@
|
||||
{{^vendorExtensions.x-is-value-type}}this.{{name}} != null &&
|
||||
input.{{name}} != null &&
|
||||
{{/vendorExtensions.x-is-value-type}}this.{{name}}.SequenceEqual(input.{{name}})
|
||||
){{^-last}} && {{/-last}}{{/isContainer}}{{/vars}}{{^vars}}{{#parent}}base.Equals(input){{/parent}}{{^parent}}false{{/parent}}{{/vars}}{{^isAdditionalPropertiesTrue}};{{/isAdditionalPropertiesTrue}}
|
||||
{{#isAdditionalPropertiesTrue}}
|
||||
){{^-last}} && {{/-last}}{{/isContainer}}{{/vars}}{{^vars}}{{#parent}}base.Equals(input){{/parent}}{{^parent}}false{{/parent}}{{/vars}}{{^isAdditionalPropertiesEnabled}};{{/isAdditionalPropertiesEnabled}}
|
||||
{{#isAdditionalPropertiesEnabled}}
|
||||
&& (this.AdditionalProperties.Count == input.AdditionalProperties.Count && !this.AdditionalProperties.Except(input.AdditionalProperties).Any());
|
||||
{{/isAdditionalPropertiesTrue}}
|
||||
{{/isAdditionalPropertiesEnabled}}
|
||||
{{/useCompareNetObjects}}
|
||||
}
|
||||
|
||||
@ -363,10 +363,10 @@
|
||||
hashCode = hashCode * 59 + this.{{name}}.GetHashCode();
|
||||
{{/vendorExtensions.x-is-value-type}}
|
||||
{{/vars}}
|
||||
{{#isAdditionalPropertiesTrue}}
|
||||
{{#isAdditionalPropertiesEnabled}}
|
||||
if (this.AdditionalProperties != null)
|
||||
hashCode = hashCode * 59 + this.AdditionalProperties.GetHashCode();
|
||||
{{/isAdditionalPropertiesTrue}}
|
||||
{{/isAdditionalPropertiesEnabled}}
|
||||
return hashCode;
|
||||
}
|
||||
}
|
||||
|
@ -168,7 +168,7 @@
|
||||
{{/isInherited}}
|
||||
{{/isEnum}}
|
||||
{{/allVars}}
|
||||
{{#isAdditionalPropertiesTrue}}
|
||||
{{#isAdditionalPropertiesEnabled}}
|
||||
{{^parentModel}}
|
||||
/// <summary>
|
||||
/// Gets or Sets additional properties
|
||||
@ -177,7 +177,7 @@
|
||||
public Dictionary<string, JsonElement> AdditionalProperties { get; } = new Dictionary<string, JsonElement>();
|
||||
|
||||
{{/parentModel}}
|
||||
{{/isAdditionalPropertiesTrue}}
|
||||
{{/isAdditionalPropertiesEnabled}}
|
||||
/// <summary>
|
||||
/// Returns the string presentation of the object
|
||||
/// </summary>
|
||||
@ -192,11 +192,11 @@
|
||||
{{#vars}}
|
||||
sb.Append(" {{name}}: ").Append({{name}}).Append("\n");
|
||||
{{/vars}}
|
||||
{{#isAdditionalPropertiesTrue}}
|
||||
{{#isAdditionalPropertiesEnabled}}
|
||||
{{^parentModel}}
|
||||
sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n");
|
||||
{{/parentModel}}
|
||||
{{/isAdditionalPropertiesTrue}}
|
||||
{{/isAdditionalPropertiesEnabled}}
|
||||
sb.Append("}\n");
|
||||
return sb.ToString();
|
||||
}
|
||||
@ -249,12 +249,12 @@
|
||||
{{^vendorExtensions.x-is-value-type}}{{name}} != null &&
|
||||
input.{{name}} != null &&
|
||||
{{/vendorExtensions.x-is-value-type}}{{name}}.SequenceEqual(input.{{name}})
|
||||
){{^-last}} && {{/-last}}{{/isContainer}}{{/isInherited}}{{/readOnlyVars}}{{^readOnlyVars}}{{#parent}}base.Equals(input){{/parent}}{{^parent}}false{{/parent}}{{/readOnlyVars}}{{^isAdditionalPropertiesTrue}};{{/isAdditionalPropertiesTrue}}
|
||||
{{#isAdditionalPropertiesTrue}}
|
||||
){{^-last}} && {{/-last}}{{/isContainer}}{{/isInherited}}{{/readOnlyVars}}{{^readOnlyVars}}{{#parent}}base.Equals(input){{/parent}}{{^parent}}false{{/parent}}{{/readOnlyVars}}{{^isAdditionalPropertiesEnabled}};{{/isAdditionalPropertiesEnabled}}
|
||||
{{#isAdditionalPropertiesEnabled}}
|
||||
{{^parentModel}}
|
||||
&& (AdditionalProperties.Count == input.AdditionalProperties.Count && !AdditionalProperties.Except(input.AdditionalProperties).Any());
|
||||
{{/parentModel}}
|
||||
{{/isAdditionalPropertiesTrue}}
|
||||
{{/isAdditionalPropertiesEnabled}}
|
||||
{{/useCompareNetObjects}}
|
||||
}
|
||||
|
||||
@ -284,11 +284,11 @@
|
||||
hashCode = (hashCode * 59) + {{name}}.GetHashCode();
|
||||
{{/isNullable}}
|
||||
{{/readOnlyVars}}
|
||||
{{#isAdditionalPropertiesTrue}}
|
||||
{{#isAdditionalPropertiesEnabled}}
|
||||
{{^parentModel}}
|
||||
hashCode = (hashCode * 59) + AdditionalProperties.GetHashCode();
|
||||
{{/parentModel}}
|
||||
{{/isAdditionalPropertiesTrue}}
|
||||
{{/isAdditionalPropertiesEnabled}}
|
||||
|
||||
return hashCode;
|
||||
}
|
||||
|
@ -114,15 +114,15 @@
|
||||
/// Initializes a new instance of the <see cref="{{classname}}" /> class.
|
||||
/// </summary>
|
||||
[JsonConstructorAttribute]
|
||||
{{^isAdditionalPropertiesTrue}}
|
||||
{{^isAdditionalPropertiesEnabled}}
|
||||
protected {{classname}}() { }
|
||||
{{/isAdditionalPropertiesTrue}}
|
||||
{{#isAdditionalPropertiesTrue}}
|
||||
{{/isAdditionalPropertiesEnabled}}
|
||||
{{#isAdditionalPropertiesEnabled}}
|
||||
protected {{classname}}()
|
||||
{
|
||||
this.AdditionalProperties = new Dictionary<string, object>();
|
||||
}
|
||||
{{/isAdditionalPropertiesTrue}}
|
||||
{{/isAdditionalPropertiesEnabled}}
|
||||
{{/hasOnlyReadOnly}}
|
||||
{{/hasRequired}}
|
||||
/// <summary>
|
||||
@ -201,9 +201,9 @@
|
||||
{{/isReadOnly}}
|
||||
{{/isInherited}}
|
||||
{{/vars}}
|
||||
{{#isAdditionalPropertiesTrue}}
|
||||
{{#isAdditionalPropertiesEnabled}}
|
||||
this.AdditionalProperties = new Dictionary<string, object>();
|
||||
{{/isAdditionalPropertiesTrue}}
|
||||
{{/isAdditionalPropertiesEnabled}}
|
||||
}
|
||||
|
||||
{{#vars}}
|
||||
@ -290,14 +290,14 @@
|
||||
{{/isEnum}}
|
||||
{{/isInherited}}
|
||||
{{/vars}}
|
||||
{{#isAdditionalPropertiesTrue}}
|
||||
{{#isAdditionalPropertiesEnabled}}
|
||||
/// <summary>
|
||||
/// Gets or Sets additional properties
|
||||
/// </summary>
|
||||
[JsonExtensionData]
|
||||
public IDictionary<string, object> AdditionalProperties { get; set; }
|
||||
|
||||
{{/isAdditionalPropertiesTrue}}
|
||||
{{/isAdditionalPropertiesEnabled}}
|
||||
/// <summary>
|
||||
/// Returns the string presentation of the object
|
||||
/// </summary>
|
||||
@ -312,9 +312,9 @@
|
||||
{{#vars}}
|
||||
sb.Append(" {{name}}: ").Append({{name}}).Append("\n");
|
||||
{{/vars}}
|
||||
{{#isAdditionalPropertiesTrue}}
|
||||
{{#isAdditionalPropertiesEnabled}}
|
||||
sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n");
|
||||
{{/isAdditionalPropertiesTrue}}
|
||||
{{/isAdditionalPropertiesEnabled}}
|
||||
sb.Append("}\n");
|
||||
return sb.ToString();
|
||||
}
|
||||
@ -375,10 +375,10 @@
|
||||
{{^vendorExtensions.x-is-value-type}}this.{{name}} != null &&
|
||||
input.{{name}} != null &&
|
||||
{{/vendorExtensions.x-is-value-type}}this.{{name}}.SequenceEqual(input.{{name}})
|
||||
){{^-last}} && {{/-last}}{{/isContainer}}{{/vars}}{{^vars}}{{#parent}}base.Equals(input){{/parent}}{{^parent}}false{{/parent}}{{/vars}}{{^isAdditionalPropertiesTrue}};{{/isAdditionalPropertiesTrue}}
|
||||
{{#isAdditionalPropertiesTrue}}
|
||||
){{^-last}} && {{/-last}}{{/isContainer}}{{/vars}}{{^vars}}{{#parent}}base.Equals(input){{/parent}}{{^parent}}false{{/parent}}{{/vars}}{{^isAdditionalPropertiesEnabled}};{{/isAdditionalPropertiesEnabled}}
|
||||
{{#isAdditionalPropertiesEnabled}}
|
||||
&& (this.AdditionalProperties.Count == input.AdditionalProperties.Count && !this.AdditionalProperties.Except(input.AdditionalProperties).Any());
|
||||
{{/isAdditionalPropertiesTrue}}
|
||||
{{/isAdditionalPropertiesEnabled}}
|
||||
{{/useCompareNetObjects}}
|
||||
}
|
||||
|
||||
@ -407,12 +407,12 @@
|
||||
hashCode = (hashCode * 59) + this.{{name}}.GetHashCode();
|
||||
{{/vendorExtensions.x-is-value-type}}
|
||||
{{/vars}}
|
||||
{{#isAdditionalPropertiesTrue}}
|
||||
{{#isAdditionalPropertiesEnabled}}
|
||||
if (this.AdditionalProperties != null)
|
||||
{
|
||||
hashCode = (hashCode * 59) + this.AdditionalProperties.GetHashCode();
|
||||
}
|
||||
{{/isAdditionalPropertiesTrue}}
|
||||
{{/isAdditionalPropertiesEnabled}}
|
||||
return hashCode;
|
||||
}
|
||||
}
|
||||
|
@ -400,9 +400,9 @@ func (c *{{classname}}Controller) {{nickname}}(w http.ResponseWriter, r *http.Re
|
||||
{{#isBodyParam}}
|
||||
{{paramName}}Param := {{dataType}}{}
|
||||
d := json.NewDecoder(r.Body)
|
||||
{{^isAdditionalPropertiesTrue}}
|
||||
{{^isAdditionalPropertiesEnabled}}
|
||||
d.DisallowUnknownFields()
|
||||
{{/isAdditionalPropertiesTrue}}
|
||||
{{/isAdditionalPropertiesEnabled}}
|
||||
if err := d.Decode(&{{paramName}}Param); err != nil {
|
||||
c.errorHandler(w, r, &ParsingError{Err: err}, nil)
|
||||
return
|
||||
|
@ -24,15 +24,15 @@ type {{classname}} struct {
|
||||
{{/deprecated}}
|
||||
{{name}} {{^required}}{{^isNullable}}{{^isArray}}{{^isFreeFormObject}}*{{/isFreeFormObject}}{{/isArray}}{{/isNullable}}{{/required}}{{{dataType}}} `json:"{{baseName}}{{^required}},omitempty{{/required}}"{{#withXml}} xml:"{{baseName}}{{#isXmlAttribute}},attr{{/isXmlAttribute}}"{{/withXml}}{{#vendorExtensions.x-go-custom-tag}} {{{.}}}{{/vendorExtensions.x-go-custom-tag}}`
|
||||
{{/vars}}
|
||||
{{#isAdditionalPropertiesTrue}}
|
||||
{{#isAdditionalPropertiesEnabled}}
|
||||
AdditionalProperties map[string]interface{}
|
||||
{{/isAdditionalPropertiesTrue}}
|
||||
{{/isAdditionalPropertiesEnabled}}
|
||||
}
|
||||
|
||||
{{#isAdditionalPropertiesTrue}}
|
||||
{{#isAdditionalPropertiesEnabled}}
|
||||
type _{{{classname}}} {{{classname}}}
|
||||
|
||||
{{/isAdditionalPropertiesTrue}}
|
||||
{{/isAdditionalPropertiesEnabled}}
|
||||
// New{{classname}} instantiates a new {{classname}} object
|
||||
// This constructor will assign default values to properties that have it defined,
|
||||
// and makes sure properties required by API are set, but the set of arguments
|
||||
@ -321,17 +321,17 @@ func (o {{classname}}) ToMap() (map[string]interface{}, error) {
|
||||
{{/required}}
|
||||
{{/isNullable}}
|
||||
{{/vars}}
|
||||
{{#isAdditionalPropertiesTrue}}
|
||||
{{#isAdditionalPropertiesEnabled}}
|
||||
|
||||
for key, value := range o.AdditionalProperties {
|
||||
toSerialize[key] = value
|
||||
}
|
||||
|
||||
{{/isAdditionalPropertiesTrue}}
|
||||
{{/isAdditionalPropertiesEnabled}}
|
||||
return toSerialize, nil
|
||||
}
|
||||
|
||||
{{#isAdditionalPropertiesTrue}}
|
||||
{{#isAdditionalPropertiesEnabled}}
|
||||
func (o *{{{classname}}}) UnmarshalJSON(bytes []byte) (err error) {
|
||||
{{#parent}}
|
||||
{{^isMap}}
|
||||
@ -440,7 +440,7 @@ func (o *{{{classname}}}) UnmarshalJSON(bytes []byte) (err error) {
|
||||
{{/parent}}
|
||||
}
|
||||
|
||||
{{/isAdditionalPropertiesTrue}}
|
||||
{{/isAdditionalPropertiesEnabled}}
|
||||
{{#isArray}}
|
||||
func (o *{{{classname}}}) UnmarshalJSON(bytes []byte) (err error) {
|
||||
return json.Unmarshal(bytes, &o.Items)
|
||||
|
@ -223,24 +223,24 @@ function ConvertFrom-{{{apiNamePrefix}}}JsonTo{{{classname}}} {
|
||||
$PSBoundParameters | Out-DebugParameter | Write-Debug
|
||||
|
||||
$JsonParameters = ConvertFrom-Json -InputObject $Json
|
||||
{{#isAdditionalPropertiesTrue}}
|
||||
{{#isAdditionalPropertiesEnabled}}
|
||||
${{{apiNamePrefix}}}{{{classname}}}AdditionalProperties = @{}
|
||||
{{/isAdditionalPropertiesTrue}}
|
||||
{{/isAdditionalPropertiesEnabled}}
|
||||
|
||||
# check if Json contains properties not defined in {{{apiNamePrefix}}}{{{classname}}}
|
||||
$AllProperties = ({{#allVars}}"{{{baseName}}}"{{^-last}}, {{/-last}}{{/allVars}})
|
||||
foreach ($name in $JsonParameters.PsObject.Properties.Name) {
|
||||
{{^isAdditionalPropertiesTrue}}
|
||||
{{^isAdditionalPropertiesEnabled}}
|
||||
if (!($AllProperties.Contains($name))) {
|
||||
throw "Error! JSON key '$name' not found in the properties: $($AllProperties)"
|
||||
}
|
||||
{{/isAdditionalPropertiesTrue}}
|
||||
{{#isAdditionalPropertiesTrue}}
|
||||
{{/isAdditionalPropertiesEnabled}}
|
||||
{{#isAdditionalPropertiesEnabled}}
|
||||
# store undefined properties in additionalProperties
|
||||
if (!($AllProperties.Contains($name))) {
|
||||
${{{apiNamePrefix}}}{{{classname}}}AdditionalProperties[$name] = $JsonParameters.PSobject.Properties[$name].value
|
||||
}
|
||||
{{/isAdditionalPropertiesTrue}}
|
||||
{{/isAdditionalPropertiesEnabled}}
|
||||
}
|
||||
|
||||
{{#requiredVars}}
|
||||
@ -271,9 +271,9 @@ function ConvertFrom-{{{apiNamePrefix}}}JsonTo{{{classname}}} {
|
||||
"<<baseName>>" = ${<<name>>}
|
||||
<</allVars>>
|
||||
<<={{ }}=>>
|
||||
{{#isAdditionalPropertiesTrue}}
|
||||
{{#isAdditionalPropertiesEnabled}}
|
||||
"AdditionalProperties" = ${{{apiNamePrefix}}}{{{classname}}}AdditionalProperties
|
||||
{{/isAdditionalPropertiesTrue}}
|
||||
{{/isAdditionalPropertiesEnabled}}
|
||||
}
|
||||
|
||||
return $PSO
|
||||
|
@ -22,9 +22,9 @@ class {{classname}}({{#parent}}{{{.}}}{{/parent}}{{^parent}}BaseModel{{/parent}}
|
||||
{{#vars}}
|
||||
{{name}}: {{{vendorExtensions.x-py-typing}}}
|
||||
{{/vars}}
|
||||
{{#isAdditionalPropertiesTrue}}
|
||||
{{#isAdditionalPropertiesEnabled}}
|
||||
additional_properties: Dict[str, Any] = {}
|
||||
{{/isAdditionalPropertiesTrue}}
|
||||
{{/isAdditionalPropertiesEnabled}}
|
||||
__properties = [{{#allVars}}"{{baseName}}"{{^-last}}, {{/-last}}{{/allVars}}]
|
||||
{{#vars}}
|
||||
{{#vendorExtensions.x-regex}}
|
||||
@ -130,9 +130,9 @@ class {{classname}}({{#parent}}{{{.}}}{{/parent}}{{^parent}}BaseModel{{/parent}}
|
||||
{{#vendorExtensions.x-py-readonly}}
|
||||
"{{{.}}}",
|
||||
{{/vendorExtensions.x-py-readonly}}
|
||||
{{#isAdditionalPropertiesTrue}}
|
||||
{{#isAdditionalPropertiesEnabled}}
|
||||
"additional_properties"
|
||||
{{/isAdditionalPropertiesTrue}}
|
||||
{{/isAdditionalPropertiesEnabled}}
|
||||
},
|
||||
exclude_none=True)
|
||||
{{#allVars}}
|
||||
@ -202,13 +202,13 @@ class {{classname}}({{#parent}}{{{.}}}{{/parent}}{{^parent}}BaseModel{{/parent}}
|
||||
{{/isPrimitiveType}}
|
||||
{{/isContainer}}
|
||||
{{/allVars}}
|
||||
{{#isAdditionalPropertiesTrue}}
|
||||
{{#isAdditionalPropertiesEnabled}}
|
||||
# puts key-value pairs in additional_properties in the top level
|
||||
if self.additional_properties is not None:
|
||||
for _key, _value in self.additional_properties.items():
|
||||
_dict[_key] = _value
|
||||
|
||||
{{/isAdditionalPropertiesTrue}}
|
||||
{{/isAdditionalPropertiesEnabled}}
|
||||
{{#allVars}}
|
||||
{{#isNullable}}
|
||||
# set to None if {{{name}}} (nullable) is None
|
||||
@ -244,13 +244,13 @@ class {{classname}}({{#parent}}{{{.}}}{{/parent}}{{^parent}}BaseModel{{/parent}}
|
||||
return {{{classname}}}.parse_obj(obj)
|
||||
|
||||
{{#disallowAdditionalPropertiesIfNotPresent}}
|
||||
{{^isAdditionalPropertiesTrue}}
|
||||
{{^isAdditionalPropertiesEnabled}}
|
||||
# raise errors for additional fields in the input
|
||||
for _key in obj.keys():
|
||||
if _key not in cls.__properties:
|
||||
raise ValueError("Error due to additional fields (not defined in {{classname}}) in the input: " + obj)
|
||||
|
||||
{{/isAdditionalPropertiesTrue}}
|
||||
{{/isAdditionalPropertiesEnabled}}
|
||||
{{/disallowAdditionalPropertiesIfNotPresent}}
|
||||
_obj = {{{classname}}}.parse_obj({
|
||||
{{#allVars}}
|
||||
@ -348,13 +348,13 @@ class {{classname}}({{#parent}}{{{.}}}{{/parent}}{{^parent}}BaseModel{{/parent}}
|
||||
{{/isContainer}}
|
||||
{{/allVars}}
|
||||
})
|
||||
{{#isAdditionalPropertiesTrue}}
|
||||
{{#isAdditionalPropertiesEnabled}}
|
||||
# store additional fields in additional_properties
|
||||
for _key in obj.keys():
|
||||
if _key not in cls.__properties:
|
||||
_obj.additional_properties[_key] = obj.get(_key)
|
||||
|
||||
{{/isAdditionalPropertiesTrue}}
|
||||
{{/isAdditionalPropertiesEnabled}}
|
||||
return _obj
|
||||
{{/hasChildren}}
|
||||
|
||||
@ -363,4 +363,4 @@ class {{classname}}({{#parent}}{{{.}}}{{/parent}}{{^parent}}BaseModel{{/parent}}
|
||||
{{{.}}}
|
||||
{{/vendorExtensions.x-py-postponed-model-imports}}
|
||||
{{classname}}.update_forward_refs()
|
||||
{{/vendorExtensions.x-py-postponed-model-imports.size}}
|
||||
{{/vendorExtensions.x-py-postponed-model-imports.size}}
|
||||
|
@ -10,10 +10,10 @@
|
||||
{{#vars}}
|
||||
#' @field {{name}} {{#lambdaRdocEscape}}{{{description}}}{{/lambdaRdocEscape}} {{{vendorExtensions.x-r-doc-type}}}{{^required}} [optional]{{/required}}
|
||||
{{/vars}}
|
||||
{{#isAdditionalPropertiesTrue}}
|
||||
{{#isAdditionalPropertiesEnabled}}
|
||||
#' @field _field_list a list of fields list(character)
|
||||
#' @field additional_properties additional properties list(character) [optional]
|
||||
{{/isAdditionalPropertiesTrue}}
|
||||
{{/isAdditionalPropertiesEnabled}}
|
||||
#' @importFrom R6 R6Class
|
||||
#' @importFrom jsonlite fromJSON toJSON
|
||||
#' @export
|
||||
@ -26,10 +26,10 @@
|
||||
{{#vars}}
|
||||
`{{{name}}}` = NULL,
|
||||
{{/vars}}
|
||||
{{#isAdditionalPropertiesTrue}}
|
||||
{{#isAdditionalPropertiesEnabled}}
|
||||
`_field_list` = c({{#vars}}"{{{name}}}"{{^-last}}, {{/-last}}{{/vars}}),
|
||||
`additional_properties` = list(),
|
||||
{{/isAdditionalPropertiesTrue}}
|
||||
{{/isAdditionalPropertiesEnabled}}
|
||||
{{#discriminator}}
|
||||
`_discriminator_property_name` = '{{discriminator.propertyName}}',
|
||||
{{#discriminator.mappedModels}}{{#-first}}`_discriminator_mapping_name` = c({{/-first}}'{{mappingName}}' = '{{modelName}}'{{^-last}}, {{/-last}}{{#-last}}),{{/-last}}{{/discriminator.mappedModels}}
|
||||
@ -45,12 +45,12 @@
|
||||
{{#optionalVars}}
|
||||
#' @param {{name}} {{#lambdaRdocEscape}}{{{description}}}{{/lambdaRdocEscape}}{{^description}}{{{name}}}{{/description}}{{#defaultValue}}. Default to {{{.}}}.{{/defaultValue}}
|
||||
{{/optionalVars}}
|
||||
{{#isAdditionalPropertiesTrue}}
|
||||
{{#isAdditionalPropertiesEnabled}}
|
||||
#' @param additional_properties additional properties (optional)
|
||||
{{/isAdditionalPropertiesTrue}}
|
||||
{{/isAdditionalPropertiesEnabled}}
|
||||
#' @param ... Other optional arguments.
|
||||
#' @export
|
||||
initialize = function({{#requiredVars}}`{{name}}`, {{/requiredVars}}{{#optionalVars}}`{{name}}` = {{{defaultValue}}}{{^defaultValue}}NULL{{/defaultValue}}, {{/optionalVars}}{{#isAdditionalPropertiesTrue}}additional_properties = NULL, {{/isAdditionalPropertiesTrue}}...) {
|
||||
initialize = function({{#requiredVars}}`{{name}}`, {{/requiredVars}}{{#optionalVars}}`{{name}}` = {{{defaultValue}}}{{^defaultValue}}NULL{{/defaultValue}}, {{/optionalVars}}{{#isAdditionalPropertiesEnabled}}additional_properties = NULL, {{/isAdditionalPropertiesEnabled}}...) {
|
||||
{{#requiredVars}}
|
||||
if (!missing(`{{name}}`)) {
|
||||
{{^isContainer}}
|
||||
@ -195,13 +195,13 @@
|
||||
self$`{{name}}` <- `{{name}}`
|
||||
}
|
||||
{{/optionalVars}}
|
||||
{{#isAdditionalPropertiesTrue}}
|
||||
{{#isAdditionalPropertiesEnabled}}
|
||||
if (!is.null(additional_properties)) {
|
||||
for (key in names(additional_properties)) {
|
||||
self$additional_properties[[key]] <- additional_properties[[key]]
|
||||
}
|
||||
}
|
||||
{{/isAdditionalPropertiesTrue}}
|
||||
{{/isAdditionalPropertiesEnabled}}
|
||||
},
|
||||
#' To JSON string
|
||||
#'
|
||||
@ -243,12 +243,12 @@
|
||||
{{/isContainer}}
|
||||
}
|
||||
{{/vars}}
|
||||
{{#isAdditionalPropertiesTrue}}
|
||||
{{#isAdditionalPropertiesEnabled}}
|
||||
for (key in names(self$additional_properties)) {
|
||||
{{classname}}Object[[key]] <- self$additional_properties[[key]]
|
||||
}
|
||||
|
||||
{{/isAdditionalPropertiesTrue}}
|
||||
{{/isAdditionalPropertiesEnabled}}
|
||||
{{classname}}Object
|
||||
},
|
||||
#' Deserialize JSON string into an instance of {{{classname}}}
|
||||
@ -296,7 +296,7 @@
|
||||
{{/isContainer}}
|
||||
}
|
||||
{{/vars}}
|
||||
{{#isAdditionalPropertiesTrue}}
|
||||
{{#isAdditionalPropertiesEnabled}}
|
||||
# process additional properties/fields in the payload
|
||||
for (key in names(this_object)) {
|
||||
if (!(key %in% self$`_field_list`)) { # json key not in list of fields
|
||||
@ -304,7 +304,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
{{/isAdditionalPropertiesTrue}}
|
||||
{{/isAdditionalPropertiesEnabled}}
|
||||
self
|
||||
},
|
||||
#' To JSON string
|
||||
@ -375,13 +375,13 @@
|
||||
)
|
||||
jsoncontent <- paste(jsoncontent, collapse = ",")
|
||||
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
|
||||
{{#isAdditionalPropertiesTrue}}
|
||||
{{#isAdditionalPropertiesEnabled}}
|
||||
json_obj <- jsonlite::fromJSON(json_string)
|
||||
for (key in names(self$additional_properties)) {
|
||||
json_obj[[key]] <- self$additional_properties[[key]]
|
||||
}
|
||||
json_string <- as.character(jsonlite::minify(jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA)))
|
||||
{{/isAdditionalPropertiesTrue}}
|
||||
{{/isAdditionalPropertiesEnabled}}
|
||||
},
|
||||
#' Deserialize JSON string into an instance of {{{classname}}}
|
||||
#'
|
||||
@ -425,7 +425,7 @@
|
||||
{{/isPrimitiveType}}
|
||||
{{/isContainer}}
|
||||
{{/vars}}
|
||||
{{#isAdditionalPropertiesTrue}}
|
||||
{{#isAdditionalPropertiesEnabled}}
|
||||
# process additional properties/fields in the payload
|
||||
for (key in names(this_object)) {
|
||||
if (!(key %in% self$`_field_list`)) { # json key not in list of fields
|
||||
@ -433,7 +433,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
{{/isAdditionalPropertiesTrue}}
|
||||
{{/isAdditionalPropertiesEnabled}}
|
||||
self
|
||||
},
|
||||
#' Validate JSON input with respect to {{classname}}
|
||||
|
@ -2246,3 +2246,16 @@ components:
|
||||
description: Property
|
||||
type: boolean
|
||||
default: false
|
||||
AdditionalPropertieObject:
|
||||
type: object
|
||||
properties:
|
||||
name:
|
||||
type: string
|
||||
additionalProperties:
|
||||
type: object
|
||||
AdditionalPropertieAnyType:
|
||||
type: object
|
||||
properties:
|
||||
name:
|
||||
type: string
|
||||
additionalProperties: {}
|
||||
|
@ -109,6 +109,7 @@ namespace Org.OpenAPITools.Model
|
||||
{
|
||||
this._flagObjectItemsNullable = true;
|
||||
}
|
||||
this.AdditionalProperties = new Dictionary<string, object>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -400,6 +401,12 @@ namespace Org.OpenAPITools.Model
|
||||
{
|
||||
return _flagObjectItemsNullable;
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets or Sets additional properties
|
||||
/// </summary>
|
||||
[JsonExtensionData]
|
||||
public IDictionary<string, object> AdditionalProperties { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns the string presentation of the object
|
||||
/// </summary>
|
||||
@ -421,6 +428,7 @@ namespace Org.OpenAPITools.Model
|
||||
sb.Append(" ObjectNullableProp: ").Append(ObjectNullableProp).Append("\n");
|
||||
sb.Append(" ObjectAndItemsNullableProp: ").Append(ObjectAndItemsNullableProp).Append("\n");
|
||||
sb.Append(" ObjectItemsNullable: ").Append(ObjectItemsNullable).Append("\n");
|
||||
sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n");
|
||||
sb.Append("}\n");
|
||||
return sb.ToString();
|
||||
}
|
||||
@ -511,6 +519,10 @@ namespace Org.OpenAPITools.Model
|
||||
{
|
||||
hashCode = (hashCode * 59) + this.ObjectItemsNullable.GetHashCode();
|
||||
}
|
||||
if (this.AdditionalProperties != null)
|
||||
{
|
||||
hashCode = (hashCode * 59) + this.AdditionalProperties.GetHashCode();
|
||||
}
|
||||
return hashCode;
|
||||
}
|
||||
}
|
||||
|
@ -137,6 +137,12 @@ namespace Org.OpenAPITools.Model
|
||||
[JsonPropertyName("string_prop")]
|
||||
public string? StringProp { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets additional properties
|
||||
/// </summary>
|
||||
[JsonExtensionData]
|
||||
public Dictionary<string, JsonElement> AdditionalProperties { get; } = new Dictionary<string, JsonElement>();
|
||||
|
||||
/// <summary>
|
||||
/// Returns the string presentation of the object
|
||||
/// </summary>
|
||||
@ -158,6 +164,7 @@ namespace Org.OpenAPITools.Model
|
||||
sb.Append(" ObjectAndItemsNullableProp: ").Append(ObjectAndItemsNullableProp).Append("\n");
|
||||
sb.Append(" ObjectNullableProp: ").Append(ObjectNullableProp).Append("\n");
|
||||
sb.Append(" StringProp: ").Append(StringProp).Append("\n");
|
||||
sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n");
|
||||
sb.Append("}\n");
|
||||
return sb.ToString();
|
||||
}
|
||||
|
@ -135,6 +135,12 @@ namespace Org.OpenAPITools.Model
|
||||
[JsonPropertyName("string_prop")]
|
||||
public string StringProp { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets additional properties
|
||||
/// </summary>
|
||||
[JsonExtensionData]
|
||||
public Dictionary<string, JsonElement> AdditionalProperties { get; } = new Dictionary<string, JsonElement>();
|
||||
|
||||
/// <summary>
|
||||
/// Returns the string presentation of the object
|
||||
/// </summary>
|
||||
@ -156,6 +162,7 @@ namespace Org.OpenAPITools.Model
|
||||
sb.Append(" ObjectAndItemsNullableProp: ").Append(ObjectAndItemsNullableProp).Append("\n");
|
||||
sb.Append(" ObjectNullableProp: ").Append(ObjectNullableProp).Append("\n");
|
||||
sb.Append(" StringProp: ").Append(StringProp).Append("\n");
|
||||
sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n");
|
||||
sb.Append("}\n");
|
||||
return sb.ToString();
|
||||
}
|
||||
|
@ -135,6 +135,12 @@ namespace Org.OpenAPITools.Model
|
||||
[JsonPropertyName("string_prop")]
|
||||
public string StringProp { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets additional properties
|
||||
/// </summary>
|
||||
[JsonExtensionData]
|
||||
public Dictionary<string, JsonElement> AdditionalProperties { get; } = new Dictionary<string, JsonElement>();
|
||||
|
||||
/// <summary>
|
||||
/// Returns the string presentation of the object
|
||||
/// </summary>
|
||||
@ -156,6 +162,7 @@ namespace Org.OpenAPITools.Model
|
||||
sb.Append(" ObjectAndItemsNullableProp: ").Append(ObjectAndItemsNullableProp).Append("\n");
|
||||
sb.Append(" ObjectNullableProp: ").Append(ObjectNullableProp).Append("\n");
|
||||
sb.Append(" StringProp: ").Append(StringProp).Append("\n");
|
||||
sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n");
|
||||
sb.Append("}\n");
|
||||
return sb.ToString();
|
||||
}
|
||||
|
@ -62,6 +62,7 @@ namespace Org.OpenAPITools.Model
|
||||
this.ObjectNullableProp = objectNullableProp;
|
||||
this.ObjectAndItemsNullableProp = objectAndItemsNullableProp;
|
||||
this.ObjectItemsNullable = objectItemsNullable;
|
||||
this.AdditionalProperties = new Dictionary<string, object>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -137,6 +138,12 @@ namespace Org.OpenAPITools.Model
|
||||
[DataMember(Name = "object_items_nullable", EmitDefaultValue = false)]
|
||||
public Dictionary<string, Object> ObjectItemsNullable { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets additional properties
|
||||
/// </summary>
|
||||
[JsonExtensionData]
|
||||
public IDictionary<string, object> AdditionalProperties { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns the string presentation of the object
|
||||
/// </summary>
|
||||
@ -158,6 +165,7 @@ namespace Org.OpenAPITools.Model
|
||||
sb.Append(" ObjectNullableProp: ").Append(ObjectNullableProp).Append("\n");
|
||||
sb.Append(" ObjectAndItemsNullableProp: ").Append(ObjectAndItemsNullableProp).Append("\n");
|
||||
sb.Append(" ObjectItemsNullable: ").Append(ObjectItemsNullable).Append("\n");
|
||||
sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n");
|
||||
sb.Append("}\n");
|
||||
return sb.ToString();
|
||||
}
|
||||
@ -248,6 +256,10 @@ namespace Org.OpenAPITools.Model
|
||||
{
|
||||
hashCode = (hashCode * 59) + this.ObjectItemsNullable.GetHashCode();
|
||||
}
|
||||
if (this.AdditionalProperties != null)
|
||||
{
|
||||
hashCode = (hashCode * 59) + this.AdditionalProperties.GetHashCode();
|
||||
}
|
||||
return hashCode;
|
||||
}
|
||||
}
|
||||
|
@ -61,6 +61,7 @@ namespace Org.OpenAPITools.Model
|
||||
this.ObjectNullableProp = objectNullableProp;
|
||||
this.ObjectAndItemsNullableProp = objectAndItemsNullableProp;
|
||||
this.ObjectItemsNullable = objectItemsNullable;
|
||||
this.AdditionalProperties = new Dictionary<string, object>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -136,6 +137,12 @@ namespace Org.OpenAPITools.Model
|
||||
[DataMember(Name = "object_items_nullable", EmitDefaultValue = false)]
|
||||
public Dictionary<string, Object> ObjectItemsNullable { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets additional properties
|
||||
/// </summary>
|
||||
[JsonExtensionData]
|
||||
public IDictionary<string, object> AdditionalProperties { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns the string presentation of the object
|
||||
/// </summary>
|
||||
@ -157,6 +164,7 @@ namespace Org.OpenAPITools.Model
|
||||
sb.Append(" ObjectNullableProp: ").Append(ObjectNullableProp).Append("\n");
|
||||
sb.Append(" ObjectAndItemsNullableProp: ").Append(ObjectAndItemsNullableProp).Append("\n");
|
||||
sb.Append(" ObjectItemsNullable: ").Append(ObjectItemsNullable).Append("\n");
|
||||
sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n");
|
||||
sb.Append("}\n");
|
||||
return sb.ToString();
|
||||
}
|
||||
@ -247,6 +255,10 @@ namespace Org.OpenAPITools.Model
|
||||
{
|
||||
hashCode = (hashCode * 59) + this.ObjectItemsNullable.GetHashCode();
|
||||
}
|
||||
if (this.AdditionalProperties != null)
|
||||
{
|
||||
hashCode = (hashCode * 59) + this.AdditionalProperties.GetHashCode();
|
||||
}
|
||||
return hashCode;
|
||||
}
|
||||
}
|
||||
|
@ -61,6 +61,7 @@ namespace Org.OpenAPITools.Model
|
||||
this.ObjectNullableProp = objectNullableProp;
|
||||
this.ObjectAndItemsNullableProp = objectAndItemsNullableProp;
|
||||
this.ObjectItemsNullable = objectItemsNullable;
|
||||
this.AdditionalProperties = new Dictionary<string, object>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -136,6 +137,12 @@ namespace Org.OpenAPITools.Model
|
||||
[DataMember(Name = "object_items_nullable", EmitDefaultValue = false)]
|
||||
public Dictionary<string, Object> ObjectItemsNullable { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets additional properties
|
||||
/// </summary>
|
||||
[JsonExtensionData]
|
||||
public IDictionary<string, object> AdditionalProperties { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns the string presentation of the object
|
||||
/// </summary>
|
||||
@ -157,6 +164,7 @@ namespace Org.OpenAPITools.Model
|
||||
sb.Append(" ObjectNullableProp: ").Append(ObjectNullableProp).Append("\n");
|
||||
sb.Append(" ObjectAndItemsNullableProp: ").Append(ObjectAndItemsNullableProp).Append("\n");
|
||||
sb.Append(" ObjectItemsNullable: ").Append(ObjectItemsNullable).Append("\n");
|
||||
sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n");
|
||||
sb.Append("}\n");
|
||||
return sb.ToString();
|
||||
}
|
||||
@ -247,6 +255,10 @@ namespace Org.OpenAPITools.Model
|
||||
{
|
||||
hashCode = (hashCode * 59) + this.ObjectItemsNullable.GetHashCode();
|
||||
}
|
||||
if (this.AdditionalProperties != null)
|
||||
{
|
||||
hashCode = (hashCode * 59) + this.AdditionalProperties.GetHashCode();
|
||||
}
|
||||
return hashCode;
|
||||
}
|
||||
}
|
||||
|
@ -61,6 +61,7 @@ namespace Org.OpenAPITools.Model
|
||||
this.ObjectNullableProp = objectNullableProp;
|
||||
this.ObjectAndItemsNullableProp = objectAndItemsNullableProp;
|
||||
this.ObjectItemsNullable = objectItemsNullable;
|
||||
this.AdditionalProperties = new Dictionary<string, object>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -136,6 +137,12 @@ namespace Org.OpenAPITools.Model
|
||||
[DataMember(Name = "object_items_nullable", EmitDefaultValue = false)]
|
||||
public Dictionary<string, Object> ObjectItemsNullable { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets additional properties
|
||||
/// </summary>
|
||||
[JsonExtensionData]
|
||||
public IDictionary<string, object> AdditionalProperties { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns the string presentation of the object
|
||||
/// </summary>
|
||||
@ -157,6 +164,7 @@ namespace Org.OpenAPITools.Model
|
||||
sb.Append(" ObjectNullableProp: ").Append(ObjectNullableProp).Append("\n");
|
||||
sb.Append(" ObjectAndItemsNullableProp: ").Append(ObjectAndItemsNullableProp).Append("\n");
|
||||
sb.Append(" ObjectItemsNullable: ").Append(ObjectItemsNullable).Append("\n");
|
||||
sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n");
|
||||
sb.Append("}\n");
|
||||
return sb.ToString();
|
||||
}
|
||||
@ -247,6 +255,10 @@ namespace Org.OpenAPITools.Model
|
||||
{
|
||||
hashCode = (hashCode * 59) + this.ObjectItemsNullable.GetHashCode();
|
||||
}
|
||||
if (this.AdditionalProperties != null)
|
||||
{
|
||||
hashCode = (hashCode * 59) + this.AdditionalProperties.GetHashCode();
|
||||
}
|
||||
return hashCode;
|
||||
}
|
||||
}
|
||||
|
@ -59,6 +59,7 @@ namespace Org.OpenAPITools.Model
|
||||
this.ObjectNullableProp = objectNullableProp;
|
||||
this.ObjectAndItemsNullableProp = objectAndItemsNullableProp;
|
||||
this.ObjectItemsNullable = objectItemsNullable;
|
||||
this.AdditionalProperties = new Dictionary<string, object>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -134,6 +135,12 @@ namespace Org.OpenAPITools.Model
|
||||
[DataMember(Name = "object_items_nullable", EmitDefaultValue = false)]
|
||||
public Dictionary<string, Object> ObjectItemsNullable { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets additional properties
|
||||
/// </summary>
|
||||
[JsonExtensionData]
|
||||
public IDictionary<string, object> AdditionalProperties { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns the string presentation of the object
|
||||
/// </summary>
|
||||
@ -155,6 +162,7 @@ namespace Org.OpenAPITools.Model
|
||||
sb.Append(" ObjectNullableProp: ").Append(ObjectNullableProp).Append("\n");
|
||||
sb.Append(" ObjectAndItemsNullableProp: ").Append(ObjectAndItemsNullableProp).Append("\n");
|
||||
sb.Append(" ObjectItemsNullable: ").Append(ObjectItemsNullable).Append("\n");
|
||||
sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n");
|
||||
sb.Append("}\n");
|
||||
return sb.ToString();
|
||||
}
|
||||
@ -255,7 +263,8 @@ namespace Org.OpenAPITools.Model
|
||||
this.ObjectItemsNullable != null &&
|
||||
input.ObjectItemsNullable != null &&
|
||||
this.ObjectItemsNullable.SequenceEqual(input.ObjectItemsNullable)
|
||||
);
|
||||
)
|
||||
&& (this.AdditionalProperties.Count == input.AdditionalProperties.Count && !this.AdditionalProperties.Except(input.AdditionalProperties).Any());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -315,6 +324,10 @@ namespace Org.OpenAPITools.Model
|
||||
{
|
||||
hashCode = (hashCode * 59) + this.ObjectItemsNullable.GetHashCode();
|
||||
}
|
||||
if (this.AdditionalProperties != null)
|
||||
{
|
||||
hashCode = (hashCode * 59) + this.AdditionalProperties.GetHashCode();
|
||||
}
|
||||
return hashCode;
|
||||
}
|
||||
}
|
||||
|
@ -61,6 +61,7 @@ namespace Org.OpenAPITools.Model
|
||||
this.ObjectNullableProp = objectNullableProp;
|
||||
this.ObjectAndItemsNullableProp = objectAndItemsNullableProp;
|
||||
this.ObjectItemsNullable = objectItemsNullable;
|
||||
this.AdditionalProperties = new Dictionary<string, object>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -136,6 +137,12 @@ namespace Org.OpenAPITools.Model
|
||||
[DataMember(Name = "object_items_nullable", EmitDefaultValue = false)]
|
||||
public Dictionary<string, Object> ObjectItemsNullable { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets additional properties
|
||||
/// </summary>
|
||||
[JsonExtensionData]
|
||||
public IDictionary<string, object> AdditionalProperties { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns the string presentation of the object
|
||||
/// </summary>
|
||||
@ -157,6 +164,7 @@ namespace Org.OpenAPITools.Model
|
||||
sb.Append(" ObjectNullableProp: ").Append(ObjectNullableProp).Append("\n");
|
||||
sb.Append(" ObjectAndItemsNullableProp: ").Append(ObjectAndItemsNullableProp).Append("\n");
|
||||
sb.Append(" ObjectItemsNullable: ").Append(ObjectItemsNullable).Append("\n");
|
||||
sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n");
|
||||
sb.Append("}\n");
|
||||
return sb.ToString();
|
||||
}
|
||||
@ -247,6 +255,10 @@ namespace Org.OpenAPITools.Model
|
||||
{
|
||||
hashCode = (hashCode * 59) + this.ObjectItemsNullable.GetHashCode();
|
||||
}
|
||||
if (this.AdditionalProperties != null)
|
||||
{
|
||||
hashCode = (hashCode * 59) + this.AdditionalProperties.GetHashCode();
|
||||
}
|
||||
return hashCode;
|
||||
}
|
||||
}
|
||||
|
@ -61,6 +61,7 @@ namespace Org.OpenAPITools.Model
|
||||
this.ObjectNullableProp = objectNullableProp;
|
||||
this.ObjectAndItemsNullableProp = objectAndItemsNullableProp;
|
||||
this.ObjectItemsNullable = objectItemsNullable;
|
||||
this.AdditionalProperties = new Dictionary<string, object>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -136,6 +137,12 @@ namespace Org.OpenAPITools.Model
|
||||
[DataMember(Name = "object_items_nullable", EmitDefaultValue = false)]
|
||||
public Dictionary<string, Object> ObjectItemsNullable { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets additional properties
|
||||
/// </summary>
|
||||
[JsonExtensionData]
|
||||
public IDictionary<string, object> AdditionalProperties { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns the string presentation of the object
|
||||
/// </summary>
|
||||
@ -157,6 +164,7 @@ namespace Org.OpenAPITools.Model
|
||||
sb.Append(" ObjectNullableProp: ").Append(ObjectNullableProp).Append("\n");
|
||||
sb.Append(" ObjectAndItemsNullableProp: ").Append(ObjectAndItemsNullableProp).Append("\n");
|
||||
sb.Append(" ObjectItemsNullable: ").Append(ObjectItemsNullable).Append("\n");
|
||||
sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n");
|
||||
sb.Append("}\n");
|
||||
return sb.ToString();
|
||||
}
|
||||
@ -247,6 +255,10 @@ namespace Org.OpenAPITools.Model
|
||||
{
|
||||
hashCode = (hashCode * 59) + this.ObjectItemsNullable.GetHashCode();
|
||||
}
|
||||
if (this.AdditionalProperties != null)
|
||||
{
|
||||
hashCode = (hashCode * 59) + this.AdditionalProperties.GetHashCode();
|
||||
}
|
||||
return hashCode;
|
||||
}
|
||||
}
|
||||
|
@ -20,8 +20,11 @@ var _ MappedNullable = &AdditionalPropertiesAnyType{}
|
||||
// AdditionalPropertiesAnyType struct for AdditionalPropertiesAnyType
|
||||
type AdditionalPropertiesAnyType struct {
|
||||
Name *string `json:"name,omitempty"`
|
||||
AdditionalProperties map[string]interface{}
|
||||
}
|
||||
|
||||
type _AdditionalPropertiesAnyType AdditionalPropertiesAnyType
|
||||
|
||||
// NewAdditionalPropertiesAnyType instantiates a new AdditionalPropertiesAnyType object
|
||||
// This constructor will assign default values to properties that have it defined,
|
||||
// and makes sure properties required by API are set, but the set of arguments
|
||||
@ -84,9 +87,31 @@ func (o AdditionalPropertiesAnyType) ToMap() (map[string]interface{}, error) {
|
||||
if !IsNil(o.Name) {
|
||||
toSerialize["name"] = o.Name
|
||||
}
|
||||
|
||||
for key, value := range o.AdditionalProperties {
|
||||
toSerialize[key] = value
|
||||
}
|
||||
|
||||
return toSerialize, nil
|
||||
}
|
||||
|
||||
func (o *AdditionalPropertiesAnyType) UnmarshalJSON(bytes []byte) (err error) {
|
||||
varAdditionalPropertiesAnyType := _AdditionalPropertiesAnyType{}
|
||||
|
||||
if err = json.Unmarshal(bytes, &varAdditionalPropertiesAnyType); err == nil {
|
||||
*o = AdditionalPropertiesAnyType(varAdditionalPropertiesAnyType)
|
||||
}
|
||||
|
||||
additionalProperties := make(map[string]interface{})
|
||||
|
||||
if err = json.Unmarshal(bytes, &additionalProperties); err == nil {
|
||||
delete(additionalProperties, "name")
|
||||
o.AdditionalProperties = additionalProperties
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
type NullableAdditionalPropertiesAnyType struct {
|
||||
value *AdditionalPropertiesAnyType
|
||||
isSet bool
|
||||
|
@ -20,8 +20,11 @@ var _ MappedNullable = &AdditionalPropertiesObject{}
|
||||
// AdditionalPropertiesObject struct for AdditionalPropertiesObject
|
||||
type AdditionalPropertiesObject struct {
|
||||
Name *string `json:"name,omitempty"`
|
||||
AdditionalProperties map[string]interface{}
|
||||
}
|
||||
|
||||
type _AdditionalPropertiesObject AdditionalPropertiesObject
|
||||
|
||||
// NewAdditionalPropertiesObject instantiates a new AdditionalPropertiesObject object
|
||||
// This constructor will assign default values to properties that have it defined,
|
||||
// and makes sure properties required by API are set, but the set of arguments
|
||||
@ -84,9 +87,31 @@ func (o AdditionalPropertiesObject) ToMap() (map[string]interface{}, error) {
|
||||
if !IsNil(o.Name) {
|
||||
toSerialize["name"] = o.Name
|
||||
}
|
||||
|
||||
for key, value := range o.AdditionalProperties {
|
||||
toSerialize[key] = value
|
||||
}
|
||||
|
||||
return toSerialize, nil
|
||||
}
|
||||
|
||||
func (o *AdditionalPropertiesObject) UnmarshalJSON(bytes []byte) (err error) {
|
||||
varAdditionalPropertiesObject := _AdditionalPropertiesObject{}
|
||||
|
||||
if err = json.Unmarshal(bytes, &varAdditionalPropertiesObject); err == nil {
|
||||
*o = AdditionalPropertiesObject(varAdditionalPropertiesObject)
|
||||
}
|
||||
|
||||
additionalProperties := make(map[string]interface{})
|
||||
|
||||
if err = json.Unmarshal(bytes, &additionalProperties); err == nil {
|
||||
delete(additionalProperties, "name")
|
||||
o.AdditionalProperties = additionalProperties
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
type NullableAdditionalPropertiesObject struct {
|
||||
value *AdditionalPropertiesObject
|
||||
isSet bool
|
||||
|
@ -79,6 +79,50 @@ public class AdditionalPropertiesAnyType {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* A container for additional, undeclared properties.
|
||||
* This is a holder for any undeclared properties as specified with
|
||||
* the 'additionalProperties' keyword in the OAS document.
|
||||
*/
|
||||
private Map<String, Object> additionalProperties;
|
||||
|
||||
/**
|
||||
* Set the additional (undeclared) property with the specified name and value.
|
||||
* If the property does not already exist, create it otherwise replace it.
|
||||
*
|
||||
* @param key name of the property
|
||||
* @param value value of the property
|
||||
* @return the AdditionalPropertiesAnyType instance itself
|
||||
*/
|
||||
public AdditionalPropertiesAnyType putAdditionalProperty(String key, Object value) {
|
||||
if (this.additionalProperties == null) {
|
||||
this.additionalProperties = new HashMap<String, Object>();
|
||||
}
|
||||
this.additionalProperties.put(key, value);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the additional (undeclared) property.
|
||||
*
|
||||
* @return a map of objects
|
||||
*/
|
||||
public Map<String, Object> getAdditionalProperties() {
|
||||
return additionalProperties;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the additional (undeclared) property with the specified name.
|
||||
*
|
||||
* @param key name of the property
|
||||
* @return an object
|
||||
*/
|
||||
public Object getAdditionalProperty(String key) {
|
||||
if (this.additionalProperties == null) {
|
||||
return null;
|
||||
}
|
||||
return this.additionalProperties.get(key);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@ -90,12 +134,13 @@ public class AdditionalPropertiesAnyType {
|
||||
return false;
|
||||
}
|
||||
AdditionalPropertiesAnyType additionalPropertiesAnyType = (AdditionalPropertiesAnyType) o;
|
||||
return Objects.equals(this.name, additionalPropertiesAnyType.name);
|
||||
return Objects.equals(this.name, additionalPropertiesAnyType.name)&&
|
||||
Objects.equals(this.additionalProperties, additionalPropertiesAnyType.additionalProperties);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(name);
|
||||
return Objects.hash(name, additionalProperties);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -103,6 +148,7 @@ public class AdditionalPropertiesAnyType {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class AdditionalPropertiesAnyType {\n");
|
||||
sb.append(" name: ").append(toIndentedString(name)).append("\n");
|
||||
sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n");
|
||||
sb.append("}");
|
||||
return sb.toString();
|
||||
}
|
||||
@ -143,14 +189,6 @@ public class AdditionalPropertiesAnyType {
|
||||
throw new IllegalArgumentException(String.format("The required field(s) %s in AdditionalPropertiesAnyType is not found in the empty JSON string", AdditionalPropertiesAnyType.openapiRequiredFields.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
Set<Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet();
|
||||
// check to see if the JSON string contains additional fields
|
||||
for (Entry<String, JsonElement> entry : entries) {
|
||||
if (!AdditionalPropertiesAnyType.openapiFields.contains(entry.getKey())) {
|
||||
throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AdditionalPropertiesAnyType` properties. JSON: %s", entry.getKey(), jsonElement.toString()));
|
||||
}
|
||||
}
|
||||
JsonObject jsonObj = jsonElement.getAsJsonObject();
|
||||
if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) {
|
||||
throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString()));
|
||||
@ -172,6 +210,23 @@ public class AdditionalPropertiesAnyType {
|
||||
@Override
|
||||
public void write(JsonWriter out, AdditionalPropertiesAnyType value) throws IOException {
|
||||
JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject();
|
||||
obj.remove("additionalProperties");
|
||||
// serialize additional properties
|
||||
if (value.getAdditionalProperties() != null) {
|
||||
for (Map.Entry<String, Object> entry : value.getAdditionalProperties().entrySet()) {
|
||||
if (entry.getValue() instanceof String)
|
||||
obj.addProperty(entry.getKey(), (String) entry.getValue());
|
||||
else if (entry.getValue() instanceof Number)
|
||||
obj.addProperty(entry.getKey(), (Number) entry.getValue());
|
||||
else if (entry.getValue() instanceof Boolean)
|
||||
obj.addProperty(entry.getKey(), (Boolean) entry.getValue());
|
||||
else if (entry.getValue() instanceof Character)
|
||||
obj.addProperty(entry.getKey(), (Character) entry.getValue());
|
||||
else {
|
||||
obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject());
|
||||
}
|
||||
}
|
||||
}
|
||||
elementAdapter.write(out, obj);
|
||||
}
|
||||
|
||||
@ -179,7 +234,28 @@ public class AdditionalPropertiesAnyType {
|
||||
public AdditionalPropertiesAnyType read(JsonReader in) throws IOException {
|
||||
JsonElement jsonElement = elementAdapter.read(in);
|
||||
validateJsonElement(jsonElement);
|
||||
return thisAdapter.fromJsonTree(jsonElement);
|
||||
JsonObject jsonObj = jsonElement.getAsJsonObject();
|
||||
// store additional fields in the deserialized instance
|
||||
AdditionalPropertiesAnyType instance = thisAdapter.fromJsonTree(jsonObj);
|
||||
for (Map.Entry<String, JsonElement> entry : jsonObj.entrySet()) {
|
||||
if (!openapiFields.contains(entry.getKey())) {
|
||||
if (entry.getValue().isJsonPrimitive()) { // primitive type
|
||||
if (entry.getValue().getAsJsonPrimitive().isString())
|
||||
instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString());
|
||||
else if (entry.getValue().getAsJsonPrimitive().isNumber())
|
||||
instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber());
|
||||
else if (entry.getValue().getAsJsonPrimitive().isBoolean())
|
||||
instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean());
|
||||
else
|
||||
throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString()));
|
||||
} else if (entry.getValue().isJsonArray()) {
|
||||
instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class));
|
||||
} else { // JSON object
|
||||
instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class));
|
||||
}
|
||||
}
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
}.nullSafe();
|
||||
|
@ -80,6 +80,50 @@ public class AdditionalPropertiesObject {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* A container for additional, undeclared properties.
|
||||
* This is a holder for any undeclared properties as specified with
|
||||
* the 'additionalProperties' keyword in the OAS document.
|
||||
*/
|
||||
private Map<String, Object> additionalProperties;
|
||||
|
||||
/**
|
||||
* Set the additional (undeclared) property with the specified name and value.
|
||||
* If the property does not already exist, create it otherwise replace it.
|
||||
*
|
||||
* @param key name of the property
|
||||
* @param value value of the property
|
||||
* @return the AdditionalPropertiesObject instance itself
|
||||
*/
|
||||
public AdditionalPropertiesObject putAdditionalProperty(String key, Object value) {
|
||||
if (this.additionalProperties == null) {
|
||||
this.additionalProperties = new HashMap<String, Object>();
|
||||
}
|
||||
this.additionalProperties.put(key, value);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the additional (undeclared) property.
|
||||
*
|
||||
* @return a map of objects
|
||||
*/
|
||||
public Map<String, Object> getAdditionalProperties() {
|
||||
return additionalProperties;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the additional (undeclared) property with the specified name.
|
||||
*
|
||||
* @param key name of the property
|
||||
* @return an object
|
||||
*/
|
||||
public Object getAdditionalProperty(String key) {
|
||||
if (this.additionalProperties == null) {
|
||||
return null;
|
||||
}
|
||||
return this.additionalProperties.get(key);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@ -91,12 +135,13 @@ public class AdditionalPropertiesObject {
|
||||
return false;
|
||||
}
|
||||
AdditionalPropertiesObject additionalPropertiesObject = (AdditionalPropertiesObject) o;
|
||||
return Objects.equals(this.name, additionalPropertiesObject.name);
|
||||
return Objects.equals(this.name, additionalPropertiesObject.name)&&
|
||||
Objects.equals(this.additionalProperties, additionalPropertiesObject.additionalProperties);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(name);
|
||||
return Objects.hash(name, additionalProperties);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -104,6 +149,7 @@ public class AdditionalPropertiesObject {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class AdditionalPropertiesObject {\n");
|
||||
sb.append(" name: ").append(toIndentedString(name)).append("\n");
|
||||
sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n");
|
||||
sb.append("}");
|
||||
return sb.toString();
|
||||
}
|
||||
@ -144,14 +190,6 @@ public class AdditionalPropertiesObject {
|
||||
throw new IllegalArgumentException(String.format("The required field(s) %s in AdditionalPropertiesObject is not found in the empty JSON string", AdditionalPropertiesObject.openapiRequiredFields.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
Set<Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet();
|
||||
// check to see if the JSON string contains additional fields
|
||||
for (Entry<String, JsonElement> entry : entries) {
|
||||
if (!AdditionalPropertiesObject.openapiFields.contains(entry.getKey())) {
|
||||
throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AdditionalPropertiesObject` properties. JSON: %s", entry.getKey(), jsonElement.toString()));
|
||||
}
|
||||
}
|
||||
JsonObject jsonObj = jsonElement.getAsJsonObject();
|
||||
if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) {
|
||||
throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString()));
|
||||
@ -173,6 +211,23 @@ public class AdditionalPropertiesObject {
|
||||
@Override
|
||||
public void write(JsonWriter out, AdditionalPropertiesObject value) throws IOException {
|
||||
JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject();
|
||||
obj.remove("additionalProperties");
|
||||
// serialize additional properties
|
||||
if (value.getAdditionalProperties() != null) {
|
||||
for (Map.Entry<String, Object> entry : value.getAdditionalProperties().entrySet()) {
|
||||
if (entry.getValue() instanceof String)
|
||||
obj.addProperty(entry.getKey(), (String) entry.getValue());
|
||||
else if (entry.getValue() instanceof Number)
|
||||
obj.addProperty(entry.getKey(), (Number) entry.getValue());
|
||||
else if (entry.getValue() instanceof Boolean)
|
||||
obj.addProperty(entry.getKey(), (Boolean) entry.getValue());
|
||||
else if (entry.getValue() instanceof Character)
|
||||
obj.addProperty(entry.getKey(), (Character) entry.getValue());
|
||||
else {
|
||||
obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject());
|
||||
}
|
||||
}
|
||||
}
|
||||
elementAdapter.write(out, obj);
|
||||
}
|
||||
|
||||
@ -180,7 +235,28 @@ public class AdditionalPropertiesObject {
|
||||
public AdditionalPropertiesObject read(JsonReader in) throws IOException {
|
||||
JsonElement jsonElement = elementAdapter.read(in);
|
||||
validateJsonElement(jsonElement);
|
||||
return thisAdapter.fromJsonTree(jsonElement);
|
||||
JsonObject jsonObj = jsonElement.getAsJsonObject();
|
||||
// store additional fields in the deserialized instance
|
||||
AdditionalPropertiesObject instance = thisAdapter.fromJsonTree(jsonObj);
|
||||
for (Map.Entry<String, JsonElement> entry : jsonObj.entrySet()) {
|
||||
if (!openapiFields.contains(entry.getKey())) {
|
||||
if (entry.getValue().isJsonPrimitive()) { // primitive type
|
||||
if (entry.getValue().getAsJsonPrimitive().isString())
|
||||
instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString());
|
||||
else if (entry.getValue().getAsJsonPrimitive().isNumber())
|
||||
instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber());
|
||||
else if (entry.getValue().getAsJsonPrimitive().isBoolean())
|
||||
instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean());
|
||||
else
|
||||
throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString()));
|
||||
} else if (entry.getValue().isJsonArray()) {
|
||||
instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class));
|
||||
} else { // JSON object
|
||||
instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class));
|
||||
}
|
||||
}
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
}.nullSafe();
|
||||
|
@ -81,6 +81,50 @@ public class AdditionalPropertiesAnyType implements Parcelable {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* A container for additional, undeclared properties.
|
||||
* This is a holder for any undeclared properties as specified with
|
||||
* the 'additionalProperties' keyword in the OAS document.
|
||||
*/
|
||||
private Map<String, Object> additionalProperties;
|
||||
|
||||
/**
|
||||
* Set the additional (undeclared) property with the specified name and value.
|
||||
* If the property does not already exist, create it otherwise replace it.
|
||||
*
|
||||
* @param key name of the property
|
||||
* @param value value of the property
|
||||
* @return the AdditionalPropertiesAnyType instance itself
|
||||
*/
|
||||
public AdditionalPropertiesAnyType putAdditionalProperty(String key, Object value) {
|
||||
if (this.additionalProperties == null) {
|
||||
this.additionalProperties = new HashMap<String, Object>();
|
||||
}
|
||||
this.additionalProperties.put(key, value);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the additional (undeclared) property.
|
||||
*
|
||||
* @return a map of objects
|
||||
*/
|
||||
public Map<String, Object> getAdditionalProperties() {
|
||||
return additionalProperties;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the additional (undeclared) property with the specified name.
|
||||
*
|
||||
* @param key name of the property
|
||||
* @return an object
|
||||
*/
|
||||
public Object getAdditionalProperty(String key) {
|
||||
if (this.additionalProperties == null) {
|
||||
return null;
|
||||
}
|
||||
return this.additionalProperties.get(key);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@ -92,12 +136,13 @@ public class AdditionalPropertiesAnyType implements Parcelable {
|
||||
return false;
|
||||
}
|
||||
AdditionalPropertiesAnyType additionalPropertiesAnyType = (AdditionalPropertiesAnyType) o;
|
||||
return Objects.equals(this.name, additionalPropertiesAnyType.name);
|
||||
return Objects.equals(this.name, additionalPropertiesAnyType.name)&&
|
||||
Objects.equals(this.additionalProperties, additionalPropertiesAnyType.additionalProperties);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(name);
|
||||
return Objects.hash(name, additionalProperties);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -105,6 +150,7 @@ public class AdditionalPropertiesAnyType implements Parcelable {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class AdditionalPropertiesAnyType {\n");
|
||||
sb.append(" name: ").append(toIndentedString(name)).append("\n");
|
||||
sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n");
|
||||
sb.append("}");
|
||||
return sb.toString();
|
||||
}
|
||||
@ -166,14 +212,6 @@ public class AdditionalPropertiesAnyType implements Parcelable {
|
||||
throw new IllegalArgumentException(String.format("The required field(s) %s in AdditionalPropertiesAnyType is not found in the empty JSON string", AdditionalPropertiesAnyType.openapiRequiredFields.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
Set<Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet();
|
||||
// check to see if the JSON string contains additional fields
|
||||
for (Entry<String, JsonElement> entry : entries) {
|
||||
if (!AdditionalPropertiesAnyType.openapiFields.contains(entry.getKey())) {
|
||||
throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AdditionalPropertiesAnyType` properties. JSON: %s", entry.getKey(), jsonElement.toString()));
|
||||
}
|
||||
}
|
||||
JsonObject jsonObj = jsonElement.getAsJsonObject();
|
||||
if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) {
|
||||
throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString()));
|
||||
@ -195,6 +233,23 @@ public class AdditionalPropertiesAnyType implements Parcelable {
|
||||
@Override
|
||||
public void write(JsonWriter out, AdditionalPropertiesAnyType value) throws IOException {
|
||||
JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject();
|
||||
obj.remove("additionalProperties");
|
||||
// serialize additional properties
|
||||
if (value.getAdditionalProperties() != null) {
|
||||
for (Map.Entry<String, Object> entry : value.getAdditionalProperties().entrySet()) {
|
||||
if (entry.getValue() instanceof String)
|
||||
obj.addProperty(entry.getKey(), (String) entry.getValue());
|
||||
else if (entry.getValue() instanceof Number)
|
||||
obj.addProperty(entry.getKey(), (Number) entry.getValue());
|
||||
else if (entry.getValue() instanceof Boolean)
|
||||
obj.addProperty(entry.getKey(), (Boolean) entry.getValue());
|
||||
else if (entry.getValue() instanceof Character)
|
||||
obj.addProperty(entry.getKey(), (Character) entry.getValue());
|
||||
else {
|
||||
obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject());
|
||||
}
|
||||
}
|
||||
}
|
||||
elementAdapter.write(out, obj);
|
||||
}
|
||||
|
||||
@ -202,7 +257,28 @@ public class AdditionalPropertiesAnyType implements Parcelable {
|
||||
public AdditionalPropertiesAnyType read(JsonReader in) throws IOException {
|
||||
JsonElement jsonElement = elementAdapter.read(in);
|
||||
validateJsonElement(jsonElement);
|
||||
return thisAdapter.fromJsonTree(jsonElement);
|
||||
JsonObject jsonObj = jsonElement.getAsJsonObject();
|
||||
// store additional fields in the deserialized instance
|
||||
AdditionalPropertiesAnyType instance = thisAdapter.fromJsonTree(jsonObj);
|
||||
for (Map.Entry<String, JsonElement> entry : jsonObj.entrySet()) {
|
||||
if (!openapiFields.contains(entry.getKey())) {
|
||||
if (entry.getValue().isJsonPrimitive()) { // primitive type
|
||||
if (entry.getValue().getAsJsonPrimitive().isString())
|
||||
instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString());
|
||||
else if (entry.getValue().getAsJsonPrimitive().isNumber())
|
||||
instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber());
|
||||
else if (entry.getValue().getAsJsonPrimitive().isBoolean())
|
||||
instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean());
|
||||
else
|
||||
throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString()));
|
||||
} else if (entry.getValue().isJsonArray()) {
|
||||
instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class));
|
||||
} else { // JSON object
|
||||
instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class));
|
||||
}
|
||||
}
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
}.nullSafe();
|
||||
|
@ -82,6 +82,50 @@ public class AdditionalPropertiesObject implements Parcelable {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* A container for additional, undeclared properties.
|
||||
* This is a holder for any undeclared properties as specified with
|
||||
* the 'additionalProperties' keyword in the OAS document.
|
||||
*/
|
||||
private Map<String, Object> additionalProperties;
|
||||
|
||||
/**
|
||||
* Set the additional (undeclared) property with the specified name and value.
|
||||
* If the property does not already exist, create it otherwise replace it.
|
||||
*
|
||||
* @param key name of the property
|
||||
* @param value value of the property
|
||||
* @return the AdditionalPropertiesObject instance itself
|
||||
*/
|
||||
public AdditionalPropertiesObject putAdditionalProperty(String key, Object value) {
|
||||
if (this.additionalProperties == null) {
|
||||
this.additionalProperties = new HashMap<String, Object>();
|
||||
}
|
||||
this.additionalProperties.put(key, value);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the additional (undeclared) property.
|
||||
*
|
||||
* @return a map of objects
|
||||
*/
|
||||
public Map<String, Object> getAdditionalProperties() {
|
||||
return additionalProperties;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the additional (undeclared) property with the specified name.
|
||||
*
|
||||
* @param key name of the property
|
||||
* @return an object
|
||||
*/
|
||||
public Object getAdditionalProperty(String key) {
|
||||
if (this.additionalProperties == null) {
|
||||
return null;
|
||||
}
|
||||
return this.additionalProperties.get(key);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@ -93,12 +137,13 @@ public class AdditionalPropertiesObject implements Parcelable {
|
||||
return false;
|
||||
}
|
||||
AdditionalPropertiesObject additionalPropertiesObject = (AdditionalPropertiesObject) o;
|
||||
return Objects.equals(this.name, additionalPropertiesObject.name);
|
||||
return Objects.equals(this.name, additionalPropertiesObject.name)&&
|
||||
Objects.equals(this.additionalProperties, additionalPropertiesObject.additionalProperties);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(name);
|
||||
return Objects.hash(name, additionalProperties);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -106,6 +151,7 @@ public class AdditionalPropertiesObject implements Parcelable {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class AdditionalPropertiesObject {\n");
|
||||
sb.append(" name: ").append(toIndentedString(name)).append("\n");
|
||||
sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n");
|
||||
sb.append("}");
|
||||
return sb.toString();
|
||||
}
|
||||
@ -167,14 +213,6 @@ public class AdditionalPropertiesObject implements Parcelable {
|
||||
throw new IllegalArgumentException(String.format("The required field(s) %s in AdditionalPropertiesObject is not found in the empty JSON string", AdditionalPropertiesObject.openapiRequiredFields.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
Set<Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet();
|
||||
// check to see if the JSON string contains additional fields
|
||||
for (Entry<String, JsonElement> entry : entries) {
|
||||
if (!AdditionalPropertiesObject.openapiFields.contains(entry.getKey())) {
|
||||
throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AdditionalPropertiesObject` properties. JSON: %s", entry.getKey(), jsonElement.toString()));
|
||||
}
|
||||
}
|
||||
JsonObject jsonObj = jsonElement.getAsJsonObject();
|
||||
if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) {
|
||||
throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString()));
|
||||
@ -196,6 +234,23 @@ public class AdditionalPropertiesObject implements Parcelable {
|
||||
@Override
|
||||
public void write(JsonWriter out, AdditionalPropertiesObject value) throws IOException {
|
||||
JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject();
|
||||
obj.remove("additionalProperties");
|
||||
// serialize additional properties
|
||||
if (value.getAdditionalProperties() != null) {
|
||||
for (Map.Entry<String, Object> entry : value.getAdditionalProperties().entrySet()) {
|
||||
if (entry.getValue() instanceof String)
|
||||
obj.addProperty(entry.getKey(), (String) entry.getValue());
|
||||
else if (entry.getValue() instanceof Number)
|
||||
obj.addProperty(entry.getKey(), (Number) entry.getValue());
|
||||
else if (entry.getValue() instanceof Boolean)
|
||||
obj.addProperty(entry.getKey(), (Boolean) entry.getValue());
|
||||
else if (entry.getValue() instanceof Character)
|
||||
obj.addProperty(entry.getKey(), (Character) entry.getValue());
|
||||
else {
|
||||
obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject());
|
||||
}
|
||||
}
|
||||
}
|
||||
elementAdapter.write(out, obj);
|
||||
}
|
||||
|
||||
@ -203,7 +258,28 @@ public class AdditionalPropertiesObject implements Parcelable {
|
||||
public AdditionalPropertiesObject read(JsonReader in) throws IOException {
|
||||
JsonElement jsonElement = elementAdapter.read(in);
|
||||
validateJsonElement(jsonElement);
|
||||
return thisAdapter.fromJsonTree(jsonElement);
|
||||
JsonObject jsonObj = jsonElement.getAsJsonObject();
|
||||
// store additional fields in the deserialized instance
|
||||
AdditionalPropertiesObject instance = thisAdapter.fromJsonTree(jsonObj);
|
||||
for (Map.Entry<String, JsonElement> entry : jsonObj.entrySet()) {
|
||||
if (!openapiFields.contains(entry.getKey())) {
|
||||
if (entry.getValue().isJsonPrimitive()) { // primitive type
|
||||
if (entry.getValue().getAsJsonPrimitive().isString())
|
||||
instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString());
|
||||
else if (entry.getValue().getAsJsonPrimitive().isNumber())
|
||||
instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber());
|
||||
else if (entry.getValue().getAsJsonPrimitive().isBoolean())
|
||||
instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean());
|
||||
else
|
||||
throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString()));
|
||||
} else if (entry.getValue().isJsonArray()) {
|
||||
instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class));
|
||||
} else { // JSON object
|
||||
instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class));
|
||||
}
|
||||
}
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
}.nullSafe();
|
||||
|
@ -410,6 +410,50 @@ public class NullableClass {
|
||||
this.objectItemsNullable = objectItemsNullable;
|
||||
}
|
||||
|
||||
/**
|
||||
* A container for additional, undeclared properties.
|
||||
* This is a holder for any undeclared properties as specified with
|
||||
* the 'additionalProperties' keyword in the OAS document.
|
||||
*/
|
||||
private Map<String, Object> additionalProperties;
|
||||
|
||||
/**
|
||||
* Set the additional (undeclared) property with the specified name and value.
|
||||
* If the property does not already exist, create it otherwise replace it.
|
||||
*
|
||||
* @param key name of the property
|
||||
* @param value value of the property
|
||||
* @return the NullableClass instance itself
|
||||
*/
|
||||
public NullableClass putAdditionalProperty(String key, Object value) {
|
||||
if (this.additionalProperties == null) {
|
||||
this.additionalProperties = new HashMap<String, Object>();
|
||||
}
|
||||
this.additionalProperties.put(key, value);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the additional (undeclared) property.
|
||||
*
|
||||
* @return a map of objects
|
||||
*/
|
||||
public Map<String, Object> getAdditionalProperties() {
|
||||
return additionalProperties;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the additional (undeclared) property with the specified name.
|
||||
*
|
||||
* @param key name of the property
|
||||
* @return an object
|
||||
*/
|
||||
public Object getAdditionalProperty(String key) {
|
||||
if (this.additionalProperties == null) {
|
||||
return null;
|
||||
}
|
||||
return this.additionalProperties.get(key);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@ -432,7 +476,8 @@ public class NullableClass {
|
||||
Objects.equals(this.arrayItemsNullable, nullableClass.arrayItemsNullable) &&
|
||||
Objects.equals(this.objectNullableProp, nullableClass.objectNullableProp) &&
|
||||
Objects.equals(this.objectAndItemsNullableProp, nullableClass.objectAndItemsNullableProp) &&
|
||||
Objects.equals(this.objectItemsNullable, nullableClass.objectItemsNullable);
|
||||
Objects.equals(this.objectItemsNullable, nullableClass.objectItemsNullable)&&
|
||||
Objects.equals(this.additionalProperties, nullableClass.additionalProperties);
|
||||
}
|
||||
|
||||
private static <T> boolean equalsNullable(JsonNullable<T> a, JsonNullable<T> b) {
|
||||
@ -441,7 +486,7 @@ public class NullableClass {
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(integerProp, numberProp, booleanProp, stringProp, dateProp, datetimeProp, arrayNullableProp, arrayAndItemsNullableProp, arrayItemsNullable, objectNullableProp, objectAndItemsNullableProp, objectItemsNullable);
|
||||
return Objects.hash(integerProp, numberProp, booleanProp, stringProp, dateProp, datetimeProp, arrayNullableProp, arrayAndItemsNullableProp, arrayItemsNullable, objectNullableProp, objectAndItemsNullableProp, objectItemsNullable, additionalProperties);
|
||||
}
|
||||
|
||||
private static <T> int hashCodeNullable(JsonNullable<T> a) {
|
||||
@ -467,6 +512,7 @@ public class NullableClass {
|
||||
sb.append(" objectNullableProp: ").append(toIndentedString(objectNullableProp)).append("\n");
|
||||
sb.append(" objectAndItemsNullableProp: ").append(toIndentedString(objectAndItemsNullableProp)).append("\n");
|
||||
sb.append(" objectItemsNullable: ").append(toIndentedString(objectItemsNullable)).append("\n");
|
||||
sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n");
|
||||
sb.append("}");
|
||||
return sb.toString();
|
||||
}
|
||||
@ -518,14 +564,6 @@ public class NullableClass {
|
||||
throw new IllegalArgumentException(String.format("The required field(s) %s in NullableClass is not found in the empty JSON string", NullableClass.openapiRequiredFields.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
Set<Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet();
|
||||
// check to see if the JSON string contains additional fields
|
||||
for (Entry<String, JsonElement> entry : entries) {
|
||||
if (!NullableClass.openapiFields.contains(entry.getKey())) {
|
||||
throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `NullableClass` properties. JSON: %s", entry.getKey(), jsonElement.toString()));
|
||||
}
|
||||
}
|
||||
JsonObject jsonObj = jsonElement.getAsJsonObject();
|
||||
if ((jsonObj.get("string_prop") != null && !jsonObj.get("string_prop").isJsonNull()) && !jsonObj.get("string_prop").isJsonPrimitive()) {
|
||||
throw new IllegalArgumentException(String.format("Expected the field `string_prop` to be a primitive type in the JSON string but got `%s`", jsonObj.get("string_prop").toString()));
|
||||
@ -559,6 +597,23 @@ public class NullableClass {
|
||||
@Override
|
||||
public void write(JsonWriter out, NullableClass value) throws IOException {
|
||||
JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject();
|
||||
obj.remove("additionalProperties");
|
||||
// serialize additional properties
|
||||
if (value.getAdditionalProperties() != null) {
|
||||
for (Map.Entry<String, Object> entry : value.getAdditionalProperties().entrySet()) {
|
||||
if (entry.getValue() instanceof String)
|
||||
obj.addProperty(entry.getKey(), (String) entry.getValue());
|
||||
else if (entry.getValue() instanceof Number)
|
||||
obj.addProperty(entry.getKey(), (Number) entry.getValue());
|
||||
else if (entry.getValue() instanceof Boolean)
|
||||
obj.addProperty(entry.getKey(), (Boolean) entry.getValue());
|
||||
else if (entry.getValue() instanceof Character)
|
||||
obj.addProperty(entry.getKey(), (Character) entry.getValue());
|
||||
else {
|
||||
obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject());
|
||||
}
|
||||
}
|
||||
}
|
||||
elementAdapter.write(out, obj);
|
||||
}
|
||||
|
||||
@ -566,7 +621,28 @@ public class NullableClass {
|
||||
public NullableClass read(JsonReader in) throws IOException {
|
||||
JsonElement jsonElement = elementAdapter.read(in);
|
||||
validateJsonElement(jsonElement);
|
||||
return thisAdapter.fromJsonTree(jsonElement);
|
||||
JsonObject jsonObj = jsonElement.getAsJsonObject();
|
||||
// store additional fields in the deserialized instance
|
||||
NullableClass instance = thisAdapter.fromJsonTree(jsonObj);
|
||||
for (Map.Entry<String, JsonElement> entry : jsonObj.entrySet()) {
|
||||
if (!openapiFields.contains(entry.getKey())) {
|
||||
if (entry.getValue().isJsonPrimitive()) { // primitive type
|
||||
if (entry.getValue().getAsJsonPrimitive().isString())
|
||||
instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString());
|
||||
else if (entry.getValue().getAsJsonPrimitive().isNumber())
|
||||
instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber());
|
||||
else if (entry.getValue().getAsJsonPrimitive().isBoolean())
|
||||
instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean());
|
||||
else
|
||||
throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString()));
|
||||
} else if (entry.getValue().isJsonArray()) {
|
||||
instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class));
|
||||
} else { // JSON object
|
||||
instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class));
|
||||
}
|
||||
}
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
}.nullSafe();
|
||||
|
@ -137,12 +137,14 @@ function ConvertFrom-PSJsonToNullableClass {
|
||||
$PSBoundParameters | Out-DebugParameter | Write-Debug
|
||||
|
||||
$JsonParameters = ConvertFrom-Json -InputObject $Json
|
||||
$PSNullableClassAdditionalProperties = @{}
|
||||
|
||||
# check if Json contains properties not defined in PSNullableClass
|
||||
$AllProperties = ("integer_prop", "number_prop", "boolean_prop", "string_prop", "date_prop", "datetime_prop", "array_nullable_prop", "array_and_items_nullable_prop", "array_items_nullable", "object_nullable_prop", "object_and_items_nullable_prop", "object_items_nullable")
|
||||
foreach ($name in $JsonParameters.PsObject.Properties.Name) {
|
||||
# store undefined properties in additionalProperties
|
||||
if (!($AllProperties.Contains($name))) {
|
||||
throw "Error! JSON key '$name' not found in the properties: $($AllProperties)"
|
||||
$PSNullableClassAdditionalProperties[$name] = $JsonParameters.PSobject.Properties[$name].value
|
||||
}
|
||||
}
|
||||
|
||||
@ -231,6 +233,7 @@ function ConvertFrom-PSJsonToNullableClass {
|
||||
"object_nullable_prop" = ${ObjectNullableProp}
|
||||
"object_and_items_nullable_prop" = ${ObjectAndItemsNullableProp}
|
||||
"object_items_nullable" = ${ObjectItemsNullable}
|
||||
"AdditionalProperties" = $PSNullableClassAdditionalProperties
|
||||
}
|
||||
|
||||
return $PSO
|
||||
|
@ -1656,7 +1656,7 @@ export interface Whale {
|
||||
* @interface Zebra
|
||||
*/
|
||||
export interface Zebra {
|
||||
[key: string]: any;
|
||||
[key: string]: any | any;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -175,7 +175,7 @@ export interface ArrayTest {
|
||||
* @interface Banana
|
||||
*/
|
||||
export interface Banana {
|
||||
[key: string]: any;
|
||||
[key: string]: any | any;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -32,8 +32,11 @@ type NullableClass struct {
|
||||
ObjectNullableProp map[string]map[string]interface{} `json:"object_nullable_prop,omitempty"`
|
||||
ObjectAndItemsNullableProp map[string]map[string]interface{} `json:"object_and_items_nullable_prop,omitempty"`
|
||||
ObjectItemsNullable map[string]map[string]interface{} `json:"object_items_nullable,omitempty"`
|
||||
AdditionalProperties map[string]interface{}
|
||||
}
|
||||
|
||||
type _NullableClass NullableClass
|
||||
|
||||
// NewNullableClass instantiates a new NullableClass object
|
||||
// This constructor will assign default values to properties that have it defined,
|
||||
// and makes sure properties required by API are set, but the set of arguments
|
||||
@ -549,9 +552,42 @@ func (o NullableClass) ToMap() (map[string]interface{}, error) {
|
||||
if !IsNil(o.ObjectItemsNullable) {
|
||||
toSerialize["object_items_nullable"] = o.ObjectItemsNullable
|
||||
}
|
||||
|
||||
for key, value := range o.AdditionalProperties {
|
||||
toSerialize[key] = value
|
||||
}
|
||||
|
||||
return toSerialize, nil
|
||||
}
|
||||
|
||||
func (o *NullableClass) UnmarshalJSON(bytes []byte) (err error) {
|
||||
varNullableClass := _NullableClass{}
|
||||
|
||||
if err = json.Unmarshal(bytes, &varNullableClass); err == nil {
|
||||
*o = NullableClass(varNullableClass)
|
||||
}
|
||||
|
||||
additionalProperties := make(map[string]interface{})
|
||||
|
||||
if err = json.Unmarshal(bytes, &additionalProperties); err == nil {
|
||||
delete(additionalProperties, "integer_prop")
|
||||
delete(additionalProperties, "number_prop")
|
||||
delete(additionalProperties, "boolean_prop")
|
||||
delete(additionalProperties, "string_prop")
|
||||
delete(additionalProperties, "date_prop")
|
||||
delete(additionalProperties, "datetime_prop")
|
||||
delete(additionalProperties, "array_nullable_prop")
|
||||
delete(additionalProperties, "array_and_items_nullable_prop")
|
||||
delete(additionalProperties, "array_items_nullable")
|
||||
delete(additionalProperties, "object_nullable_prop")
|
||||
delete(additionalProperties, "object_and_items_nullable_prop")
|
||||
delete(additionalProperties, "object_items_nullable")
|
||||
o.AdditionalProperties = additionalProperties
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
type NullableNullableClass struct {
|
||||
value *NullableClass
|
||||
isSet bool
|
||||
|
@ -3,6 +3,8 @@
|
||||
.gitlab-ci.yml
|
||||
.travis.yml
|
||||
README.md
|
||||
docs/AdditionalPropertieAnyType.md
|
||||
docs/AdditionalPropertieObject.md
|
||||
docs/AdditionalPropertiesClass.md
|
||||
docs/AllOfWithSingleRef.md
|
||||
docs/Animal.md
|
||||
@ -97,6 +99,8 @@ petstore_api/api_response.py
|
||||
petstore_api/configuration.py
|
||||
petstore_api/exceptions.py
|
||||
petstore_api/models/__init__.py
|
||||
petstore_api/models/additional_propertie_any_type.py
|
||||
petstore_api/models/additional_propertie_object.py
|
||||
petstore_api/models/additional_properties_class.py
|
||||
petstore_api/models/all_of_with_single_ref.py
|
||||
petstore_api/models/animal.py
|
||||
|
@ -132,6 +132,8 @@ Class | Method | HTTP request | Description
|
||||
|
||||
## Documentation For Models
|
||||
|
||||
- [AdditionalPropertieAnyType](docs/AdditionalPropertieAnyType.md)
|
||||
- [AdditionalPropertieObject](docs/AdditionalPropertieObject.md)
|
||||
- [AdditionalPropertiesClass](docs/AdditionalPropertiesClass.md)
|
||||
- [AllOfWithSingleRef](docs/AllOfWithSingleRef.md)
|
||||
- [Animal](docs/Animal.md)
|
||||
|
@ -0,0 +1,28 @@
|
||||
# AdditionalPropertieAnyType
|
||||
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**name** | **str** | | [optional]
|
||||
|
||||
## Example
|
||||
|
||||
```python
|
||||
from petstore_api.models.additional_propertie_any_type import AdditionalPropertieAnyType
|
||||
|
||||
# TODO update the JSON string below
|
||||
json = "{}"
|
||||
# create an instance of AdditionalPropertieAnyType from a JSON string
|
||||
additional_propertie_any_type_instance = AdditionalPropertieAnyType.from_json(json)
|
||||
# print the JSON string representation of the object
|
||||
print AdditionalPropertieAnyType.to_json()
|
||||
|
||||
# convert the object into a dict
|
||||
additional_propertie_any_type_dict = additional_propertie_any_type_instance.to_dict()
|
||||
# create an instance of AdditionalPropertieAnyType from a dict
|
||||
additional_propertie_any_type_form_dict = additional_propertie_any_type.from_dict(additional_propertie_any_type_dict)
|
||||
```
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
@ -0,0 +1,28 @@
|
||||
# AdditionalPropertieObject
|
||||
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**name** | **str** | | [optional]
|
||||
|
||||
## Example
|
||||
|
||||
```python
|
||||
from petstore_api.models.additional_propertie_object import AdditionalPropertieObject
|
||||
|
||||
# TODO update the JSON string below
|
||||
json = "{}"
|
||||
# create an instance of AdditionalPropertieObject from a JSON string
|
||||
additional_propertie_object_instance = AdditionalPropertieObject.from_json(json)
|
||||
# print the JSON string representation of the object
|
||||
print AdditionalPropertieObject.to_json()
|
||||
|
||||
# convert the object into a dict
|
||||
additional_propertie_object_dict = additional_propertie_object_instance.to_dict()
|
||||
# create an instance of AdditionalPropertieObject from a dict
|
||||
additional_propertie_object_form_dict = additional_propertie_object.from_dict(additional_propertie_object_dict)
|
||||
```
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
@ -38,6 +38,8 @@ from petstore_api.exceptions import ApiException
|
||||
from petstore_api.signing import HttpSigningConfiguration
|
||||
|
||||
# import models into sdk package
|
||||
from petstore_api.models.additional_propertie_any_type import AdditionalPropertieAnyType
|
||||
from petstore_api.models.additional_propertie_object import AdditionalPropertieObject
|
||||
from petstore_api.models.additional_properties_class import AdditionalPropertiesClass
|
||||
from petstore_api.models.all_of_with_single_ref import AllOfWithSingleRef
|
||||
from petstore_api.models.animal import Animal
|
||||
|
@ -14,6 +14,8 @@
|
||||
|
||||
|
||||
# import models into model package
|
||||
from petstore_api.models.additional_propertie_any_type import AdditionalPropertieAnyType
|
||||
from petstore_api.models.additional_propertie_object import AdditionalPropertieObject
|
||||
from petstore_api.models.additional_properties_class import AdditionalPropertiesClass
|
||||
from petstore_api.models.all_of_with_single_ref import AllOfWithSingleRef
|
||||
from petstore_api.models.animal import Animal
|
||||
|
@ -0,0 +1,83 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
OpenAPI Petstore
|
||||
|
||||
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
|
||||
from typing import Optional
|
||||
from pydantic import BaseModel, StrictStr
|
||||
|
||||
class AdditionalPropertieAnyType(BaseModel):
|
||||
"""
|
||||
AdditionalPropertieAnyType
|
||||
"""
|
||||
name: Optional[StrictStr] = None
|
||||
additional_properties: Dict[str, Any] = {}
|
||||
__properties = ["name"]
|
||||
|
||||
class Config:
|
||||
"""Pydantic configuration"""
|
||||
allow_population_by_field_name = True
|
||||
validate_assignment = True
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.dict(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
return json.dumps(self.to_dict())
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> AdditionalPropertieAnyType:
|
||||
"""Create an instance of AdditionalPropertieAnyType from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self):
|
||||
"""Returns the dictionary representation of the model using alias"""
|
||||
_dict = self.dict(by_alias=True,
|
||||
exclude={
|
||||
"additional_properties"
|
||||
},
|
||||
exclude_none=True)
|
||||
# puts key-value pairs in additional_properties in the top level
|
||||
if self.additional_properties is not None:
|
||||
for _key, _value in self.additional_properties.items():
|
||||
_dict[_key] = _value
|
||||
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: dict) -> AdditionalPropertieAnyType:
|
||||
"""Create an instance of AdditionalPropertieAnyType from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return AdditionalPropertieAnyType.parse_obj(obj)
|
||||
|
||||
_obj = AdditionalPropertieAnyType.parse_obj({
|
||||
"name": obj.get("name")
|
||||
})
|
||||
# store additional fields in additional_properties
|
||||
for _key in obj.keys():
|
||||
if _key not in cls.__properties:
|
||||
_obj.additional_properties[_key] = obj.get(_key)
|
||||
|
||||
return _obj
|
||||
|
||||
|
@ -0,0 +1,83 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
OpenAPI Petstore
|
||||
|
||||
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
|
||||
from typing import Optional
|
||||
from pydantic import BaseModel, StrictStr
|
||||
|
||||
class AdditionalPropertieObject(BaseModel):
|
||||
"""
|
||||
AdditionalPropertieObject
|
||||
"""
|
||||
name: Optional[StrictStr] = None
|
||||
additional_properties: Dict[str, Any] = {}
|
||||
__properties = ["name"]
|
||||
|
||||
class Config:
|
||||
"""Pydantic configuration"""
|
||||
allow_population_by_field_name = True
|
||||
validate_assignment = True
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.dict(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
return json.dumps(self.to_dict())
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> AdditionalPropertieObject:
|
||||
"""Create an instance of AdditionalPropertieObject from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self):
|
||||
"""Returns the dictionary representation of the model using alias"""
|
||||
_dict = self.dict(by_alias=True,
|
||||
exclude={
|
||||
"additional_properties"
|
||||
},
|
||||
exclude_none=True)
|
||||
# puts key-value pairs in additional_properties in the top level
|
||||
if self.additional_properties is not None:
|
||||
for _key, _value in self.additional_properties.items():
|
||||
_dict[_key] = _value
|
||||
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: dict) -> AdditionalPropertieObject:
|
||||
"""Create an instance of AdditionalPropertieObject from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return AdditionalPropertieObject.parse_obj(obj)
|
||||
|
||||
_obj = AdditionalPropertieObject.parse_obj({
|
||||
"name": obj.get("name")
|
||||
})
|
||||
# store additional fields in additional_properties
|
||||
for _key in obj.keys():
|
||||
if _key not in cls.__properties:
|
||||
_obj.additional_properties[_key] = obj.get(_key)
|
||||
|
||||
return _obj
|
||||
|
||||
|
@ -38,6 +38,7 @@ class NullableClass(BaseModel):
|
||||
object_nullable_prop: Optional[Dict[str, Dict[str, Any]]] = None
|
||||
object_and_items_nullable_prop: Optional[Dict[str, Dict[str, Any]]] = None
|
||||
object_items_nullable: Optional[Dict[str, Dict[str, Any]]] = None
|
||||
additional_properties: Dict[str, Any] = {}
|
||||
__properties = ["required_integer_prop", "integer_prop", "number_prop", "boolean_prop", "string_prop", "date_prop", "datetime_prop", "array_nullable_prop", "array_and_items_nullable_prop", "array_items_nullable", "object_nullable_prop", "object_and_items_nullable_prop", "object_items_nullable"]
|
||||
|
||||
class Config:
|
||||
@ -62,8 +63,14 @@ class NullableClass(BaseModel):
|
||||
"""Returns the dictionary representation of the model using alias"""
|
||||
_dict = self.dict(by_alias=True,
|
||||
exclude={
|
||||
"additional_properties"
|
||||
},
|
||||
exclude_none=True)
|
||||
# puts key-value pairs in additional_properties in the top level
|
||||
if self.additional_properties is not None:
|
||||
for _key, _value in self.additional_properties.items():
|
||||
_dict[_key] = _value
|
||||
|
||||
# set to None if required_integer_prop (nullable) is None
|
||||
# and __fields_set__ contains the field
|
||||
if self.required_integer_prop is None and "required_integer_prop" in self.__fields_set__:
|
||||
@ -145,6 +152,11 @@ class NullableClass(BaseModel):
|
||||
"object_and_items_nullable_prop": obj.get("object_and_items_nullable_prop"),
|
||||
"object_items_nullable": obj.get("object_items_nullable")
|
||||
})
|
||||
# store additional fields in additional_properties
|
||||
for _key in obj.keys():
|
||||
if _key not in cls.__properties:
|
||||
_obj.additional_properties[_key] = obj.get(_key)
|
||||
|
||||
return _obj
|
||||
|
||||
|
||||
|
@ -0,0 +1,54 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
OpenAPI Petstore
|
||||
|
||||
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
|
||||
import unittest
|
||||
import datetime
|
||||
|
||||
import petstore_api
|
||||
from petstore_api.models.additional_propertie_any_type import AdditionalPropertieAnyType # noqa: E501
|
||||
from petstore_api.rest import ApiException
|
||||
|
||||
class TestAdditionalPropertieAnyType(unittest.TestCase):
|
||||
"""AdditionalPropertieAnyType unit test stubs"""
|
||||
|
||||
def setUp(self):
|
||||
pass
|
||||
|
||||
def tearDown(self):
|
||||
pass
|
||||
|
||||
def make_instance(self, include_optional):
|
||||
"""Test AdditionalPropertieAnyType
|
||||
include_option is a boolean, when False only required
|
||||
params are included, when True both required and
|
||||
optional params are included """
|
||||
# uncomment below to create an instance of `AdditionalPropertieAnyType`
|
||||
"""
|
||||
model = petstore_api.models.additional_propertie_any_type.AdditionalPropertieAnyType() # noqa: E501
|
||||
if include_optional :
|
||||
return AdditionalPropertieAnyType(
|
||||
name = ''
|
||||
)
|
||||
else :
|
||||
return AdditionalPropertieAnyType(
|
||||
)
|
||||
"""
|
||||
|
||||
def testAdditionalPropertieAnyType(self):
|
||||
"""Test AdditionalPropertieAnyType"""
|
||||
# inst_req_only = self.make_instance(include_optional=False)
|
||||
# inst_req_and_optional = self.make_instance(include_optional=True)
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
@ -0,0 +1,54 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
OpenAPI Petstore
|
||||
|
||||
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
|
||||
import unittest
|
||||
import datetime
|
||||
|
||||
import petstore_api
|
||||
from petstore_api.models.additional_propertie_object import AdditionalPropertieObject # noqa: E501
|
||||
from petstore_api.rest import ApiException
|
||||
|
||||
class TestAdditionalPropertieObject(unittest.TestCase):
|
||||
"""AdditionalPropertieObject unit test stubs"""
|
||||
|
||||
def setUp(self):
|
||||
pass
|
||||
|
||||
def tearDown(self):
|
||||
pass
|
||||
|
||||
def make_instance(self, include_optional):
|
||||
"""Test AdditionalPropertieObject
|
||||
include_option is a boolean, when False only required
|
||||
params are included, when True both required and
|
||||
optional params are included """
|
||||
# uncomment below to create an instance of `AdditionalPropertieObject`
|
||||
"""
|
||||
model = petstore_api.models.additional_propertie_object.AdditionalPropertieObject() # noqa: E501
|
||||
if include_optional :
|
||||
return AdditionalPropertieObject(
|
||||
name = ''
|
||||
)
|
||||
else :
|
||||
return AdditionalPropertieObject(
|
||||
)
|
||||
"""
|
||||
|
||||
def testAdditionalPropertieObject(self):
|
||||
"""Test AdditionalPropertieObject"""
|
||||
# inst_req_only = self.make_instance(include_optional=False)
|
||||
# inst_req_and_optional = self.make_instance(include_optional=True)
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
@ -3,6 +3,8 @@
|
||||
.gitlab-ci.yml
|
||||
.travis.yml
|
||||
README.md
|
||||
docs/AdditionalPropertieAnyType.md
|
||||
docs/AdditionalPropertieObject.md
|
||||
docs/AdditionalPropertiesClass.md
|
||||
docs/AllOfWithSingleRef.md
|
||||
docs/Animal.md
|
||||
@ -97,6 +99,8 @@ petstore_api/api_response.py
|
||||
petstore_api/configuration.py
|
||||
petstore_api/exceptions.py
|
||||
petstore_api/models/__init__.py
|
||||
petstore_api/models/additional_propertie_any_type.py
|
||||
petstore_api/models/additional_propertie_object.py
|
||||
petstore_api/models/additional_properties_class.py
|
||||
petstore_api/models/all_of_with_single_ref.py
|
||||
petstore_api/models/animal.py
|
||||
|
@ -132,6 +132,8 @@ Class | Method | HTTP request | Description
|
||||
|
||||
## Documentation For Models
|
||||
|
||||
- [AdditionalPropertieAnyType](docs/AdditionalPropertieAnyType.md)
|
||||
- [AdditionalPropertieObject](docs/AdditionalPropertieObject.md)
|
||||
- [AdditionalPropertiesClass](docs/AdditionalPropertiesClass.md)
|
||||
- [AllOfWithSingleRef](docs/AllOfWithSingleRef.md)
|
||||
- [Animal](docs/Animal.md)
|
||||
|
@ -0,0 +1,28 @@
|
||||
# AdditionalPropertieAnyType
|
||||
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**name** | **str** | | [optional]
|
||||
|
||||
## Example
|
||||
|
||||
```python
|
||||
from petstore_api.models.additional_propertie_any_type import AdditionalPropertieAnyType
|
||||
|
||||
# TODO update the JSON string below
|
||||
json = "{}"
|
||||
# create an instance of AdditionalPropertieAnyType from a JSON string
|
||||
additional_propertie_any_type_instance = AdditionalPropertieAnyType.from_json(json)
|
||||
# print the JSON string representation of the object
|
||||
print AdditionalPropertieAnyType.to_json()
|
||||
|
||||
# convert the object into a dict
|
||||
additional_propertie_any_type_dict = additional_propertie_any_type_instance.to_dict()
|
||||
# create an instance of AdditionalPropertieAnyType from a dict
|
||||
additional_propertie_any_type_form_dict = additional_propertie_any_type.from_dict(additional_propertie_any_type_dict)
|
||||
```
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
@ -0,0 +1,28 @@
|
||||
# AdditionalPropertieObject
|
||||
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**name** | **str** | | [optional]
|
||||
|
||||
## Example
|
||||
|
||||
```python
|
||||
from petstore_api.models.additional_propertie_object import AdditionalPropertieObject
|
||||
|
||||
# TODO update the JSON string below
|
||||
json = "{}"
|
||||
# create an instance of AdditionalPropertieObject from a JSON string
|
||||
additional_propertie_object_instance = AdditionalPropertieObject.from_json(json)
|
||||
# print the JSON string representation of the object
|
||||
print AdditionalPropertieObject.to_json()
|
||||
|
||||
# convert the object into a dict
|
||||
additional_propertie_object_dict = additional_propertie_object_instance.to_dict()
|
||||
# create an instance of AdditionalPropertieObject from a dict
|
||||
additional_propertie_object_form_dict = additional_propertie_object.from_dict(additional_propertie_object_dict)
|
||||
```
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
@ -0,0 +1,28 @@
|
||||
# AdditionalPropertiesAnyType
|
||||
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**name** | **str** | | [optional]
|
||||
|
||||
## Example
|
||||
|
||||
```python
|
||||
from petstore_api.models.additional_properties_any_type import AdditionalPropertiesAnyType
|
||||
|
||||
# TODO update the JSON string below
|
||||
json = "{}"
|
||||
# create an instance of AdditionalPropertiesAnyType from a JSON string
|
||||
additional_properties_any_type_instance = AdditionalPropertiesAnyType.from_json(json)
|
||||
# print the JSON string representation of the object
|
||||
print AdditionalPropertiesAnyType.to_json()
|
||||
|
||||
# convert the object into a dict
|
||||
additional_properties_any_type_dict = additional_properties_any_type_instance.to_dict()
|
||||
# create an instance of AdditionalPropertiesAnyType from a dict
|
||||
additional_properties_any_type_form_dict = additional_properties_any_type.from_dict(additional_properties_any_type_dict)
|
||||
```
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
@ -38,6 +38,8 @@ from petstore_api.exceptions import ApiException
|
||||
from petstore_api.signing import HttpSigningConfiguration
|
||||
|
||||
# import models into sdk package
|
||||
from petstore_api.models.additional_propertie_any_type import AdditionalPropertieAnyType
|
||||
from petstore_api.models.additional_propertie_object import AdditionalPropertieObject
|
||||
from petstore_api.models.additional_properties_class import AdditionalPropertiesClass
|
||||
from petstore_api.models.all_of_with_single_ref import AllOfWithSingleRef
|
||||
from petstore_api.models.animal import Animal
|
||||
|
@ -14,6 +14,8 @@
|
||||
|
||||
|
||||
# import models into model package
|
||||
from petstore_api.models.additional_propertie_any_type import AdditionalPropertieAnyType
|
||||
from petstore_api.models.additional_propertie_object import AdditionalPropertieObject
|
||||
from petstore_api.models.additional_properties_class import AdditionalPropertiesClass
|
||||
from petstore_api.models.all_of_with_single_ref import AllOfWithSingleRef
|
||||
from petstore_api.models.animal import Animal
|
||||
|
@ -0,0 +1,83 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
OpenAPI Petstore
|
||||
|
||||
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
|
||||
from typing import Any, Dict, Optional
|
||||
from pydantic import BaseModel, StrictStr
|
||||
|
||||
class AdditionalPropertieAnyType(BaseModel):
|
||||
"""
|
||||
AdditionalPropertieAnyType
|
||||
"""
|
||||
name: Optional[StrictStr] = None
|
||||
additional_properties: Dict[str, Any] = {}
|
||||
__properties = ["name"]
|
||||
|
||||
class Config:
|
||||
"""Pydantic configuration"""
|
||||
allow_population_by_field_name = True
|
||||
validate_assignment = True
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.dict(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
return json.dumps(self.to_dict())
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> AdditionalPropertieAnyType:
|
||||
"""Create an instance of AdditionalPropertieAnyType from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self):
|
||||
"""Returns the dictionary representation of the model using alias"""
|
||||
_dict = self.dict(by_alias=True,
|
||||
exclude={
|
||||
"additional_properties"
|
||||
},
|
||||
exclude_none=True)
|
||||
# puts key-value pairs in additional_properties in the top level
|
||||
if self.additional_properties is not None:
|
||||
for _key, _value in self.additional_properties.items():
|
||||
_dict[_key] = _value
|
||||
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: dict) -> AdditionalPropertieAnyType:
|
||||
"""Create an instance of AdditionalPropertieAnyType from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return AdditionalPropertieAnyType.parse_obj(obj)
|
||||
|
||||
_obj = AdditionalPropertieAnyType.parse_obj({
|
||||
"name": obj.get("name")
|
||||
})
|
||||
# store additional fields in additional_properties
|
||||
for _key in obj.keys():
|
||||
if _key not in cls.__properties:
|
||||
_obj.additional_properties[_key] = obj.get(_key)
|
||||
|
||||
return _obj
|
||||
|
||||
|
@ -0,0 +1,83 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
OpenAPI Petstore
|
||||
|
||||
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
|
||||
from typing import Any, Dict, Optional
|
||||
from pydantic import BaseModel, StrictStr
|
||||
|
||||
class AdditionalPropertieObject(BaseModel):
|
||||
"""
|
||||
AdditionalPropertieObject
|
||||
"""
|
||||
name: Optional[StrictStr] = None
|
||||
additional_properties: Dict[str, Any] = {}
|
||||
__properties = ["name"]
|
||||
|
||||
class Config:
|
||||
"""Pydantic configuration"""
|
||||
allow_population_by_field_name = True
|
||||
validate_assignment = True
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.dict(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
return json.dumps(self.to_dict())
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> AdditionalPropertieObject:
|
||||
"""Create an instance of AdditionalPropertieObject from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self):
|
||||
"""Returns the dictionary representation of the model using alias"""
|
||||
_dict = self.dict(by_alias=True,
|
||||
exclude={
|
||||
"additional_properties"
|
||||
},
|
||||
exclude_none=True)
|
||||
# puts key-value pairs in additional_properties in the top level
|
||||
if self.additional_properties is not None:
|
||||
for _key, _value in self.additional_properties.items():
|
||||
_dict[_key] = _value
|
||||
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: dict) -> AdditionalPropertieObject:
|
||||
"""Create an instance of AdditionalPropertieObject from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return AdditionalPropertieObject.parse_obj(obj)
|
||||
|
||||
_obj = AdditionalPropertieObject.parse_obj({
|
||||
"name": obj.get("name")
|
||||
})
|
||||
# store additional fields in additional_properties
|
||||
for _key in obj.keys():
|
||||
if _key not in cls.__properties:
|
||||
_obj.additional_properties[_key] = obj.get(_key)
|
||||
|
||||
return _obj
|
||||
|
||||
|
@ -0,0 +1,83 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
OpenAPI Petstore
|
||||
|
||||
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
|
||||
from typing import Any, Dict, Optional
|
||||
from pydantic import BaseModel, StrictStr
|
||||
|
||||
class AdditionalPropertiesAnyType(BaseModel):
|
||||
"""
|
||||
AdditionalPropertiesAnyType
|
||||
"""
|
||||
name: Optional[StrictStr] = None
|
||||
additional_properties: Dict[str, Any] = {}
|
||||
__properties = ["name"]
|
||||
|
||||
class Config:
|
||||
"""Pydantic configuration"""
|
||||
allow_population_by_field_name = True
|
||||
validate_assignment = True
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.dict(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
return json.dumps(self.to_dict())
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> AdditionalPropertiesAnyType:
|
||||
"""Create an instance of AdditionalPropertiesAnyType from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self):
|
||||
"""Returns the dictionary representation of the model using alias"""
|
||||
_dict = self.dict(by_alias=True,
|
||||
exclude={
|
||||
"additional_properties"
|
||||
},
|
||||
exclude_none=True)
|
||||
# puts key-value pairs in additional_properties in the top level
|
||||
if self.additional_properties is not None:
|
||||
for _key, _value in self.additional_properties.items():
|
||||
_dict[_key] = _value
|
||||
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: dict) -> AdditionalPropertiesAnyType:
|
||||
"""Create an instance of AdditionalPropertiesAnyType from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return AdditionalPropertiesAnyType.parse_obj(obj)
|
||||
|
||||
_obj = AdditionalPropertiesAnyType.parse_obj({
|
||||
"name": obj.get("name")
|
||||
})
|
||||
# store additional fields in additional_properties
|
||||
for _key in obj.keys():
|
||||
if _key not in cls.__properties:
|
||||
_obj.additional_properties[_key] = obj.get(_key)
|
||||
|
||||
return _obj
|
||||
|
||||
|
@ -38,6 +38,7 @@ class NullableClass(BaseModel):
|
||||
object_nullable_prop: Optional[Dict[str, Dict[str, Any]]] = None
|
||||
object_and_items_nullable_prop: Optional[Dict[str, Dict[str, Any]]] = None
|
||||
object_items_nullable: Optional[Dict[str, Dict[str, Any]]] = None
|
||||
additional_properties: Dict[str, Any] = {}
|
||||
__properties = ["required_integer_prop", "integer_prop", "number_prop", "boolean_prop", "string_prop", "date_prop", "datetime_prop", "array_nullable_prop", "array_and_items_nullable_prop", "array_items_nullable", "object_nullable_prop", "object_and_items_nullable_prop", "object_items_nullable"]
|
||||
|
||||
class Config:
|
||||
@ -62,8 +63,14 @@ class NullableClass(BaseModel):
|
||||
"""Returns the dictionary representation of the model using alias"""
|
||||
_dict = self.dict(by_alias=True,
|
||||
exclude={
|
||||
"additional_properties"
|
||||
},
|
||||
exclude_none=True)
|
||||
# puts key-value pairs in additional_properties in the top level
|
||||
if self.additional_properties is not None:
|
||||
for _key, _value in self.additional_properties.items():
|
||||
_dict[_key] = _value
|
||||
|
||||
# set to None if required_integer_prop (nullable) is None
|
||||
# and __fields_set__ contains the field
|
||||
if self.required_integer_prop is None and "required_integer_prop" in self.__fields_set__:
|
||||
@ -145,6 +152,11 @@ class NullableClass(BaseModel):
|
||||
"object_and_items_nullable_prop": obj.get("object_and_items_nullable_prop"),
|
||||
"object_items_nullable": obj.get("object_items_nullable")
|
||||
})
|
||||
# store additional fields in additional_properties
|
||||
for _key in obj.keys():
|
||||
if _key not in cls.__properties:
|
||||
_obj.additional_properties[_key] = obj.get(_key)
|
||||
|
||||
return _obj
|
||||
|
||||
|
||||
|
@ -0,0 +1,54 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
OpenAPI Petstore
|
||||
|
||||
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
|
||||
import unittest
|
||||
import datetime
|
||||
|
||||
import petstore_api
|
||||
from petstore_api.models.additional_propertie_any_type import AdditionalPropertieAnyType # noqa: E501
|
||||
from petstore_api.rest import ApiException
|
||||
|
||||
class TestAdditionalPropertieAnyType(unittest.TestCase):
|
||||
"""AdditionalPropertieAnyType unit test stubs"""
|
||||
|
||||
def setUp(self):
|
||||
pass
|
||||
|
||||
def tearDown(self):
|
||||
pass
|
||||
|
||||
def make_instance(self, include_optional):
|
||||
"""Test AdditionalPropertieAnyType
|
||||
include_option is a boolean, when False only required
|
||||
params are included, when True both required and
|
||||
optional params are included """
|
||||
# uncomment below to create an instance of `AdditionalPropertieAnyType`
|
||||
"""
|
||||
model = petstore_api.models.additional_propertie_any_type.AdditionalPropertieAnyType() # noqa: E501
|
||||
if include_optional :
|
||||
return AdditionalPropertieAnyType(
|
||||
name = ''
|
||||
)
|
||||
else :
|
||||
return AdditionalPropertieAnyType(
|
||||
)
|
||||
"""
|
||||
|
||||
def testAdditionalPropertieAnyType(self):
|
||||
"""Test AdditionalPropertieAnyType"""
|
||||
# inst_req_only = self.make_instance(include_optional=False)
|
||||
# inst_req_and_optional = self.make_instance(include_optional=True)
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
@ -0,0 +1,54 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
OpenAPI Petstore
|
||||
|
||||
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
|
||||
import unittest
|
||||
import datetime
|
||||
|
||||
import petstore_api
|
||||
from petstore_api.models.additional_propertie_object import AdditionalPropertieObject # noqa: E501
|
||||
from petstore_api.rest import ApiException
|
||||
|
||||
class TestAdditionalPropertieObject(unittest.TestCase):
|
||||
"""AdditionalPropertieObject unit test stubs"""
|
||||
|
||||
def setUp(self):
|
||||
pass
|
||||
|
||||
def tearDown(self):
|
||||
pass
|
||||
|
||||
def make_instance(self, include_optional):
|
||||
"""Test AdditionalPropertieObject
|
||||
include_option is a boolean, when False only required
|
||||
params are included, when True both required and
|
||||
optional params are included """
|
||||
# uncomment below to create an instance of `AdditionalPropertieObject`
|
||||
"""
|
||||
model = petstore_api.models.additional_propertie_object.AdditionalPropertieObject() # noqa: E501
|
||||
if include_optional :
|
||||
return AdditionalPropertieObject(
|
||||
name = ''
|
||||
)
|
||||
else :
|
||||
return AdditionalPropertieObject(
|
||||
)
|
||||
"""
|
||||
|
||||
def testAdditionalPropertieObject(self):
|
||||
"""Test AdditionalPropertieObject"""
|
||||
# inst_req_only = self.make_instance(include_optional=False)
|
||||
# inst_req_and_optional = self.make_instance(include_optional=True)
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
@ -0,0 +1,54 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
OpenAPI Petstore
|
||||
|
||||
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
|
||||
import unittest
|
||||
import datetime
|
||||
|
||||
import petstore_api
|
||||
from petstore_api.models.additional_properties_any_type import AdditionalPropertiesAnyType # noqa: E501
|
||||
from petstore_api.rest import ApiException
|
||||
|
||||
class TestAdditionalPropertiesAnyType(unittest.TestCase):
|
||||
"""AdditionalPropertiesAnyType unit test stubs"""
|
||||
|
||||
def setUp(self):
|
||||
pass
|
||||
|
||||
def tearDown(self):
|
||||
pass
|
||||
|
||||
def make_instance(self, include_optional):
|
||||
"""Test AdditionalPropertiesAnyType
|
||||
include_option is a boolean, when False only required
|
||||
params are included, when True both required and
|
||||
optional params are included """
|
||||
# uncomment below to create an instance of `AdditionalPropertiesAnyType`
|
||||
"""
|
||||
model = petstore_api.models.additional_properties_any_type.AdditionalPropertiesAnyType() # noqa: E501
|
||||
if include_optional :
|
||||
return AdditionalPropertiesAnyType(
|
||||
name = ''
|
||||
)
|
||||
else :
|
||||
return AdditionalPropertiesAnyType(
|
||||
)
|
||||
"""
|
||||
|
||||
def testAdditionalPropertiesAnyType(self):
|
||||
"""Test AdditionalPropertiesAnyType"""
|
||||
# inst_req_only = self.make_instance(include_optional=False)
|
||||
# inst_req_and_optional = self.make_instance(include_optional=True)
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
@ -513,3 +513,13 @@ class ModelTests(unittest.TestCase):
|
||||
a = petstore_api.FirstRef.from_dict({})
|
||||
self.assertEqual(a.to_json(), "{}")
|
||||
|
||||
def test_additional_properties(self):
|
||||
a1 = petstore_api.AdditionalPropertieAnyType()
|
||||
a1.additional_properties = { "abc": 123 }
|
||||
self.assertEqual(a1.to_dict(), {"abc": 123})
|
||||
self.assertEqual(a1.to_json(), "{\"abc\": 123}")
|
||||
|
||||
a2 = petstore_api.AdditionalPropertieObject()
|
||||
a2.additional_properties = { "efg": 45.6 }
|
||||
self.assertEqual(a2.to_dict(), {"efg": 45.6})
|
||||
self.assertEqual(a2.to_json(), "{\"efg\": 45.6}")
|
||||
|
Loading…
x
Reference in New Issue
Block a user