diff --git a/bin/configs/python-oas2.yaml b/bin/configs/python-oas2.yaml
index 4555376bd167..7c548fb39269 100644
--- a/bin/configs/python-oas2.yaml
+++ b/bin/configs/python-oas2.yaml
@@ -1,7 +1,10 @@
+# this file exists because in this file we omit setting disallowAdditionalPropertiesIfNotPresent
+# which makes it default to false
+# that false setting is needed for composed schemas to work
+# Composed schemas are schemas that contain the allOf/oneOf/anyOf keywords. v2 specs only support the allOf keyword.
generatorName: python
outputDir: samples/client/petstore/python
inputSpec: modules/openapi-generator/src/test/resources/2_0/python-client-experimental/petstore-with-fake-endpoints-models-for-testing.yaml
templateDir: modules/openapi-generator/src/main/resources/python
additionalProperties:
- disallowAdditionalPropertiesIfNotPresent: "true"
packageName: petstore_api
diff --git a/bin/configs/python-oas2_disallowAdditionalPropertiesIfNotPresent.yaml b/bin/configs/python-oas2_disallowAdditionalPropertiesIfNotPresent.yaml
new file mode 100644
index 000000000000..841cf77854eb
--- /dev/null
+++ b/bin/configs/python-oas2_disallowAdditionalPropertiesIfNotPresent.yaml
@@ -0,0 +1,7 @@
+generatorName: python
+outputDir: samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent
+inputSpec: modules/openapi-generator/src/test/resources/2_0/python-client-experimental/petstore-with-fake-endpoints-models-for-testing.yaml
+templateDir: modules/openapi-generator/src/main/resources/python
+additionalProperties:
+ disallowAdditionalPropertiesIfNotPresent: "true"
+ packageName: petstore_api
diff --git a/docs/generators/python.md b/docs/generators/python.md
index 4cf503ff2786..fe60f0e511c7 100644
--- a/docs/generators/python.md
+++ b/docs/generators/python.md
@@ -7,6 +7,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
| Option | Description | Values | Default |
| ------ | ----------- | ------ | ------- |
+|disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|
- **false**
- The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.
- **true**
- Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default. NOTE: this option breaks composition and will be removed in 6.0.0
|false|
|generateSourceCodeOnly|Specifies that only a library source code is to be generated.| |false|
|hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true|
|library|library template (sub-template) to use: asyncio, tornado, urllib3| |urllib3|
@@ -28,7 +29,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
| Type/Alias | Instantiated By |
| ---------- | --------------- |
-|map|dict|
## LANGUAGE PRIMITIVES
diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonClientCodegen.java
index 1d51e2a0b7cc..6bb83c1b244a 100644
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonClientCodegen.java
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonClientCodegen.java
@@ -65,10 +65,6 @@ public PythonClientCodegen() {
// in other code generators, support needs to be enabled on a case-by-case basis.
supportsAdditionalPropertiesWithComposedSchema = true;
- // When the 'additionalProperties' keyword is not present in a OAS schema, allow
- // undeclared properties. This is compliant with the JSON schema specification.
- this.setDisallowAdditionalPropertiesIfNotPresent(false);
-
modifyFeatureSet(features -> features
.includeDocumentationFeatures(DocumentationFeature.Readme)
.wireFormatFeatures(EnumSet.of(WireFormatFeature.JSON, WireFormatFeature.XML, WireFormatFeature.Custom))
@@ -94,9 +90,8 @@ public PythonClientCodegen() {
ParameterFeature.Cookie
)
);
-
- // this may set datatype right for additional properties
- instantiationTypes.put("map", "dict");
+ // needed for type object with additionalProperties: false
+ typeMapping.put("object", "dict");
languageSpecificPrimitives.add("file_type");
languageSpecificPrimitives.add("none_type");
@@ -111,6 +106,20 @@ public PythonClientCodegen() {
cliOptions.add(new CliOption(CodegenConstants.PYTHON_ATTR_NONE_IF_UNSET, CodegenConstants.PYTHON_ATTR_NONE_IF_UNSET_DESC)
.defaultValue(Boolean.FALSE.toString()));
+ // option to change how we process + set the data in the 'additionalProperties' keyword.
+ CliOption disallowAdditionalPropertiesIfNotPresentOpt = CliOption.newBoolean(
+ CodegenConstants.DISALLOW_ADDITIONAL_PROPERTIES_IF_NOT_PRESENT,
+ CodegenConstants.DISALLOW_ADDITIONAL_PROPERTIES_IF_NOT_PRESENT_DESC).defaultValue(Boolean.FALSE.toString());
+ Map disallowAdditionalPropertiesIfNotPresentOpts = new HashMap<>();
+ disallowAdditionalPropertiesIfNotPresentOpts.put("false",
+ "The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.");
+ disallowAdditionalPropertiesIfNotPresentOpts.put("true",
+ "Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default. NOTE: "+
+ "this option breaks composition and will be removed in 6.0.0"
+ );
+ disallowAdditionalPropertiesIfNotPresentOpt.setEnum(disallowAdditionalPropertiesIfNotPresentOpts);
+ cliOptions.add(disallowAdditionalPropertiesIfNotPresentOpt);
+
generatorMetadata = GeneratorMetadata.newBuilder(generatorMetadata)
.stability(Stability.EXPERIMENTAL)
.build();
@@ -152,6 +161,18 @@ public void processOpts() {
}
additionalProperties.put("attrNoneIfUnset", attrNoneIfUnset);
+ // When the 'additionalProperties' keyword is not present in a OAS schema, allow
+ // undeclared properties. This is compliant with the JSON schema specification.
+ // setting this to false is required to have composed schemas work because:
+ // anyOf SchemaA + SchemaB, requires that props present only in A are accepted in B because in B
+ // they are additional properties
+ Boolean disallowAddProps = false;
+ if (additionalProperties.containsKey(CodegenConstants.DISALLOW_ADDITIONAL_PROPERTIES_IF_NOT_PRESENT)) {
+ disallowAddProps = Boolean.valueOf(additionalProperties.get(CodegenConstants.DISALLOW_ADDITIONAL_PROPERTIES_IF_NOT_PRESENT).toString());
+ }
+ this.setDisallowAdditionalPropertiesIfNotPresent(disallowAddProps);
+
+
// check library option to ensure only urllib3 is supported
if (!DEFAULT_LIBRARY.equals(getLibrary())) {
throw new RuntimeException("Only the `urllib3` library is supported in the refactored `python` client generator at the moment. Please fall back to `python-legacy` client generator for the time being. We welcome contributions to add back `asyncio`, `tornado` support to the `python` client generator.");
@@ -721,6 +742,62 @@ public String getModelName(Schema sc) {
return null;
}
+ @Override
+ protected Schema getAdditionalProperties(Schema schema) {
+ /*
+ Use cases:
+ 1. addProps set to schema in spec: return that schema
+ 2. addProps unset w/ getDisallowAdditionalPropertiesIfNotPresent -> null
+ 3. addProps unset w/ getDisallowAdditionalPropertiesIfNotPresent=False -> new Schema()
+ 4. addProps true -> new Schema() NOTE: v3 only
+ 5. addprops false -> null NOTE: v3 only
+ */
+ Object addProps = schema.getAdditionalProperties();
+ if (addProps instanceof Schema) {
+ return (Schema) addProps;
+ }
+ if (addProps == null) {
+ // When reaching this code path, this should indicate the 'additionalProperties' keyword is
+ // not present in the OAS schema. This is true for OAS 3.0 documents.
+ // However, the parsing logic is broken for OAS 2.0 documents because of the
+ // https://github.com/swagger-api/swagger-parser/issues/1369 issue.
+ // When OAS 2.0 documents are parsed, the swagger-v2-converter ignores the 'additionalProperties'
+ // keyword if the value is boolean. That means codegen is unable to determine whether
+ // additional properties are allowed or not.
+ //
+ // The original behavior was to assume additionalProperties had been set to false.
+ if (getDisallowAdditionalPropertiesIfNotPresent()) {
+ // If the 'additionalProperties' keyword is not present in a OAS schema,
+ // interpret as if the 'additionalProperties' keyword had been set to false.
+ // This is NOT compliant with the JSON schema specification. It is the original
+ // 'openapi-generator' behavior.
+ return null;
+ }
+ /*
+ // The disallowAdditionalPropertiesIfNotPresent CLI option has been set to true,
+ // but for now that only works with OAS 3.0 documents.
+ // The new behavior does not work with OAS 2.0 documents.
+ if (extensions == null || !extensions.containsKey(EXTENSION_OPENAPI_DOC_VERSION)) {
+ // Fallback to the legacy behavior.
+ return null;
+ }
+ // Get original swagger version from OAS extension.
+ // Note openAPI.getOpenapi() is always set to 3.x even when the document
+ // is converted from a OAS/Swagger 2.0 document.
+ // https://github.com/swagger-api/swagger-parser/pull/1374
+ SemVer version = new SemVer((String)extensions.get(EXTENSION_OPENAPI_DOC_VERSION));
+ if (version.major != 3) {
+ return null;
+ }
+ */
+ }
+ if (addProps == null || (addProps instanceof Boolean && (Boolean) addProps)) {
+ // Return empty schema to allow any type
+ return new Schema();
+ }
+ return null;
+ }
+
/**
* Return a string representation of the Python types for the specified OAS schema.
* Primitive types in the OAS specification are implemented in Python using the corresponding
@@ -760,16 +837,39 @@ private String getTypeString(Schema p, String prefix, String suffix, List both become use case 1
+ // switch to v3 if you need use cases 1 + 2 to work correctly
+ return prefix + "bool, date, datetime, dict, float, int, list, str, none_type" + fullSuffix;
+ }
// Resolve $ref because ModelUtils.isXYZ methods do not automatically resolve references.
if (ModelUtils.isNullable(ModelUtils.getReferencedSchema(this.openAPI, p))) {
fullSuffix = ", none_type" + suffix;
}
- if (isFreeFormObject(p) && getAdditionalProperties(p) == null) {
- return prefix + "bool, date, datetime, dict, float, int, list, str" + fullSuffix;
- }
- if ((ModelUtils.isMapSchema(p) || "object".equals(p.getType())) && getAdditionalProperties(p) != null) {
+ Boolean v3WithCompositionAddPropsAnyTypeSchemaCase = (getAdditionalProperties(p) != null && emptySchema.equals(getAdditionalProperties(p)) && originalSpecVersion.equals("3"));
+ if (isFreeFormObject(p) && v3WithCompositionAddPropsAnyTypeSchemaCase) {
+ // v3 code path, use case: type object schema with no other schema info
+ return prefix + "{str: (bool, date, datetime, dict, float, int, list, str, none_type)}" + fullSuffix;
+ } else if ((ModelUtils.isMapSchema(p) || "object".equals(p.getType())) && getAdditionalProperties(p) != null) {
Schema inner = getAdditionalProperties(p);
return prefix + "{str: " + getTypeString(inner, "(", ")", referencedModelNames) + "}" + fullSuffix;
} else if (ModelUtils.isArraySchema(p)) {
@@ -828,7 +928,7 @@ protected void addAdditionPropertiesToCodeGenModel(CodegenModel codegenModel, Sc
// The 'addProps' may be a reference, getTypeDeclaration will resolve
// the reference.
List referencedModelNames = new ArrayList();
- codegenModel.additionalPropertiesType = getTypeString(addProps, "", "", referencedModelNames);
+ getTypeString(addProps, "", "", referencedModelNames);
if (referencedModelNames.size() != 0) {
// Models that are referenced in the 'additionalPropertiesType' keyword
// must be added to the imports.
diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonLegacyClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonLegacyClientCodegen.java
index 1a79a3bc03ab..e99477c60888 100644
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonLegacyClientCodegen.java
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonLegacyClientCodegen.java
@@ -46,6 +46,7 @@ public class PythonLegacyClientCodegen extends AbstractPythonCodegen implements
// nose is a python testing framework, we use pytest if USE_NOSE is unset
public static final String USE_NOSE = "useNose";
public static final String RECURSION_LIMIT = "recursionLimit";
+ public static final String PYTHON_ATTR_NONE_IF_UNSET = "pythonAttrNoneIfUnset";
protected String packageUrl;
protected String apiDocPath = "docs/";
diff --git a/modules/openapi-generator/src/main/resources/python/model_doc.mustache b/modules/openapi-generator/src/main/resources/python/model_doc.mustache
index ff7358618ea5..3f7c8263df20 100644
--- a/modules/openapi-generator/src/main/resources/python/model_doc.mustache
+++ b/modules/openapi-generator/src/main/resources/python/model_doc.mustache
@@ -28,9 +28,9 @@ Name | Type | Description | Notes
{{#optionalVars}}
**{{name}}** | {{^complexType}}**{{dataType}}**{{/complexType}}{{#complexType}}[**{{dataType}}**]({{complexType}}.md){{/complexType}} | {{description}} | [optional] {{#isReadOnly}}[readonly] {{/isReadOnly}}{{#defaultValue}} if omitted the server will use the default value of {{{.}}}{{/defaultValue}}
{{/optionalVars}}
-{{#additionalPropertiesType}}
-**any string name** | **{{additionalPropertiesType}}** | any string name can be used but the value must be the correct type | [optional]
-{{/additionalPropertiesType}}
+{{#additionalProperties}}
+**any string name** | {{^complexType}}**{{dataType}}**{{/complexType}}{{#complexType}}[**{{dataType}}**]({{complexType}}.md){{/complexType}} | any string name can be used but the value must be the correct type | [optional]
+{{/additionalProperties}}
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/modules/openapi-generator/src/main/resources/python/model_templates/classvars.mustache b/modules/openapi-generator/src/main/resources/python/model_templates/classvars.mustache
index 88ae5df9f121..0e5ff25b97fb 100644
--- a/modules/openapi-generator/src/main/resources/python/model_templates/classvars.mustache
+++ b/modules/openapi-generator/src/main/resources/python/model_templates/classvars.mustache
@@ -60,7 +60,7 @@
{{/optionalVars}}
}
-{{#additionalPropertiesType}}
+{{#additionalProperties}}
@cached_property
def additional_properties_type():
"""
@@ -72,11 +72,11 @@
lazy_import()
{{/-first}}
{{/imports}}
- return ({{{additionalPropertiesType}}},) # noqa: E501
-{{/additionalPropertiesType}}
-{{^additionalPropertiesType}}
+ return ({{{dataType}}},) # noqa: E501
+{{/additionalProperties}}
+{{^additionalProperties}}
additional_properties_type = None
-{{/additionalPropertiesType}}
+{{/additionalProperties}}
_nullable = {{#isNullable}}True{{/isNullable}}{{^isNullable}}False{{/isNullable}}
diff --git a/modules/openapi-generator/src/main/resources/python/model_templates/method_init_composed.mustache b/modules/openapi-generator/src/main/resources/python/model_templates/method_init_composed.mustache
index 9b298379710c..ca0505ead969 100644
--- a/modules/openapi-generator/src/main/resources/python/model_templates/method_init_composed.mustache
+++ b/modules/openapi-generator/src/main/resources/python/model_templates/method_init_composed.mustache
@@ -10,7 +10,52 @@
'_additional_properties_model_instances',
])
-{{> model_templates/method_init_shared }}
+ @convert_js_args_to_python_args
+ def __init__(self, *args, **kwargs): # noqa: E501
+ """{{classname}} - a model defined in OpenAPI
+
+ Keyword Args:
+{{#requiredVars}}
+{{#defaultValue}}
+ {{name}} ({{{dataType}}}):{{#description}} {{{description}}}.{{/description}} defaults to {{{defaultValue}}}{{#allowableValues}}, must be one of [{{#enumVars}}{{{value}}}, {{/enumVars}}]{{/allowableValues}} # noqa: E501
+{{/defaultValue}}
+{{^defaultValue}}
+ {{name}} ({{{dataType}}}):{{#description}} {{{description}}}{{/description}}
+{{/defaultValue}}
+{{/requiredVars}}
+{{> model_templates/docstring_init_required_kwargs }}
+{{#optionalVars}}
+ {{name}} ({{{dataType}}}):{{#description}} {{{description}}}.{{/description}} [optional]{{#defaultValue}} if omitted the server will use the default value of {{{defaultValue}}}{{/defaultValue}} # noqa: E501
+{{/optionalVars}}
+ """
+
+{{#requiredVars}}
+{{#defaultValue}}
+ {{name}} = kwargs.get('{{name}}', {{{defaultValue}}})
+{{/defaultValue}}
+{{/requiredVars}}
+ _check_type = kwargs.pop('_check_type', True)
+ _spec_property_naming = kwargs.pop('_spec_property_naming', False)
+ _path_to_item = kwargs.pop('_path_to_item', ())
+ _configuration = kwargs.pop('_configuration', None)
+ _visited_composed_classes = kwargs.pop('_visited_composed_classes', ())
+
+ if args:
+ raise ApiTypeError(
+ "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % (
+ args,
+ self.__class__.__name__,
+ ),
+ path_to_item=_path_to_item,
+ valid_classes=(self.__class__,),
+ )
+
+ self._data_store = {}
+ self._check_type = _check_type
+ self._spec_property_naming = _spec_property_naming
+ self._path_to_item = _path_to_item
+ self._configuration = _configuration
+ self._visited_composed_classes = _visited_composed_classes + (self.__class__,)
constant_args = {
'_check_type': _check_type,
@@ -19,28 +64,18 @@
'_configuration': _configuration,
'_visited_composed_classes': self._visited_composed_classes,
}
- required_args = {
-{{#requiredVars}}
- '{{name}}': {{name}},
-{{/requiredVars}}
- }
- model_args = {}
- model_args.update(required_args)
- model_args.update(kwargs)
composed_info = validate_get_composed_info(
- constant_args, model_args, self)
+ constant_args, kwargs, self)
self._composed_instances = composed_info[0]
self._var_name_to_model_instances = composed_info[1]
self._additional_properties_model_instances = composed_info[2]
- unused_args = composed_info[3]
+ discarded_args = composed_info[3]
- for var_name, var_value in required_args.items():
- setattr(self, var_name, var_value)
for var_name, var_value in kwargs.items():
- if var_name in unused_args and \
+ if var_name in discarded_args and \
self._configuration is not None and \
self._configuration.discard_unknown_keys and \
- not self._additional_properties_model_instances:
+ self._additional_properties_model_instances:
# discard variable.
continue
setattr(self, var_name, var_value)
\ No newline at end of file
diff --git a/modules/openapi-generator/src/main/resources/python/model_templates/methods_setattr_getattr_composed.mustache b/modules/openapi-generator/src/main/resources/python/model_templates/methods_setattr_getattr_composed.mustache
index 6b1013ca997d..de7887ebdbda 100644
--- a/modules/openapi-generator/src/main/resources/python/model_templates/methods_setattr_getattr_composed.mustache
+++ b/modules/openapi-generator/src/main/resources/python/model_templates/methods_setattr_getattr_composed.mustache
@@ -4,27 +4,43 @@
self.__dict__[name] = value
return
- # set the attribute on the correct instance
- model_instances = self._var_name_to_model_instances.get(
- name, self._additional_properties_model_instances)
- if model_instances:
- for model_instance in model_instances:
- if model_instance == self:
- self.set_attribute(name, value)
- else:
- setattr(model_instance, name, value)
- if name not in self._var_name_to_model_instances:
- # we assigned an additional property
- self.__dict__['_var_name_to_model_instances'][name] = (
- model_instance
- )
- return None
+ """
+ Use cases:
+ 1. additional_properties_type is None (additionalProperties == False in spec)
+ Check for property presence in self.openapi_types
+ if not present then throw an error
+ if present set in self, set attribute
+ always set on composed schemas
+ 2. additional_properties_type exists
+ set attribute on self
+ always set on composed schemas
+ """
+ if self.additional_properties_type is None:
+ """
+ For an attribute to exist on a composed schema it must:
+ - fulfill schema_requirements in the self composed schema not considering oneOf/anyOf/allOf schemas AND
+ - fulfill schema_requirements in each oneOf/anyOf/allOf schemas
- raise ApiAttributeError(
- "{0} has no attribute '{1}'".format(
- type(self).__name__, name),
- [e for e in [self._path_to_item, name] if e]
- )
+ schema_requirements:
+ For an attribute to exist on a schema it must:
+ - be present in properties at the schema OR
+ - have additionalProperties unset (defaults additionalProperties = any type) OR
+ - have additionalProperties set
+ """
+ if name not in self.openapi_types:
+ raise ApiAttributeError(
+ "{0} has no attribute '{1}'".format(
+ type(self).__name__, name),
+ [e for e in [self._path_to_item, name] if e]
+ )
+ # attribute must be set on self and composed instances
+ self.set_attribute(name, value)
+ for model_instance in self._composed_instances:
+ setattr(model_instance, name, value)
+ if name not in self._var_name_to_model_instances:
+ # we assigned an additional property
+ self.__dict__['_var_name_to_model_instances'][name] = self._composed_instances + [self]
+ return None
__unset_attribute_value__ = object()
@@ -34,13 +50,12 @@
return self.__dict__[name]
# get the attribute from the correct instance
- model_instances = self._var_name_to_model_instances.get(
- name, self._additional_properties_model_instances)
+ model_instances = self._var_name_to_model_instances.get(name)
values = []
- # A composed model stores child (oneof/anyOf/allOf) models under
- # self._var_name_to_model_instances. A named property can exist in
- # multiple child models. If the property is present in more than one
- # child model, the value must be the same across all the child models.
+ # A composed model stores self and child (oneof/anyOf/allOf) models under
+ # self._var_name_to_model_instances.
+ # Any property must exist in self and all model instances
+ # The value stored in all model instances must be the same
if model_instances:
for model_instance in model_instances:
if name in model_instance._data_store:
diff --git a/modules/openapi-generator/src/main/resources/python/model_utils.mustache b/modules/openapi-generator/src/main/resources/python/model_utils.mustache
index 07b77a99d18c..9b5a8dd9e811 100644
--- a/modules/openapi-generator/src/main/resources/python/model_utils.mustache
+++ b/modules/openapi-generator/src/main/resources/python/model_utils.mustache
@@ -1291,8 +1291,13 @@ def get_allof_instances(self, model_args, constant_args):
self: the class we are handling
model_args (dict): var_name to var_value
used to make instances
- constant_args (dict): var_name to var_value
- used to make instances
+ constant_args (dict):
+ metadata arguments:
+ _check_type
+ _path_to_item
+ _spec_property_naming
+ _configuration
+ _visited_composed_classes
Returns
composed_instances (list)
@@ -1300,20 +1305,8 @@ def get_allof_instances(self, model_args, constant_args):
composed_instances = []
for allof_class in self._composed_schemas['allOf']:
- # no need to handle changing js keys to python because
- # for composed schemas, allof parameters are included in the
- # composed schema and were changed to python keys in __new__
- # extract a dict of only required keys from fixed_model_args
- kwargs = {}
- var_names = set(allof_class.openapi_types.keys())
- for var_name in var_names:
- if var_name in model_args:
- kwargs[var_name] = model_args[var_name]
-
- # and use it to make the instance
- kwargs.update(constant_args)
try:
- allof_instance = allof_class(**kwargs)
+ allof_instance = allof_class(**model_args, **constant_args)
composed_instances.append(allof_instance)
except Exception as ex:
raise ApiValueError(
@@ -1373,31 +1366,9 @@ def get_oneof_instance(cls, model_kwargs, constant_kwargs, model_arg=None):
single_value_input = allows_single_value_input(oneof_class)
- if not single_value_input:
- # transform js keys from input data to python keys in fixed_model_args
- fixed_model_args = change_keys_js_to_python(
- model_kwargs, oneof_class)
-
- # Extract a dict with the properties that are declared in the oneOf schema.
- # Undeclared properties (e.g. properties that are allowed because of the
- # additionalProperties attribute in the OAS document) are not added to
- # the dict.
- kwargs = {}
- var_names = set(oneof_class.openapi_types.keys())
- for var_name in var_names:
- if var_name in fixed_model_args:
- kwargs[var_name] = fixed_model_args[var_name]
-
- # do not try to make a model with no input args
- if len(kwargs) == 0:
- continue
-
- # and use it to make the instance
- kwargs.update(constant_kwargs)
-
try:
if not single_value_input:
- oneof_instance = oneof_class(**kwargs)
+ oneof_instance = oneof_class(**model_kwargs, **constant_kwargs)
else:
if issubclass(oneof_class, ModelSimple):
oneof_instance = oneof_class(model_arg, **constant_kwargs)
@@ -1454,24 +1425,8 @@ def get_anyof_instances(self, model_args, constant_args):
# none_type deserialization is handled in the __new__ method
continue
- # transform js keys to python keys in fixed_model_args
- fixed_model_args = change_keys_js_to_python(model_args, anyof_class)
-
- # extract a dict of only required keys from these_model_vars
- kwargs = {}
- var_names = set(anyof_class.openapi_types.keys())
- for var_name in var_names:
- if var_name in fixed_model_args:
- kwargs[var_name] = fixed_model_args[var_name]
-
- # do not try to make a model with no input args
- if len(kwargs) == 0:
- continue
-
- # and use it to make the instance
- kwargs.update(constant_args)
try:
- anyof_instance = anyof_class(**kwargs)
+ anyof_instance = anyof_class(**model_args, **constant_args)
anyof_instances.append(anyof_instance)
except Exception:
pass
@@ -1484,47 +1439,34 @@ def get_anyof_instances(self, model_args, constant_args):
return anyof_instances
-def get_additional_properties_model_instances(
- composed_instances, self):
- additional_properties_model_instances = []
- all_instances = [self]
- all_instances.extend(composed_instances)
- for instance in all_instances:
- if instance.additional_properties_type is not None:
- additional_properties_model_instances.append(instance)
- return additional_properties_model_instances
-
-
-def get_var_name_to_model_instances(self, composed_instances):
- var_name_to_model_instances = {}
- all_instances = [self]
- all_instances.extend(composed_instances)
- for instance in all_instances:
- for var_name in instance.openapi_types:
- if var_name not in var_name_to_model_instances:
- var_name_to_model_instances[var_name] = [instance]
- else:
- var_name_to_model_instances[var_name].append(instance)
- return var_name_to_model_instances
-
-
-def get_unused_args(self, composed_instances, model_args):
- unused_args = dict(model_args)
- # arguments apssed to self were already converted to python names
+def get_discarded_args(self, composed_instances, model_args):
+ """
+ Gathers the args that were discarded by configuration.discard_unknown_keys
+ """
+ model_arg_keys = model_args.keys()
+ discarded_args = set()
+ # arguments passed to self were already converted to python names
# before __init__ was called
- for var_name_py in self.attribute_map:
- if var_name_py in unused_args:
- del unused_args[var_name_py]
for instance in composed_instances:
if instance.__class__ in self._composed_schemas['allOf']:
- for var_name_py in instance.attribute_map:
- if var_name_py in unused_args:
- del unused_args[var_name_py]
+ try:
+ keys = instance.to_dict().keys()
+ discarded_keys = model_args - keys
+ discarded_args.update(discarded_keys)
+ except Exception:
+ # allOf integer schema will throw exception
+ pass
else:
- for var_name_js in instance.attribute_map.values():
- if var_name_js in unused_args:
- del unused_args[var_name_js]
- return unused_args
+ try:
+ all_keys = set(model_to_dict(instance, serialize=False).keys())
+ js_keys = model_to_dict(instance, serialize=True).keys()
+ all_keys.update(js_keys)
+ discarded_keys = model_arg_keys - all_keys
+ discarded_args.update(discarded_keys)
+ except Exception:
+ # allOf integer schema will throw exception
+ pass
+ return discarded_args
def validate_get_composed_info(constant_args, model_args, self):
@@ -1568,36 +1510,42 @@ def validate_get_composed_info(constant_args, model_args, self):
composed_instances.append(oneof_instance)
anyof_instances = get_anyof_instances(self, model_args, constant_args)
composed_instances.extend(anyof_instances)
+ """
+ set additional_properties_model_instances
+ additional properties must be evaluated at the schema level
+ so self's additional properties are most important
+ If self is a composed schema with:
+ - no properties defined in self
+ - additionalProperties: False
+ Then for object payloads every property is an additional property
+ and they are not allowed, so only empty dict is allowed
+
+ Properties must be set on all matching schemas
+ so when a property is assigned toa composed instance, it must be set on all
+ composed instances regardless of additionalProperties presence
+ keeping it to prevent breaking changes in v5.0.1
+ TODO remove cls._additional_properties_model_instances in 6.0.0
+ """
+ additional_properties_model_instances = []
+ if self.additional_properties_type is not None:
+ additional_properties_model_instances = [self]
- # map variable names to composed_instances
- var_name_to_model_instances = get_var_name_to_model_instances(
- self, composed_instances)
-
- # set additional_properties_model_instances
- additional_properties_model_instances = (
- get_additional_properties_model_instances(composed_instances, self)
- )
-
- # set any remaining values
- unused_args = get_unused_args(self, composed_instances, model_args)
- if len(unused_args) > 0 and \
- len(additional_properties_model_instances) == 0 and \
- (self._configuration is None or
- not self._configuration.discard_unknown_keys):
- raise ApiValueError(
- "Invalid input arguments input when making an instance of "
- "class %s. Not all inputs were used. The unused input data "
- "is %s" % (self.__class__.__name__, unused_args)
- )
+ """
+ no need to set properties on self in here, they will be set in __init__
+ By here all composed schema oneOf/anyOf/allOf instances have their properties set using
+ model_args
+ """
+ discarded_args = get_discarded_args(self, composed_instances, model_args)
- # no need to add additional_properties to var_name_to_model_instances here
- # because additional_properties_model_instances will direct us to that
- # instance when we use getattr or setattr
- # and we update var_name_to_model_instances in setattr
+ # map variable names to composed_instances
+ var_name_to_model_instances = {}
+ for prop_name in model_args:
+ if prop_name not in discarded_args:
+ var_name_to_model_instances[prop_name] = [self] + composed_instances
return [
composed_instances,
var_name_to_model_instances,
additional_properties_model_instances,
- unused_args
+ discarded_args
]
diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/PythonClientOptionsProvider.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/PythonClientOptionsProvider.java
index 7beb3ec69c0d..fc7d74074dd8 100644
--- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/PythonClientOptionsProvider.java
+++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/PythonClientOptionsProvider.java
@@ -19,7 +19,7 @@
import com.google.common.collect.ImmutableMap;
import org.openapitools.codegen.CodegenConstants;
-import org.openapitools.codegen.languages.PythonLegacyClientCodegen;
+import org.openapitools.codegen.languages.PythonClientCodegen;
import java.util.Map;
@@ -30,6 +30,8 @@ public class PythonClientOptionsProvider implements OptionsProvider {
public static final String PACKAGE_URL_VALUE = "";
public static final String USE_NOSE_VALUE = "false";
public static final String RECURSION_LIMIT = "1200";
+ public static final String DISALLOW_ADDITIONAL_PROPERTIES_IF_NOT_PRESENT = "false";
+ public static final String PYTHON_ATTR_NONE_IF_UNSET = "false";
@Override
public String getLanguage() {
@@ -39,16 +41,17 @@ public String getLanguage() {
@Override
public Map createOptions() {
ImmutableMap.Builder builder = new ImmutableMap.Builder();
- return builder.put(PythonLegacyClientCodegen.PACKAGE_URL, PACKAGE_URL_VALUE)
+ return builder.put(PythonClientCodegen.PACKAGE_URL, PACKAGE_URL_VALUE)
.put(CodegenConstants.PACKAGE_NAME, PACKAGE_NAME_VALUE)
.put(CodegenConstants.PROJECT_NAME, PROJECT_NAME_VALUE)
.put(CodegenConstants.PACKAGE_VERSION, PACKAGE_VERSION_VALUE)
- .put(CodegenConstants.SORT_PARAMS_BY_REQUIRED_FLAG, "true")
.put(CodegenConstants.HIDE_GENERATION_TIMESTAMP, "true")
.put(CodegenConstants.SOURCECODEONLY_GENERATION, "false")
.put(CodegenConstants.LIBRARY, "urllib3")
- .put(PythonLegacyClientCodegen.USE_NOSE, USE_NOSE_VALUE)
- .put(PythonLegacyClientCodegen.RECURSION_LIMIT, RECURSION_LIMIT)
+ .put(CodegenConstants.DISALLOW_ADDITIONAL_PROPERTIES_IF_NOT_PRESENT, DISALLOW_ADDITIONAL_PROPERTIES_IF_NOT_PRESENT)
+ .put(PythonClientCodegen.USE_NOSE, USE_NOSE_VALUE)
+ .put(PythonClientCodegen.RECURSION_LIMIT, RECURSION_LIMIT)
+ .put(PythonClientCodegen.PYTHON_ATTR_NONE_IF_UNSET, PYTHON_ATTR_NONE_IF_UNSET)
.build();
}
diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/PythonLegacyClientOptionsProvider.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/PythonLegacyClientOptionsProvider.java
new file mode 100644
index 000000000000..90e76caea16f
--- /dev/null
+++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/PythonLegacyClientOptionsProvider.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech)
+ * Copyright 2018 SmartBear Software
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.openapitools.codegen.options;
+
+import com.google.common.collect.ImmutableMap;
+import org.openapitools.codegen.CodegenConstants;
+import org.openapitools.codegen.languages.PythonLegacyClientCodegen;
+
+import java.util.Map;
+
+public class PythonLegacyClientOptionsProvider implements OptionsProvider {
+ public static final String PACKAGE_NAME_VALUE = "swagger_client_python";
+ public static final String PROJECT_NAME_VALUE = "swagger-client-python";
+ public static final String PACKAGE_VERSION_VALUE = "1.0.0-SNAPSHOT";
+ public static final String PACKAGE_URL_VALUE = "";
+ public static final String USE_NOSE_VALUE = "false";
+ public static final String RECURSION_LIMIT = "1200";
+
+ @Override
+ public String getLanguage() {
+ return "python";
+ }
+
+ @Override
+ public Map createOptions() {
+ ImmutableMap.Builder builder = new ImmutableMap.Builder();
+ return builder.put(PythonLegacyClientCodegen.PACKAGE_URL, PACKAGE_URL_VALUE)
+ .put(CodegenConstants.PACKAGE_NAME, PACKAGE_NAME_VALUE)
+ .put(CodegenConstants.PROJECT_NAME, PROJECT_NAME_VALUE)
+ .put(CodegenConstants.PACKAGE_VERSION, PACKAGE_VERSION_VALUE)
+ .put(CodegenConstants.SORT_PARAMS_BY_REQUIRED_FLAG, "true")
+ .put(CodegenConstants.HIDE_GENERATION_TIMESTAMP, "true")
+ .put(CodegenConstants.SOURCECODEONLY_GENERATION, "false")
+ .put(CodegenConstants.LIBRARY, "urllib3")
+ .put(PythonLegacyClientCodegen.USE_NOSE, USE_NOSE_VALUE)
+ .put(PythonLegacyClientCodegen.RECURSION_LIMIT, RECURSION_LIMIT)
+ .build();
+ }
+
+ @Override
+ public boolean isServer() {
+ return false;
+ }
+}
diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/python/PythonClientOptionsTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/python/PythonClientOptionsTest.java
index 8bec98892ef6..e423c6e85842 100644
--- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/python/PythonClientOptionsTest.java
+++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/python/PythonClientOptionsTest.java
@@ -19,7 +19,7 @@
import org.openapitools.codegen.AbstractOptionsTest;
import org.openapitools.codegen.CodegenConfig;
-import org.openapitools.codegen.languages.PythonLegacyClientCodegen;
+import org.openapitools.codegen.languages.PythonClientCodegen;
import org.openapitools.codegen.options.PythonClientOptionsProvider;
import org.testng.Assert;
@@ -29,7 +29,7 @@
import static org.mockito.Mockito.verify;
public class PythonClientOptionsTest extends AbstractOptionsTest {
- private PythonLegacyClientCodegen clientCodegen = mock(PythonLegacyClientCodegen.class, mockSettings);
+ private PythonClientCodegen clientCodegen = mock(PythonClientCodegen.class, mockSettings);
public PythonClientOptionsTest() {
super(new PythonClientOptionsProvider());
diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/python/PythonLegacyClientOptionsTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/python/PythonLegacyClientOptionsTest.java
new file mode 100644
index 000000000000..8c17cdbb2fd8
--- /dev/null
+++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/python/PythonLegacyClientOptionsTest.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech)
+ * Copyright 2018 SmartBear Software
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.openapitools.codegen.python;
+
+import org.openapitools.codegen.AbstractOptionsTest;
+import org.openapitools.codegen.CodegenConfig;
+import org.openapitools.codegen.languages.PythonLegacyClientCodegen;
+import org.openapitools.codegen.options.PythonLegacyClientOptionsProvider;
+import org.testng.Assert;
+
+import java.io.File;
+
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+
+public class PythonLegacyClientOptionsTest extends AbstractOptionsTest {
+ private PythonLegacyClientCodegen clientCodegen = mock(PythonLegacyClientCodegen.class, mockSettings);
+
+ public PythonLegacyClientOptionsTest() {
+ super(new PythonLegacyClientOptionsProvider());
+ }
+
+ @Override
+ protected CodegenConfig getCodegenConfig() {
+ return clientCodegen;
+ }
+
+ @SuppressWarnings("unused")
+ @Override
+ protected void verifyOptions() {
+ Assert.assertEquals(clientCodegen.packagePath(), PythonLegacyClientOptionsProvider.PACKAGE_NAME_VALUE.replace('.', File.separatorChar));
+
+ verify(clientCodegen).setPackageName(PythonLegacyClientOptionsProvider.PACKAGE_NAME_VALUE);
+ verify(clientCodegen).setProjectName(PythonLegacyClientOptionsProvider.PROJECT_NAME_VALUE);
+ verify(clientCodegen).setPackageVersion(PythonLegacyClientOptionsProvider.PACKAGE_VERSION_VALUE);
+ verify(clientCodegen).setPackageUrl(PythonLegacyClientOptionsProvider.PACKAGE_URL_VALUE);
+ verify(clientCodegen).setUseNose(PythonLegacyClientOptionsProvider.USE_NOSE_VALUE);
+ }
+}
diff --git a/modules/openapi-generator/src/test/resources/2_0/python-client-experimental/petstore-with-fake-endpoints-models-for-testing.yaml b/modules/openapi-generator/src/test/resources/2_0/python-client-experimental/petstore-with-fake-endpoints-models-for-testing.yaml
index 9e9451dcc5be..097ae6768bb7 100644
--- a/modules/openapi-generator/src/test/resources/2_0/python-client-experimental/petstore-with-fake-endpoints-models-for-testing.yaml
+++ b/modules/openapi-generator/src/test/resources/2_0/python-client-experimental/petstore-with-fake-endpoints-models-for-testing.yaml
@@ -1373,8 +1373,6 @@ definitions:
properties:
breed:
type: string
- additionalProperties: false
- additionalProperties: false
Cat:
allOf:
- $ref: '#/definitions/Animal'
@@ -1523,8 +1521,7 @@ definitions:
type: object
additionalProperties:
type: array
- items:
- type: object
+ items: {}
map_map_string:
type: object
additionalProperties:
@@ -1535,14 +1532,15 @@ definitions:
type: object
additionalProperties:
type: object
- additionalProperties:
- type: object
- anytype_1:
- type: object
- anytype_2: {}
+ additionalProperties: {}
+ anytype_1: {}
+ anytype_2:
+ description: no type is set for this
anytype_3:
type: object
properties: {}
+ description: 'because of a bug in swagger-parser, this should have values {str: (str, int, float...)}
+ but instead we get any type. See https://github.com/swagger-api/swagger-parser/issues/1378'
AdditionalPropertiesString:
type: object
properties:
@@ -2091,7 +2089,6 @@ definitions:
properties:
interNet:
type: boolean
- additionalProperties: false
GrandparentAnimal:
type: object
required:
diff --git a/modules/openapi-generator/src/test/resources/3_0/python/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml b/modules/openapi-generator/src/test/resources/3_0/python/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml
index bd29a22a5f9b..631e09dab8aa 100644
--- a/modules/openapi-generator/src/test/resources/3_0/python/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml
+++ b/modules/openapi-generator/src/test/resources/3_0/python/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml
@@ -1584,7 +1584,6 @@ components:
Cat:
allOf:
- $ref: '#/components/schemas/Animal'
- - $ref: '#/components/schemas/Address'
- type: object
properties:
declawed:
@@ -2037,6 +2036,9 @@ components:
items:
type: object
nullable: true
+ object_nullable:
+ type: object
+ nullable: true
object_nullable_prop:
type: object
nullable: true
@@ -2054,18 +2056,27 @@ components:
type: object
nullable: true
additionalProperties:
- type: object
nullable: true
+ ComposedSchemaWithPropsAndNoAddProps:
+ properties:
+ color:
+ type: string
+ allOf:
+ - $ref: '#/components/schemas/Tag'
+ # Below additionalProperties is set to false to validate the use
+ # case when a composed schema has additionalProperties set to false.
+ # This definition will only allow in object payloads that set color and no other properties because
+ # additionalProperties are evaluated at the schema level and do not include composed schema
+ # properties. Only color is defined here, all others are additional
+ additionalProperties: false
fruit:
+ description: a schema that tests oneOf and includes a schema level property
properties:
color:
type: string
oneOf:
- $ref: '#/components/schemas/apple'
- $ref: '#/components/schemas/banana'
- # Below additionalProperties is set to false to validate the use
- # case when a composed schema has additionalProperties set to false.
- additionalProperties: false
apple:
type: object
properties:
@@ -2075,12 +2086,16 @@ components:
origin:
type: string
pattern: /^[A-Z\s]*$/i
+ required:
+ - cultivar
nullable: true
banana:
type: object
properties:
lengthCm:
type: number
+ required:
+ - lengthCm
mammal:
oneOf:
- $ref: '#/components/schemas/whale'
@@ -2140,13 +2155,13 @@ components:
anyOf:
- $ref: '#/components/schemas/apple'
- $ref: '#/components/schemas/banana'
- additionalProperties: false
fruitReq:
+ description: a schema where additionalProperties is on in the composed schema and off in the oneOf object schemas
+ also, this schem accepts null as a value
oneOf:
- type: 'null'
- $ref: '#/components/schemas/appleReq'
- $ref: '#/components/schemas/bananaReq'
- additionalProperties: false
appleReq:
type: object
properties:
@@ -2250,7 +2265,6 @@ components:
allOf:
- $ref: '#/components/schemas/ShapeInterface'
- $ref: '#/components/schemas/TriangleInterface'
- additionalProperties: false
ScaleneTriangle:
allOf:
- $ref: '#/components/schemas/ShapeInterface'
diff --git a/pom.xml b/pom.xml
index 3d2ab30975f6..e9eddebb017b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1206,6 +1206,7 @@
samples/client/petstore/javascript-flowtyped
samples/client/petstore/python
+ samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent
samples/client/petstore/python-legacy
samples/client/petstore/python-asyncio
samples/client/petstore/python-tornado
diff --git a/samples/client/petstore/python/docs/AdditionalPropertiesAnyType.md b/samples/client/petstore/python/docs/AdditionalPropertiesAnyType.md
index a69ff4928f44..d31d12de0822 100644
--- a/samples/client/petstore/python/docs/AdditionalPropertiesAnyType.md
+++ b/samples/client/petstore/python/docs/AdditionalPropertiesAnyType.md
@@ -5,7 +5,7 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**name** | **str** | | [optional]
-**any string name** | **bool, date, datetime, dict, float, int, list, str** | any string name can be used but the value must be the correct type | [optional]
+**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/client/petstore/python/docs/AdditionalPropertiesArray.md b/samples/client/petstore/python/docs/AdditionalPropertiesArray.md
index 697494b373ff..40537cbf8384 100644
--- a/samples/client/petstore/python/docs/AdditionalPropertiesArray.md
+++ b/samples/client/petstore/python/docs/AdditionalPropertiesArray.md
@@ -5,7 +5,7 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**name** | **str** | | [optional]
-**any string name** | **[bool, date, datetime, dict, float, int, list, str]** | any string name can be used but the value must be the correct type | [optional]
+**any string name** | **[bool, date, datetime, dict, float, int, list, str, none_type]** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/client/petstore/python/docs/AdditionalPropertiesClass.md b/samples/client/petstore/python/docs/AdditionalPropertiesClass.md
index 3646837b853b..3ba7bab6f3d0 100644
--- a/samples/client/petstore/python/docs/AdditionalPropertiesClass.md
+++ b/samples/client/petstore/python/docs/AdditionalPropertiesClass.md
@@ -9,12 +9,13 @@ Name | Type | Description | Notes
**map_integer** | **{str: (int,)}** | | [optional]
**map_boolean** | **{str: (bool,)}** | | [optional]
**map_array_integer** | **{str: ([int],)}** | | [optional]
-**map_array_anytype** | **{str: ([bool, date, datetime, dict, float, int, list, str],)}** | | [optional]
+**map_array_anytype** | **{str: ([bool, date, datetime, dict, float, int, list, str, none_type],)}** | | [optional]
**map_map_string** | **{str: ({str: (str,)},)}** | | [optional]
-**map_map_anytype** | **{str: ({str: (bool, date, datetime, dict, float, int, list, str,)},)}** | | [optional]
-**anytype_1** | **bool, date, datetime, dict, float, int, list, str** | | [optional]
-**anytype_2** | **bool, date, datetime, dict, float, int, list, str** | | [optional]
-**anytype_3** | **bool, date, datetime, dict, float, int, list, str** | | [optional]
+**map_map_anytype** | **{str: ({str: (bool, date, datetime, dict, float, int, list, str, none_type,)},)}** | | [optional]
+**anytype_1** | **bool, date, datetime, dict, float, int, list, str, none_type** | | [optional]
+**anytype_2** | **bool, date, datetime, dict, float, int, list, str, none_type** | no type is set for this | [optional]
+**anytype_3** | **bool, date, datetime, dict, float, int, list, str, none_type** | because of a bug in swagger-parser, this should have values {str: (str, int, float...)} but instead we get any type. See https://github.com/swagger-api/swagger-parser/issues/1378 | [optional]
+**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/client/petstore/python/docs/AdditionalPropertiesObject.md b/samples/client/petstore/python/docs/AdditionalPropertiesObject.md
index 73ba59147122..dc64a0d91c24 100644
--- a/samples/client/petstore/python/docs/AdditionalPropertiesObject.md
+++ b/samples/client/petstore/python/docs/AdditionalPropertiesObject.md
@@ -5,7 +5,7 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**name** | **str** | | [optional]
-**any string name** | **{str: (bool, date, datetime, dict, float, int, list, str,)}** | any string name can be used but the value must be the correct type | [optional]
+**any string name** | **{str: (bool, date, datetime, dict, float, int, list, str, none_type,)}** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/client/petstore/python/docs/Animal.md b/samples/client/petstore/python/docs/Animal.md
index 1d1c77c01abc..d36c66a5d882 100644
--- a/samples/client/petstore/python/docs/Animal.md
+++ b/samples/client/petstore/python/docs/Animal.md
@@ -6,6 +6,7 @@ Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**class_name** | **str** | |
**color** | **str** | | [optional] if omitted the server will use the default value of "red"
+**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/client/petstore/python/docs/AnimalFarm.md b/samples/client/petstore/python/docs/AnimalFarm.md
index fc299cf27d34..fb3b33c9c9c2 100644
--- a/samples/client/petstore/python/docs/AnimalFarm.md
+++ b/samples/client/petstore/python/docs/AnimalFarm.md
@@ -5,6 +5,7 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**value** | [**[Animal]**](Animal.md) | |
+**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/client/petstore/python/docs/ApiResponse.md b/samples/client/petstore/python/docs/ApiResponse.md
index 81a7d0d85227..bedefea9a9cb 100644
--- a/samples/client/petstore/python/docs/ApiResponse.md
+++ b/samples/client/petstore/python/docs/ApiResponse.md
@@ -7,6 +7,7 @@ Name | Type | Description | Notes
**code** | **int** | | [optional]
**type** | **str** | | [optional]
**message** | **str** | | [optional]
+**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/client/petstore/python/docs/ArrayOfArrayOfNumberOnly.md b/samples/client/petstore/python/docs/ArrayOfArrayOfNumberOnly.md
index 6ab77963788b..11cd25c98ee4 100644
--- a/samples/client/petstore/python/docs/ArrayOfArrayOfNumberOnly.md
+++ b/samples/client/petstore/python/docs/ArrayOfArrayOfNumberOnly.md
@@ -5,6 +5,7 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**array_array_number** | **[[float]]** | | [optional]
+**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/client/petstore/python/docs/ArrayOfNumberOnly.md b/samples/client/petstore/python/docs/ArrayOfNumberOnly.md
index ebc65a54ba7e..1e9bb12e4e8b 100644
--- a/samples/client/petstore/python/docs/ArrayOfNumberOnly.md
+++ b/samples/client/petstore/python/docs/ArrayOfNumberOnly.md
@@ -5,6 +5,7 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**array_number** | **[float]** | | [optional]
+**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/client/petstore/python/docs/ArrayTest.md b/samples/client/petstore/python/docs/ArrayTest.md
index 4e1bda8fc3af..9eac1f8874c4 100644
--- a/samples/client/petstore/python/docs/ArrayTest.md
+++ b/samples/client/petstore/python/docs/ArrayTest.md
@@ -7,6 +7,7 @@ Name | Type | Description | Notes
**array_of_string** | **[str]** | | [optional]
**array_array_of_integer** | **[[int]]** | | [optional]
**array_array_of_model** | [**[[ReadOnlyFirst]]**](ReadOnlyFirst.md) | | [optional]
+**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/client/petstore/python/docs/Capitalization.md b/samples/client/petstore/python/docs/Capitalization.md
index 1ddeadeb3f46..df9989f8db57 100644
--- a/samples/client/petstore/python/docs/Capitalization.md
+++ b/samples/client/petstore/python/docs/Capitalization.md
@@ -10,6 +10,7 @@ Name | Type | Description | Notes
**capital_snake** | **str** | | [optional]
**sca_eth_flow_points** | **str** | | [optional]
**att_name** | **str** | Name of the pet | [optional]
+**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/client/petstore/python/docs/Cat.md b/samples/client/petstore/python/docs/Cat.md
index e9ce235cd632..082715a28421 100644
--- a/samples/client/petstore/python/docs/Cat.md
+++ b/samples/client/petstore/python/docs/Cat.md
@@ -7,6 +7,7 @@ Name | Type | Description | Notes
**class_name** | **str** | |
**declawed** | **bool** | | [optional]
**color** | **str** | | [optional] if omitted the server will use the default value of "red"
+**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/client/petstore/python/docs/CatAllOf.md b/samples/client/petstore/python/docs/CatAllOf.md
index 0ff7809a99ac..6fd1390a749b 100644
--- a/samples/client/petstore/python/docs/CatAllOf.md
+++ b/samples/client/petstore/python/docs/CatAllOf.md
@@ -5,6 +5,7 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**declawed** | **bool** | | [optional]
+**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/client/petstore/python/docs/Category.md b/samples/client/petstore/python/docs/Category.md
index 940f6a45e641..7650eccafba5 100644
--- a/samples/client/petstore/python/docs/Category.md
+++ b/samples/client/petstore/python/docs/Category.md
@@ -6,6 +6,7 @@ Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**name** | **str** | | defaults to "default-name"
**id** | **int** | | [optional]
+**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/client/petstore/python/docs/Child.md b/samples/client/petstore/python/docs/Child.md
index eb4392445710..6bf6903fb203 100644
--- a/samples/client/petstore/python/docs/Child.md
+++ b/samples/client/petstore/python/docs/Child.md
@@ -7,6 +7,7 @@ Name | Type | Description | Notes
**radio_waves** | **bool** | | [optional]
**tele_vision** | **bool** | | [optional]
**inter_net** | **bool** | | [optional]
+**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/client/petstore/python/docs/ChildAllOf.md b/samples/client/petstore/python/docs/ChildAllOf.md
index f9ae99c7c157..bae8ced90067 100644
--- a/samples/client/petstore/python/docs/ChildAllOf.md
+++ b/samples/client/petstore/python/docs/ChildAllOf.md
@@ -5,6 +5,7 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**inter_net** | **bool** | | [optional]
+**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/client/petstore/python/docs/ChildCat.md b/samples/client/petstore/python/docs/ChildCat.md
index 9e3a0fb4b51a..513903ac5793 100644
--- a/samples/client/petstore/python/docs/ChildCat.md
+++ b/samples/client/petstore/python/docs/ChildCat.md
@@ -6,6 +6,7 @@ Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**pet_type** | **str** | |
**name** | **str** | | [optional]
+**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/client/petstore/python/docs/ChildCatAllOf.md b/samples/client/petstore/python/docs/ChildCatAllOf.md
index c5883b9a87c8..c5b2f58f28ce 100644
--- a/samples/client/petstore/python/docs/ChildCatAllOf.md
+++ b/samples/client/petstore/python/docs/ChildCatAllOf.md
@@ -5,6 +5,7 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**name** | **str** | | [optional]
+**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/client/petstore/python/docs/ChildDog.md b/samples/client/petstore/python/docs/ChildDog.md
index 9a6e5b372664..e5b410ce1e79 100644
--- a/samples/client/petstore/python/docs/ChildDog.md
+++ b/samples/client/petstore/python/docs/ChildDog.md
@@ -6,6 +6,7 @@ Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**pet_type** | **str** | |
**bark** | **str** | | [optional]
+**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/client/petstore/python/docs/ChildDogAllOf.md b/samples/client/petstore/python/docs/ChildDogAllOf.md
index 673050667cb3..45928c57ef2a 100644
--- a/samples/client/petstore/python/docs/ChildDogAllOf.md
+++ b/samples/client/petstore/python/docs/ChildDogAllOf.md
@@ -5,6 +5,7 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**bark** | **str** | | [optional]
+**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/client/petstore/python/docs/ChildLizard.md b/samples/client/petstore/python/docs/ChildLizard.md
index e881ee0a1d1b..d2e22826e77f 100644
--- a/samples/client/petstore/python/docs/ChildLizard.md
+++ b/samples/client/petstore/python/docs/ChildLizard.md
@@ -6,6 +6,7 @@ Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**pet_type** | **str** | |
**loves_rocks** | **bool** | | [optional]
+**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/client/petstore/python/docs/ChildLizardAllOf.md b/samples/client/petstore/python/docs/ChildLizardAllOf.md
index 6e2b70c01505..6effcfd9313f 100644
--- a/samples/client/petstore/python/docs/ChildLizardAllOf.md
+++ b/samples/client/petstore/python/docs/ChildLizardAllOf.md
@@ -5,6 +5,7 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**loves_rocks** | **bool** | | [optional]
+**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/client/petstore/python/docs/ClassModel.md b/samples/client/petstore/python/docs/ClassModel.md
index 48ed7cbf2ff0..6605a16d74a9 100644
--- a/samples/client/petstore/python/docs/ClassModel.md
+++ b/samples/client/petstore/python/docs/ClassModel.md
@@ -6,6 +6,7 @@ Model for testing model with \"_class\" property
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**_class** | **str** | | [optional]
+**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/client/petstore/python/docs/Client.md b/samples/client/petstore/python/docs/Client.md
index c3986008d6c3..1b293140f348 100644
--- a/samples/client/petstore/python/docs/Client.md
+++ b/samples/client/petstore/python/docs/Client.md
@@ -5,6 +5,7 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**client** | **str** | | [optional]
+**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/client/petstore/python/docs/Dog.md b/samples/client/petstore/python/docs/Dog.md
index 7065c4c983d9..51b5b32bdacb 100644
--- a/samples/client/petstore/python/docs/Dog.md
+++ b/samples/client/petstore/python/docs/Dog.md
@@ -7,6 +7,7 @@ Name | Type | Description | Notes
**class_name** | **str** | |
**breed** | **str** | | [optional]
**color** | **str** | | [optional] if omitted the server will use the default value of "red"
+**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/client/petstore/python/docs/DogAllOf.md b/samples/client/petstore/python/docs/DogAllOf.md
index 6382bbd80671..2907a9fd5c43 100644
--- a/samples/client/petstore/python/docs/DogAllOf.md
+++ b/samples/client/petstore/python/docs/DogAllOf.md
@@ -5,6 +5,7 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**breed** | **str** | | [optional]
+**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/client/petstore/python/docs/EnumArrays.md b/samples/client/petstore/python/docs/EnumArrays.md
index 9be5c645a809..ad4e9d2fcb7c 100644
--- a/samples/client/petstore/python/docs/EnumArrays.md
+++ b/samples/client/petstore/python/docs/EnumArrays.md
@@ -6,6 +6,7 @@ Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**just_symbol** | **str** | | [optional]
**array_enum** | **[str]** | | [optional]
+**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/client/petstore/python/docs/EnumClass.md b/samples/client/petstore/python/docs/EnumClass.md
index a1f9aae58190..39bb0e1644c5 100644
--- a/samples/client/petstore/python/docs/EnumClass.md
+++ b/samples/client/petstore/python/docs/EnumClass.md
@@ -5,6 +5,7 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**value** | **str** | | defaults to "-efg", must be one of ["_abc", "-efg", "(xyz)", ]
+**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/client/petstore/python/docs/EnumTest.md b/samples/client/petstore/python/docs/EnumTest.md
index eb8842241390..052596bfd045 100644
--- a/samples/client/petstore/python/docs/EnumTest.md
+++ b/samples/client/petstore/python/docs/EnumTest.md
@@ -9,6 +9,7 @@ Name | Type | Description | Notes
**enum_integer** | **int** | | [optional]
**enum_number** | **float** | | [optional]
**string_enum** | [**StringEnum**](StringEnum.md) | | [optional]
+**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/client/petstore/python/docs/File.md b/samples/client/petstore/python/docs/File.md
index 63b1d1a65186..f84547d19331 100644
--- a/samples/client/petstore/python/docs/File.md
+++ b/samples/client/petstore/python/docs/File.md
@@ -6,6 +6,7 @@ Must be named `File` for test.
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**source_uri** | **str** | Test capitalization | [optional]
+**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/client/petstore/python/docs/FileSchemaTestClass.md b/samples/client/petstore/python/docs/FileSchemaTestClass.md
index caf2440821da..4572aa0905b3 100644
--- a/samples/client/petstore/python/docs/FileSchemaTestClass.md
+++ b/samples/client/petstore/python/docs/FileSchemaTestClass.md
@@ -6,6 +6,7 @@ Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**file** | [**File**](File.md) | | [optional]
**files** | [**[File]**](File.md) | | [optional]
+**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/client/petstore/python/docs/FormatTest.md b/samples/client/petstore/python/docs/FormatTest.md
index aef09bfcc83e..dbb4c3e6683d 100644
--- a/samples/client/petstore/python/docs/FormatTest.md
+++ b/samples/client/petstore/python/docs/FormatTest.md
@@ -17,6 +17,7 @@ Name | Type | Description | Notes
**binary** | **file_type** | | [optional]
**date_time** | **datetime** | | [optional]
**uuid** | **str** | | [optional]
+**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/client/petstore/python/docs/Grandparent.md b/samples/client/petstore/python/docs/Grandparent.md
index b6d80a719457..af143938ab51 100644
--- a/samples/client/petstore/python/docs/Grandparent.md
+++ b/samples/client/petstore/python/docs/Grandparent.md
@@ -5,6 +5,7 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**radio_waves** | **bool** | | [optional]
+**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/client/petstore/python/docs/GrandparentAnimal.md b/samples/client/petstore/python/docs/GrandparentAnimal.md
index 15db0708bb1a..a1c340378106 100644
--- a/samples/client/petstore/python/docs/GrandparentAnimal.md
+++ b/samples/client/petstore/python/docs/GrandparentAnimal.md
@@ -5,6 +5,7 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**pet_type** | **str** | |
+**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/client/petstore/python/docs/HasOnlyReadOnly.md b/samples/client/petstore/python/docs/HasOnlyReadOnly.md
index 0e1334519a8b..88bc03d4ff5c 100644
--- a/samples/client/petstore/python/docs/HasOnlyReadOnly.md
+++ b/samples/client/petstore/python/docs/HasOnlyReadOnly.md
@@ -6,6 +6,7 @@ Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**bar** | **str** | | [optional] [readonly]
**foo** | **str** | | [optional] [readonly]
+**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/client/petstore/python/docs/List.md b/samples/client/petstore/python/docs/List.md
index 4b60956971aa..13f2694de358 100644
--- a/samples/client/petstore/python/docs/List.md
+++ b/samples/client/petstore/python/docs/List.md
@@ -5,6 +5,7 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**_123_list** | **str** | | [optional]
+**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/client/petstore/python/docs/MapTest.md b/samples/client/petstore/python/docs/MapTest.md
index 15228ee1f282..e6584f3811e0 100644
--- a/samples/client/petstore/python/docs/MapTest.md
+++ b/samples/client/petstore/python/docs/MapTest.md
@@ -8,6 +8,7 @@ Name | Type | Description | Notes
**map_of_enum_string** | **{str: (str,)}** | | [optional]
**direct_map** | **{str: (bool,)}** | | [optional]
**indirect_map** | [**StringBooleanMap**](StringBooleanMap.md) | | [optional]
+**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/client/petstore/python/docs/MixedPropertiesAndAdditionalPropertiesClass.md b/samples/client/petstore/python/docs/MixedPropertiesAndAdditionalPropertiesClass.md
index f489944a20af..f32c4e04134b 100644
--- a/samples/client/petstore/python/docs/MixedPropertiesAndAdditionalPropertiesClass.md
+++ b/samples/client/petstore/python/docs/MixedPropertiesAndAdditionalPropertiesClass.md
@@ -7,6 +7,7 @@ Name | Type | Description | Notes
**uuid** | **str** | | [optional]
**date_time** | **datetime** | | [optional]
**map** | [**{str: (Animal,)}**](Animal.md) | | [optional]
+**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/client/petstore/python/docs/Model200Response.md b/samples/client/petstore/python/docs/Model200Response.md
index c958bd4b33f8..f7ef7d79acf6 100644
--- a/samples/client/petstore/python/docs/Model200Response.md
+++ b/samples/client/petstore/python/docs/Model200Response.md
@@ -7,6 +7,7 @@ Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**name** | **int** | | [optional]
**_class** | **str** | | [optional]
+**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/client/petstore/python/docs/ModelReturn.md b/samples/client/petstore/python/docs/ModelReturn.md
index 043e9d466fab..75fb39a88698 100644
--- a/samples/client/petstore/python/docs/ModelReturn.md
+++ b/samples/client/petstore/python/docs/ModelReturn.md
@@ -6,6 +6,7 @@ Model for testing reserved words
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**_return** | **int** | | [optional]
+**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/client/petstore/python/docs/Name.md b/samples/client/petstore/python/docs/Name.md
index 3be719cdbfba..6e58fae6d0bb 100644
--- a/samples/client/petstore/python/docs/Name.md
+++ b/samples/client/petstore/python/docs/Name.md
@@ -9,6 +9,7 @@ Name | Type | Description | Notes
**snake_case** | **int** | | [optional] [readonly]
**_property** | **str** | | [optional]
**_123_number** | **int** | | [optional] [readonly]
+**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/client/petstore/python/docs/NumberOnly.md b/samples/client/petstore/python/docs/NumberOnly.md
index 37195c5d8994..172e86163a44 100644
--- a/samples/client/petstore/python/docs/NumberOnly.md
+++ b/samples/client/petstore/python/docs/NumberOnly.md
@@ -5,6 +5,7 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**just_number** | **float** | | [optional]
+**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/client/petstore/python/docs/NumberWithValidations.md b/samples/client/petstore/python/docs/NumberWithValidations.md
index 119e0f678239..cc6f77c152c6 100644
--- a/samples/client/petstore/python/docs/NumberWithValidations.md
+++ b/samples/client/petstore/python/docs/NumberWithValidations.md
@@ -5,6 +5,7 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**value** | **float** | |
+**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/client/petstore/python/docs/ObjectModelWithRefProps.md b/samples/client/petstore/python/docs/ObjectModelWithRefProps.md
index 5ff4e52033d6..a0d15f4bbd15 100644
--- a/samples/client/petstore/python/docs/ObjectModelWithRefProps.md
+++ b/samples/client/petstore/python/docs/ObjectModelWithRefProps.md
@@ -8,6 +8,7 @@ Name | Type | Description | Notes
**my_number** | [**NumberWithValidations**](NumberWithValidations.md) | | [optional]
**my_string** | **str** | | [optional]
**my_boolean** | **bool** | | [optional]
+**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/client/petstore/python/docs/Order.md b/samples/client/petstore/python/docs/Order.md
index d29e1a381de8..0423082932d5 100644
--- a/samples/client/petstore/python/docs/Order.md
+++ b/samples/client/petstore/python/docs/Order.md
@@ -10,6 +10,7 @@ Name | Type | Description | Notes
**ship_date** | **datetime** | | [optional]
**status** | **str** | Order Status | [optional]
**complete** | **bool** | | [optional] if omitted the server will use the default value of False
+**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/client/petstore/python/docs/Parent.md b/samples/client/petstore/python/docs/Parent.md
index 9d3f02d68b31..9db770844ee1 100644
--- a/samples/client/petstore/python/docs/Parent.md
+++ b/samples/client/petstore/python/docs/Parent.md
@@ -6,6 +6,7 @@ Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**radio_waves** | **bool** | | [optional]
**tele_vision** | **bool** | | [optional]
+**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/client/petstore/python/docs/ParentAllOf.md b/samples/client/petstore/python/docs/ParentAllOf.md
index 569a5e4af14f..84ac2c066eed 100644
--- a/samples/client/petstore/python/docs/ParentAllOf.md
+++ b/samples/client/petstore/python/docs/ParentAllOf.md
@@ -5,6 +5,7 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**tele_vision** | **bool** | | [optional]
+**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/client/petstore/python/docs/ParentPet.md b/samples/client/petstore/python/docs/ParentPet.md
index 09e409c8fcf1..111ada88b3d1 100644
--- a/samples/client/petstore/python/docs/ParentPet.md
+++ b/samples/client/petstore/python/docs/ParentPet.md
@@ -5,6 +5,7 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**pet_type** | **str** | |
+**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/client/petstore/python/docs/Pet.md b/samples/client/petstore/python/docs/Pet.md
index 6e78495272e4..e0b129784564 100644
--- a/samples/client/petstore/python/docs/Pet.md
+++ b/samples/client/petstore/python/docs/Pet.md
@@ -10,6 +10,7 @@ Name | Type | Description | Notes
**category** | [**Category**](Category.md) | | [optional]
**tags** | [**[Tag]**](Tag.md) | | [optional]
**status** | **str** | pet status in the store | [optional]
+**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/client/petstore/python/docs/Player.md b/samples/client/petstore/python/docs/Player.md
index 2014198aa1bd..97441ae316bb 100644
--- a/samples/client/petstore/python/docs/Player.md
+++ b/samples/client/petstore/python/docs/Player.md
@@ -6,6 +6,7 @@ Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**name** | **str** | |
**enemy_player** | [**Player**](Player.md) | | [optional]
+**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/client/petstore/python/docs/ReadOnlyFirst.md b/samples/client/petstore/python/docs/ReadOnlyFirst.md
index 53b4c61d8445..ba39ec3d04e4 100644
--- a/samples/client/petstore/python/docs/ReadOnlyFirst.md
+++ b/samples/client/petstore/python/docs/ReadOnlyFirst.md
@@ -6,6 +6,7 @@ Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**bar** | **str** | | [optional] [readonly]
**baz** | **str** | | [optional]
+**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/client/petstore/python/docs/SpecialModelName.md b/samples/client/petstore/python/docs/SpecialModelName.md
index 268e1134192d..4a1c86ff4de0 100644
--- a/samples/client/petstore/python/docs/SpecialModelName.md
+++ b/samples/client/petstore/python/docs/SpecialModelName.md
@@ -5,6 +5,7 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**special_property_name** | **int** | | [optional]
+**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/client/petstore/python/docs/StringEnum.md b/samples/client/petstore/python/docs/StringEnum.md
index bb195ec0e453..1ac6df2fb797 100644
--- a/samples/client/petstore/python/docs/StringEnum.md
+++ b/samples/client/petstore/python/docs/StringEnum.md
@@ -5,6 +5,7 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**value** | **str** | | must be one of ["placed", "approved", "delivered", ]
+**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/client/petstore/python/docs/Tag.md b/samples/client/petstore/python/docs/Tag.md
index b9fe1e0944c4..bfe06d1c5bfe 100644
--- a/samples/client/petstore/python/docs/Tag.md
+++ b/samples/client/petstore/python/docs/Tag.md
@@ -7,6 +7,7 @@ Name | Type | Description | Notes
**id** | **int** | | [optional]
**name** | **str** | | [optional]
**full_name** | **str** | | [optional]
+**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/client/petstore/python/docs/TypeHolderDefault.md b/samples/client/petstore/python/docs/TypeHolderDefault.md
index 904915aec010..f15c61cc4618 100644
--- a/samples/client/petstore/python/docs/TypeHolderDefault.md
+++ b/samples/client/petstore/python/docs/TypeHolderDefault.md
@@ -12,6 +12,7 @@ Name | Type | Description | Notes
**bool_item** | **bool** | | defaults to True
**date_item** | **date** | | [optional]
**datetime_item** | **datetime** | | [optional]
+**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/client/petstore/python/docs/TypeHolderExample.md b/samples/client/petstore/python/docs/TypeHolderExample.md
index d2954c64dcef..d707ca3af203 100644
--- a/samples/client/petstore/python/docs/TypeHolderExample.md
+++ b/samples/client/petstore/python/docs/TypeHolderExample.md
@@ -10,6 +10,7 @@ Name | Type | Description | Notes
**string_item** | **str** | | defaults to "what"
**number_item** | **float** | | defaults to 1.234
**integer_item** | **int** | | defaults to -2
+**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/client/petstore/python/docs/User.md b/samples/client/petstore/python/docs/User.md
index b0079f591b6e..8e677b63cca6 100644
--- a/samples/client/petstore/python/docs/User.md
+++ b/samples/client/petstore/python/docs/User.md
@@ -12,6 +12,7 @@ Name | Type | Description | Notes
**password** | **str** | | [optional]
**phone** | **str** | | [optional]
**user_status** | **int** | User Status | [optional]
+**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/client/petstore/python/docs/XmlItem.md b/samples/client/petstore/python/docs/XmlItem.md
index ea3d7f92804b..9852234a7367 100644
--- a/samples/client/petstore/python/docs/XmlItem.md
+++ b/samples/client/petstore/python/docs/XmlItem.md
@@ -33,6 +33,7 @@ Name | Type | Description | Notes
**prefix_ns_boolean** | **bool** | | [optional]
**prefix_ns_array** | **[int]** | | [optional]
**prefix_ns_wrapped_array** | **[int]** | | [optional]
+**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/client/petstore/python/petstore_api/model/additional_properties_any_type.py b/samples/client/petstore/python/petstore_api/model/additional_properties_any_type.py
index 4531d8f2d862..7239795cf4af 100644
--- a/samples/client/petstore/python/petstore_api/model/additional_properties_any_type.py
+++ b/samples/client/petstore/python/petstore_api/model/additional_properties_any_type.py
@@ -63,7 +63,7 @@ def additional_properties_type():
This must be a method because a model may have properties that are
of type self, this must run after the class is loaded
"""
- return (bool, date, datetime, dict, float, int, list, str,) # noqa: E501
+ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
diff --git a/samples/client/petstore/python/petstore_api/model/additional_properties_array.py b/samples/client/petstore/python/petstore_api/model/additional_properties_array.py
index 4a35500c63f3..7d9403758a0d 100644
--- a/samples/client/petstore/python/petstore_api/model/additional_properties_array.py
+++ b/samples/client/petstore/python/petstore_api/model/additional_properties_array.py
@@ -63,7 +63,7 @@ def additional_properties_type():
This must be a method because a model may have properties that are
of type self, this must run after the class is loaded
"""
- return ([bool, date, datetime, dict, float, int, list, str],) # noqa: E501
+ return ([bool, date, datetime, dict, float, int, list, str, none_type],) # noqa: E501
_nullable = False
diff --git a/samples/client/petstore/python/petstore_api/model/additional_properties_class.py b/samples/client/petstore/python/petstore_api/model/additional_properties_class.py
index 743f3be54d44..39719e00dcfa 100644
--- a/samples/client/petstore/python/petstore_api/model/additional_properties_class.py
+++ b/samples/client/petstore/python/petstore_api/model/additional_properties_class.py
@@ -57,7 +57,13 @@ class AdditionalPropertiesClass(ModelNormal):
validations = {
}
- additional_properties_type = None
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
@@ -77,12 +83,12 @@ def openapi_types():
'map_integer': ({str: (int,)},), # noqa: E501
'map_boolean': ({str: (bool,)},), # noqa: E501
'map_array_integer': ({str: ([int],)},), # noqa: E501
- 'map_array_anytype': ({str: ([bool, date, datetime, dict, float, int, list, str],)},), # noqa: E501
+ 'map_array_anytype': ({str: ([bool, date, datetime, dict, float, int, list, str, none_type],)},), # noqa: E501
'map_map_string': ({str: ({str: (str,)},)},), # noqa: E501
- 'map_map_anytype': ({str: ({str: (bool, date, datetime, dict, float, int, list, str,)},)},), # noqa: E501
- 'anytype_1': (bool, date, datetime, dict, float, int, list, str,), # noqa: E501
- 'anytype_2': (bool, date, datetime, dict, float, int, list, str,), # noqa: E501
- 'anytype_3': (bool, date, datetime, dict, float, int, list, str,), # noqa: E501
+ 'map_map_anytype': ({str: ({str: (bool, date, datetime, dict, float, int, list, str, none_type,)},)},), # noqa: E501
+ 'anytype_1': (bool, date, datetime, dict, float, int, list, str, none_type,), # noqa: E501
+ 'anytype_2': (bool, date, datetime, dict, float, int, list, str, none_type,), # noqa: E501
+ 'anytype_3': (bool, date, datetime, dict, float, int, list, str, none_type,), # noqa: E501
}
@cached_property
@@ -155,12 +161,12 @@ def __init__(self, *args, **kwargs): # noqa: E501
map_integer ({str: (int,)}): [optional] # noqa: E501
map_boolean ({str: (bool,)}): [optional] # noqa: E501
map_array_integer ({str: ([int],)}): [optional] # noqa: E501
- map_array_anytype ({str: ([bool, date, datetime, dict, float, int, list, str],)}): [optional] # noqa: E501
+ map_array_anytype ({str: ([bool, date, datetime, dict, float, int, list, str, none_type],)}): [optional] # noqa: E501
map_map_string ({str: ({str: (str,)},)}): [optional] # noqa: E501
- map_map_anytype ({str: ({str: (bool, date, datetime, dict, float, int, list, str,)},)}): [optional] # noqa: E501
- anytype_1 (bool, date, datetime, dict, float, int, list, str): [optional] # noqa: E501
- anytype_2 (bool, date, datetime, dict, float, int, list, str): [optional] # noqa: E501
- anytype_3 (bool, date, datetime, dict, float, int, list, str): [optional] # noqa: E501
+ map_map_anytype ({str: ({str: (bool, date, datetime, dict, float, int, list, str, none_type,)},)}): [optional] # noqa: E501
+ anytype_1 (bool, date, datetime, dict, float, int, list, str, none_type): [optional] # noqa: E501
+ anytype_2 (bool, date, datetime, dict, float, int, list, str, none_type): no type is set for this. [optional] # noqa: E501
+ anytype_3 (bool, date, datetime, dict, float, int, list, str, none_type): because of a bug in swagger-parser, this should have values {str: (str, int, float...)} but instead we get any type. See https://github.com/swagger-api/swagger-parser/issues/1378. [optional] # noqa: E501
"""
_check_type = kwargs.pop('_check_type', True)
diff --git a/samples/client/petstore/python/petstore_api/model/additional_properties_object.py b/samples/client/petstore/python/petstore_api/model/additional_properties_object.py
index 40e80e16044d..000653f13a73 100644
--- a/samples/client/petstore/python/petstore_api/model/additional_properties_object.py
+++ b/samples/client/petstore/python/petstore_api/model/additional_properties_object.py
@@ -63,7 +63,7 @@ def additional_properties_type():
This must be a method because a model may have properties that are
of type self, this must run after the class is loaded
"""
- return ({str: (bool, date, datetime, dict, float, int, list, str,)},) # noqa: E501
+ return ({str: (bool, date, datetime, dict, float, int, list, str, none_type,)},) # noqa: E501
_nullable = False
diff --git a/samples/client/petstore/python/petstore_api/model/animal.py b/samples/client/petstore/python/petstore_api/model/animal.py
index a3d48b6ea975..c53b1e1ad289 100644
--- a/samples/client/petstore/python/petstore_api/model/animal.py
+++ b/samples/client/petstore/python/petstore_api/model/animal.py
@@ -63,7 +63,14 @@ class Animal(ModelNormal):
validations = {
}
- additional_properties_type = None
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ lazy_import()
+ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
diff --git a/samples/client/petstore/python/petstore_api/model/animal_farm.py b/samples/client/petstore/python/petstore_api/model/animal_farm.py
index 838b18a12970..fb58224ebd4c 100644
--- a/samples/client/petstore/python/petstore_api/model/animal_farm.py
+++ b/samples/client/petstore/python/petstore_api/model/animal_farm.py
@@ -57,7 +57,14 @@ class AnimalFarm(ModelSimple):
validations = {
}
- additional_properties_type = None
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ lazy_import()
+ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
diff --git a/samples/client/petstore/python/petstore_api/model/api_response.py b/samples/client/petstore/python/petstore_api/model/api_response.py
index 01e2175b8004..53adb5aba12f 100644
--- a/samples/client/petstore/python/petstore_api/model/api_response.py
+++ b/samples/client/petstore/python/petstore_api/model/api_response.py
@@ -57,7 +57,13 @@ class ApiResponse(ModelNormal):
validations = {
}
- additional_properties_type = None
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
diff --git a/samples/client/petstore/python/petstore_api/model/array_of_array_of_number_only.py b/samples/client/petstore/python/petstore_api/model/array_of_array_of_number_only.py
index 008b74dd42a3..8b6a2c42d0ed 100644
--- a/samples/client/petstore/python/petstore_api/model/array_of_array_of_number_only.py
+++ b/samples/client/petstore/python/petstore_api/model/array_of_array_of_number_only.py
@@ -57,7 +57,13 @@ class ArrayOfArrayOfNumberOnly(ModelNormal):
validations = {
}
- additional_properties_type = None
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
diff --git a/samples/client/petstore/python/petstore_api/model/array_of_number_only.py b/samples/client/petstore/python/petstore_api/model/array_of_number_only.py
index f2e080bc258e..7b754dc283e6 100644
--- a/samples/client/petstore/python/petstore_api/model/array_of_number_only.py
+++ b/samples/client/petstore/python/petstore_api/model/array_of_number_only.py
@@ -57,7 +57,13 @@ class ArrayOfNumberOnly(ModelNormal):
validations = {
}
- additional_properties_type = None
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
diff --git a/samples/client/petstore/python/petstore_api/model/array_test.py b/samples/client/petstore/python/petstore_api/model/array_test.py
index ac42b07b93c9..9691a1e60374 100644
--- a/samples/client/petstore/python/petstore_api/model/array_test.py
+++ b/samples/client/petstore/python/petstore_api/model/array_test.py
@@ -61,7 +61,14 @@ class ArrayTest(ModelNormal):
validations = {
}
- additional_properties_type = None
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ lazy_import()
+ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
diff --git a/samples/client/petstore/python/petstore_api/model/capitalization.py b/samples/client/petstore/python/petstore_api/model/capitalization.py
index 710c17e51a56..6d939535ceef 100644
--- a/samples/client/petstore/python/petstore_api/model/capitalization.py
+++ b/samples/client/petstore/python/petstore_api/model/capitalization.py
@@ -57,7 +57,13 @@ class Capitalization(ModelNormal):
validations = {
}
- additional_properties_type = None
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
diff --git a/samples/client/petstore/python/petstore_api/model/cat.py b/samples/client/petstore/python/petstore_api/model/cat.py
index 8b5c46413b99..eeea79359fc9 100644
--- a/samples/client/petstore/python/petstore_api/model/cat.py
+++ b/samples/client/petstore/python/petstore_api/model/cat.py
@@ -63,7 +63,14 @@ class Cat(ModelComposed):
validations = {
}
- additional_properties_type = None
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ lazy_import()
+ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
@@ -111,13 +118,11 @@ def discriminator():
])
@convert_js_args_to_python_args
- def __init__(self, class_name, *args, **kwargs): # noqa: E501
+ def __init__(self, *args, **kwargs): # noqa: E501
"""Cat - a model defined in OpenAPI
- Args:
- class_name (str):
-
Keyword Args:
+ class_name (str):
_check_type (bool): if True, values for parameters in openapi_types
will be type checked and a TypeError will be
raised if the wrong type is input.
@@ -182,26 +187,18 @@ def __init__(self, class_name, *args, **kwargs): # noqa: E501
'_configuration': _configuration,
'_visited_composed_classes': self._visited_composed_classes,
}
- required_args = {
- 'class_name': class_name,
- }
- model_args = {}
- model_args.update(required_args)
- model_args.update(kwargs)
composed_info = validate_get_composed_info(
- constant_args, model_args, self)
+ constant_args, kwargs, self)
self._composed_instances = composed_info[0]
self._var_name_to_model_instances = composed_info[1]
self._additional_properties_model_instances = composed_info[2]
- unused_args = composed_info[3]
+ discarded_args = composed_info[3]
- for var_name, var_value in required_args.items():
- setattr(self, var_name, var_value)
for var_name, var_value in kwargs.items():
- if var_name in unused_args and \
+ if var_name in discarded_args and \
self._configuration is not None and \
self._configuration.discard_unknown_keys and \
- not self._additional_properties_model_instances:
+ self._additional_properties_model_instances:
# discard variable.
continue
setattr(self, var_name, var_value)
diff --git a/samples/client/petstore/python/petstore_api/model/cat_all_of.py b/samples/client/petstore/python/petstore_api/model/cat_all_of.py
index 50b046510dfa..7efba680b4d8 100644
--- a/samples/client/petstore/python/petstore_api/model/cat_all_of.py
+++ b/samples/client/petstore/python/petstore_api/model/cat_all_of.py
@@ -57,7 +57,13 @@ class CatAllOf(ModelNormal):
validations = {
}
- additional_properties_type = None
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
diff --git a/samples/client/petstore/python/petstore_api/model/category.py b/samples/client/petstore/python/petstore_api/model/category.py
index ed167471d356..4936b4f0e443 100644
--- a/samples/client/petstore/python/petstore_api/model/category.py
+++ b/samples/client/petstore/python/petstore_api/model/category.py
@@ -57,7 +57,13 @@ class Category(ModelNormal):
validations = {
}
- additional_properties_type = None
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
diff --git a/samples/client/petstore/python/petstore_api/model/child.py b/samples/client/petstore/python/petstore_api/model/child.py
index c8f0a70a1931..8fad3bf107bd 100644
--- a/samples/client/petstore/python/petstore_api/model/child.py
+++ b/samples/client/petstore/python/petstore_api/model/child.py
@@ -63,7 +63,14 @@ class Child(ModelComposed):
validations = {
}
- additional_properties_type = None
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ lazy_import()
+ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
@@ -177,25 +184,18 @@ def __init__(self, *args, **kwargs): # noqa: E501
'_configuration': _configuration,
'_visited_composed_classes': self._visited_composed_classes,
}
- required_args = {
- }
- model_args = {}
- model_args.update(required_args)
- model_args.update(kwargs)
composed_info = validate_get_composed_info(
- constant_args, model_args, self)
+ constant_args, kwargs, self)
self._composed_instances = composed_info[0]
self._var_name_to_model_instances = composed_info[1]
self._additional_properties_model_instances = composed_info[2]
- unused_args = composed_info[3]
+ discarded_args = composed_info[3]
- for var_name, var_value in required_args.items():
- setattr(self, var_name, var_value)
for var_name, var_value in kwargs.items():
- if var_name in unused_args and \
+ if var_name in discarded_args and \
self._configuration is not None and \
self._configuration.discard_unknown_keys and \
- not self._additional_properties_model_instances:
+ self._additional_properties_model_instances:
# discard variable.
continue
setattr(self, var_name, var_value)
diff --git a/samples/client/petstore/python/petstore_api/model/child_all_of.py b/samples/client/petstore/python/petstore_api/model/child_all_of.py
index 2339e520bd65..9db852ec725b 100644
--- a/samples/client/petstore/python/petstore_api/model/child_all_of.py
+++ b/samples/client/petstore/python/petstore_api/model/child_all_of.py
@@ -57,7 +57,13 @@ class ChildAllOf(ModelNormal):
validations = {
}
- additional_properties_type = None
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
diff --git a/samples/client/petstore/python/petstore_api/model/child_cat.py b/samples/client/petstore/python/petstore_api/model/child_cat.py
index a7d52b48e8ac..d054cb7a97a0 100644
--- a/samples/client/petstore/python/petstore_api/model/child_cat.py
+++ b/samples/client/petstore/python/petstore_api/model/child_cat.py
@@ -63,7 +63,14 @@ class ChildCat(ModelComposed):
validations = {
}
- additional_properties_type = None
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ lazy_import()
+ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
@@ -109,13 +116,11 @@ def discriminator():
])
@convert_js_args_to_python_args
- def __init__(self, pet_type, *args, **kwargs): # noqa: E501
+ def __init__(self, *args, **kwargs): # noqa: E501
"""ChildCat - a model defined in OpenAPI
- Args:
- pet_type (str):
-
Keyword Args:
+ pet_type (str):
_check_type (bool): if True, values for parameters in openapi_types
will be type checked and a TypeError will be
raised if the wrong type is input.
@@ -179,26 +184,18 @@ def __init__(self, pet_type, *args, **kwargs): # noqa: E501
'_configuration': _configuration,
'_visited_composed_classes': self._visited_composed_classes,
}
- required_args = {
- 'pet_type': pet_type,
- }
- model_args = {}
- model_args.update(required_args)
- model_args.update(kwargs)
composed_info = validate_get_composed_info(
- constant_args, model_args, self)
+ constant_args, kwargs, self)
self._composed_instances = composed_info[0]
self._var_name_to_model_instances = composed_info[1]
self._additional_properties_model_instances = composed_info[2]
- unused_args = composed_info[3]
+ discarded_args = composed_info[3]
- for var_name, var_value in required_args.items():
- setattr(self, var_name, var_value)
for var_name, var_value in kwargs.items():
- if var_name in unused_args and \
+ if var_name in discarded_args and \
self._configuration is not None and \
self._configuration.discard_unknown_keys and \
- not self._additional_properties_model_instances:
+ self._additional_properties_model_instances:
# discard variable.
continue
setattr(self, var_name, var_value)
diff --git a/samples/client/petstore/python/petstore_api/model/child_cat_all_of.py b/samples/client/petstore/python/petstore_api/model/child_cat_all_of.py
index f0f1a1ae6bd4..3d732d085fba 100644
--- a/samples/client/petstore/python/petstore_api/model/child_cat_all_of.py
+++ b/samples/client/petstore/python/petstore_api/model/child_cat_all_of.py
@@ -57,7 +57,13 @@ class ChildCatAllOf(ModelNormal):
validations = {
}
- additional_properties_type = None
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
diff --git a/samples/client/petstore/python/petstore_api/model/child_dog.py b/samples/client/petstore/python/petstore_api/model/child_dog.py
index 2bc0882ac2a9..6244359fea2b 100644
--- a/samples/client/petstore/python/petstore_api/model/child_dog.py
+++ b/samples/client/petstore/python/petstore_api/model/child_dog.py
@@ -63,7 +63,14 @@ class ChildDog(ModelComposed):
validations = {
}
- additional_properties_type = None
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ lazy_import()
+ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
@@ -109,13 +116,11 @@ def discriminator():
])
@convert_js_args_to_python_args
- def __init__(self, pet_type, *args, **kwargs): # noqa: E501
+ def __init__(self, *args, **kwargs): # noqa: E501
"""ChildDog - a model defined in OpenAPI
- Args:
- pet_type (str):
-
Keyword Args:
+ pet_type (str):
_check_type (bool): if True, values for parameters in openapi_types
will be type checked and a TypeError will be
raised if the wrong type is input.
@@ -179,26 +184,18 @@ def __init__(self, pet_type, *args, **kwargs): # noqa: E501
'_configuration': _configuration,
'_visited_composed_classes': self._visited_composed_classes,
}
- required_args = {
- 'pet_type': pet_type,
- }
- model_args = {}
- model_args.update(required_args)
- model_args.update(kwargs)
composed_info = validate_get_composed_info(
- constant_args, model_args, self)
+ constant_args, kwargs, self)
self._composed_instances = composed_info[0]
self._var_name_to_model_instances = composed_info[1]
self._additional_properties_model_instances = composed_info[2]
- unused_args = composed_info[3]
+ discarded_args = composed_info[3]
- for var_name, var_value in required_args.items():
- setattr(self, var_name, var_value)
for var_name, var_value in kwargs.items():
- if var_name in unused_args and \
+ if var_name in discarded_args and \
self._configuration is not None and \
self._configuration.discard_unknown_keys and \
- not self._additional_properties_model_instances:
+ self._additional_properties_model_instances:
# discard variable.
continue
setattr(self, var_name, var_value)
diff --git a/samples/client/petstore/python/petstore_api/model/child_dog_all_of.py b/samples/client/petstore/python/petstore_api/model/child_dog_all_of.py
index d460b68b3d3a..d3a0d89c4da6 100644
--- a/samples/client/petstore/python/petstore_api/model/child_dog_all_of.py
+++ b/samples/client/petstore/python/petstore_api/model/child_dog_all_of.py
@@ -57,7 +57,13 @@ class ChildDogAllOf(ModelNormal):
validations = {
}
- additional_properties_type = None
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
diff --git a/samples/client/petstore/python/petstore_api/model/child_lizard.py b/samples/client/petstore/python/petstore_api/model/child_lizard.py
index 6142b9c751fe..b56925a0c92b 100644
--- a/samples/client/petstore/python/petstore_api/model/child_lizard.py
+++ b/samples/client/petstore/python/petstore_api/model/child_lizard.py
@@ -63,7 +63,14 @@ class ChildLizard(ModelComposed):
validations = {
}
- additional_properties_type = None
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ lazy_import()
+ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
@@ -109,13 +116,11 @@ def discriminator():
])
@convert_js_args_to_python_args
- def __init__(self, pet_type, *args, **kwargs): # noqa: E501
+ def __init__(self, *args, **kwargs): # noqa: E501
"""ChildLizard - a model defined in OpenAPI
- Args:
- pet_type (str):
-
Keyword Args:
+ pet_type (str):
_check_type (bool): if True, values for parameters in openapi_types
will be type checked and a TypeError will be
raised if the wrong type is input.
@@ -179,26 +184,18 @@ def __init__(self, pet_type, *args, **kwargs): # noqa: E501
'_configuration': _configuration,
'_visited_composed_classes': self._visited_composed_classes,
}
- required_args = {
- 'pet_type': pet_type,
- }
- model_args = {}
- model_args.update(required_args)
- model_args.update(kwargs)
composed_info = validate_get_composed_info(
- constant_args, model_args, self)
+ constant_args, kwargs, self)
self._composed_instances = composed_info[0]
self._var_name_to_model_instances = composed_info[1]
self._additional_properties_model_instances = composed_info[2]
- unused_args = composed_info[3]
+ discarded_args = composed_info[3]
- for var_name, var_value in required_args.items():
- setattr(self, var_name, var_value)
for var_name, var_value in kwargs.items():
- if var_name in unused_args and \
+ if var_name in discarded_args and \
self._configuration is not None and \
self._configuration.discard_unknown_keys and \
- not self._additional_properties_model_instances:
+ self._additional_properties_model_instances:
# discard variable.
continue
setattr(self, var_name, var_value)
diff --git a/samples/client/petstore/python/petstore_api/model/child_lizard_all_of.py b/samples/client/petstore/python/petstore_api/model/child_lizard_all_of.py
index 669b9338d796..1c8f29548b57 100644
--- a/samples/client/petstore/python/petstore_api/model/child_lizard_all_of.py
+++ b/samples/client/petstore/python/petstore_api/model/child_lizard_all_of.py
@@ -57,7 +57,13 @@ class ChildLizardAllOf(ModelNormal):
validations = {
}
- additional_properties_type = None
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
diff --git a/samples/client/petstore/python/petstore_api/model/class_model.py b/samples/client/petstore/python/petstore_api/model/class_model.py
index 18c16f89f908..9e65a9373650 100644
--- a/samples/client/petstore/python/petstore_api/model/class_model.py
+++ b/samples/client/petstore/python/petstore_api/model/class_model.py
@@ -57,7 +57,13 @@ class ClassModel(ModelNormal):
validations = {
}
- additional_properties_type = None
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
diff --git a/samples/client/petstore/python/petstore_api/model/client.py b/samples/client/petstore/python/petstore_api/model/client.py
index da615c547731..6218de1e19e4 100644
--- a/samples/client/petstore/python/petstore_api/model/client.py
+++ b/samples/client/petstore/python/petstore_api/model/client.py
@@ -57,7 +57,13 @@ class Client(ModelNormal):
validations = {
}
- additional_properties_type = None
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
diff --git a/samples/client/petstore/python/petstore_api/model/dog.py b/samples/client/petstore/python/petstore_api/model/dog.py
index e9c201c983bb..3452f0d040a0 100644
--- a/samples/client/petstore/python/petstore_api/model/dog.py
+++ b/samples/client/petstore/python/petstore_api/model/dog.py
@@ -63,7 +63,14 @@ class Dog(ModelComposed):
validations = {
}
- additional_properties_type = None
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ lazy_import()
+ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
@@ -111,13 +118,11 @@ def discriminator():
])
@convert_js_args_to_python_args
- def __init__(self, class_name, *args, **kwargs): # noqa: E501
+ def __init__(self, *args, **kwargs): # noqa: E501
"""Dog - a model defined in OpenAPI
- Args:
- class_name (str):
-
Keyword Args:
+ class_name (str):
_check_type (bool): if True, values for parameters in openapi_types
will be type checked and a TypeError will be
raised if the wrong type is input.
@@ -182,26 +187,18 @@ def __init__(self, class_name, *args, **kwargs): # noqa: E501
'_configuration': _configuration,
'_visited_composed_classes': self._visited_composed_classes,
}
- required_args = {
- 'class_name': class_name,
- }
- model_args = {}
- model_args.update(required_args)
- model_args.update(kwargs)
composed_info = validate_get_composed_info(
- constant_args, model_args, self)
+ constant_args, kwargs, self)
self._composed_instances = composed_info[0]
self._var_name_to_model_instances = composed_info[1]
self._additional_properties_model_instances = composed_info[2]
- unused_args = composed_info[3]
+ discarded_args = composed_info[3]
- for var_name, var_value in required_args.items():
- setattr(self, var_name, var_value)
for var_name, var_value in kwargs.items():
- if var_name in unused_args and \
+ if var_name in discarded_args and \
self._configuration is not None and \
self._configuration.discard_unknown_keys and \
- not self._additional_properties_model_instances:
+ self._additional_properties_model_instances:
# discard variable.
continue
setattr(self, var_name, var_value)
diff --git a/samples/client/petstore/python/petstore_api/model/dog_all_of.py b/samples/client/petstore/python/petstore_api/model/dog_all_of.py
index b7b2e7db66d9..962903d3a381 100644
--- a/samples/client/petstore/python/petstore_api/model/dog_all_of.py
+++ b/samples/client/petstore/python/petstore_api/model/dog_all_of.py
@@ -57,7 +57,13 @@ class DogAllOf(ModelNormal):
validations = {
}
- additional_properties_type = None
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
diff --git a/samples/client/petstore/python/petstore_api/model/enum_arrays.py b/samples/client/petstore/python/petstore_api/model/enum_arrays.py
index 43ebac57de38..db56838d7e49 100644
--- a/samples/client/petstore/python/petstore_api/model/enum_arrays.py
+++ b/samples/client/petstore/python/petstore_api/model/enum_arrays.py
@@ -65,7 +65,13 @@ class EnumArrays(ModelNormal):
validations = {
}
- additional_properties_type = None
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
diff --git a/samples/client/petstore/python/petstore_api/model/enum_class.py b/samples/client/petstore/python/petstore_api/model/enum_class.py
index 14188ca31d28..63be703c38e9 100644
--- a/samples/client/petstore/python/petstore_api/model/enum_class.py
+++ b/samples/client/petstore/python/petstore_api/model/enum_class.py
@@ -58,7 +58,13 @@ class EnumClass(ModelSimple):
validations = {
}
- additional_properties_type = None
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
diff --git a/samples/client/petstore/python/petstore_api/model/enum_test.py b/samples/client/petstore/python/petstore_api/model/enum_test.py
index 79ba0f6a747c..ee14c70b46f2 100644
--- a/samples/client/petstore/python/petstore_api/model/enum_test.py
+++ b/samples/client/petstore/python/petstore_api/model/enum_test.py
@@ -79,7 +79,14 @@ class EnumTest(ModelNormal):
validations = {
}
- additional_properties_type = None
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ lazy_import()
+ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
diff --git a/samples/client/petstore/python/petstore_api/model/file.py b/samples/client/petstore/python/petstore_api/model/file.py
index a38cccacc6ab..137d00263242 100644
--- a/samples/client/petstore/python/petstore_api/model/file.py
+++ b/samples/client/petstore/python/petstore_api/model/file.py
@@ -57,7 +57,13 @@ class File(ModelNormal):
validations = {
}
- additional_properties_type = None
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
diff --git a/samples/client/petstore/python/petstore_api/model/file_schema_test_class.py b/samples/client/petstore/python/petstore_api/model/file_schema_test_class.py
index b8c519ed9c7c..3722125ae485 100644
--- a/samples/client/petstore/python/petstore_api/model/file_schema_test_class.py
+++ b/samples/client/petstore/python/petstore_api/model/file_schema_test_class.py
@@ -61,7 +61,14 @@ class FileSchemaTestClass(ModelNormal):
validations = {
}
- additional_properties_type = None
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ lazy_import()
+ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
diff --git a/samples/client/petstore/python/petstore_api/model/format_test.py b/samples/client/petstore/python/petstore_api/model/format_test.py
index 494ce2646da0..7b415af7ad2c 100644
--- a/samples/client/petstore/python/petstore_api/model/format_test.py
+++ b/samples/client/petstore/python/petstore_api/model/format_test.py
@@ -92,7 +92,13 @@ class FormatTest(ModelNormal):
},
}
- additional_properties_type = None
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
diff --git a/samples/client/petstore/python/petstore_api/model/grandparent.py b/samples/client/petstore/python/petstore_api/model/grandparent.py
index a52744cc3e24..728b1e1d1297 100644
--- a/samples/client/petstore/python/petstore_api/model/grandparent.py
+++ b/samples/client/petstore/python/petstore_api/model/grandparent.py
@@ -57,7 +57,13 @@ class Grandparent(ModelNormal):
validations = {
}
- additional_properties_type = None
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
diff --git a/samples/client/petstore/python/petstore_api/model/grandparent_animal.py b/samples/client/petstore/python/petstore_api/model/grandparent_animal.py
index 48d3f6d9f0b3..089f5a4a07c6 100644
--- a/samples/client/petstore/python/petstore_api/model/grandparent_animal.py
+++ b/samples/client/petstore/python/petstore_api/model/grandparent_animal.py
@@ -67,7 +67,14 @@ class GrandparentAnimal(ModelNormal):
validations = {
}
- additional_properties_type = None
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ lazy_import()
+ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
diff --git a/samples/client/petstore/python/petstore_api/model/has_only_read_only.py b/samples/client/petstore/python/petstore_api/model/has_only_read_only.py
index c94781ae2c46..4ea0bb087217 100644
--- a/samples/client/petstore/python/petstore_api/model/has_only_read_only.py
+++ b/samples/client/petstore/python/petstore_api/model/has_only_read_only.py
@@ -57,7 +57,13 @@ class HasOnlyReadOnly(ModelNormal):
validations = {
}
- additional_properties_type = None
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
diff --git a/samples/client/petstore/python/petstore_api/model/list.py b/samples/client/petstore/python/petstore_api/model/list.py
index 09c762d6a794..11b46f10b565 100644
--- a/samples/client/petstore/python/petstore_api/model/list.py
+++ b/samples/client/petstore/python/petstore_api/model/list.py
@@ -57,7 +57,13 @@ class List(ModelNormal):
validations = {
}
- additional_properties_type = None
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
diff --git a/samples/client/petstore/python/petstore_api/model/map_test.py b/samples/client/petstore/python/petstore_api/model/map_test.py
index 169fb9d88ee0..a5418b39e734 100644
--- a/samples/client/petstore/python/petstore_api/model/map_test.py
+++ b/samples/client/petstore/python/petstore_api/model/map_test.py
@@ -65,7 +65,14 @@ class MapTest(ModelNormal):
validations = {
}
- additional_properties_type = None
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ lazy_import()
+ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
diff --git a/samples/client/petstore/python/petstore_api/model/mixed_properties_and_additional_properties_class.py b/samples/client/petstore/python/petstore_api/model/mixed_properties_and_additional_properties_class.py
index 01df80d9d62b..67b3f79d9e5f 100644
--- a/samples/client/petstore/python/petstore_api/model/mixed_properties_and_additional_properties_class.py
+++ b/samples/client/petstore/python/petstore_api/model/mixed_properties_and_additional_properties_class.py
@@ -61,7 +61,14 @@ class MixedPropertiesAndAdditionalPropertiesClass(ModelNormal):
validations = {
}
- additional_properties_type = None
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ lazy_import()
+ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
diff --git a/samples/client/petstore/python/petstore_api/model/model200_response.py b/samples/client/petstore/python/petstore_api/model/model200_response.py
index 46b155b65239..056f4c56ad35 100644
--- a/samples/client/petstore/python/petstore_api/model/model200_response.py
+++ b/samples/client/petstore/python/petstore_api/model/model200_response.py
@@ -57,7 +57,13 @@ class Model200Response(ModelNormal):
validations = {
}
- additional_properties_type = None
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
diff --git a/samples/client/petstore/python/petstore_api/model/model_return.py b/samples/client/petstore/python/petstore_api/model/model_return.py
index 377b3507a8b3..5f34582cdb4a 100644
--- a/samples/client/petstore/python/petstore_api/model/model_return.py
+++ b/samples/client/petstore/python/petstore_api/model/model_return.py
@@ -57,7 +57,13 @@ class ModelReturn(ModelNormal):
validations = {
}
- additional_properties_type = None
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
diff --git a/samples/client/petstore/python/petstore_api/model/name.py b/samples/client/petstore/python/petstore_api/model/name.py
index 1432e185ad6b..06b387ce9bfe 100644
--- a/samples/client/petstore/python/petstore_api/model/name.py
+++ b/samples/client/petstore/python/petstore_api/model/name.py
@@ -57,7 +57,13 @@ class Name(ModelNormal):
validations = {
}
- additional_properties_type = None
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
diff --git a/samples/client/petstore/python/petstore_api/model/number_only.py b/samples/client/petstore/python/petstore_api/model/number_only.py
index d4892dbede5b..cb2c9e2ad526 100644
--- a/samples/client/petstore/python/petstore_api/model/number_only.py
+++ b/samples/client/petstore/python/petstore_api/model/number_only.py
@@ -57,7 +57,13 @@ class NumberOnly(ModelNormal):
validations = {
}
- additional_properties_type = None
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
diff --git a/samples/client/petstore/python/petstore_api/model/number_with_validations.py b/samples/client/petstore/python/petstore_api/model/number_with_validations.py
index 458a79459751..fb47d885bfd7 100644
--- a/samples/client/petstore/python/petstore_api/model/number_with_validations.py
+++ b/samples/client/petstore/python/petstore_api/model/number_with_validations.py
@@ -57,7 +57,13 @@ class NumberWithValidations(ModelSimple):
},
}
- additional_properties_type = None
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
diff --git a/samples/client/petstore/python/petstore_api/model/object_model_with_ref_props.py b/samples/client/petstore/python/petstore_api/model/object_model_with_ref_props.py
index b1dc4bf82e2c..7256f67a8d6b 100644
--- a/samples/client/petstore/python/petstore_api/model/object_model_with_ref_props.py
+++ b/samples/client/petstore/python/petstore_api/model/object_model_with_ref_props.py
@@ -61,7 +61,14 @@ class ObjectModelWithRefProps(ModelNormal):
validations = {
}
- additional_properties_type = None
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ lazy_import()
+ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
diff --git a/samples/client/petstore/python/petstore_api/model/order.py b/samples/client/petstore/python/petstore_api/model/order.py
index b42f066848ab..48207e4560eb 100644
--- a/samples/client/petstore/python/petstore_api/model/order.py
+++ b/samples/client/petstore/python/petstore_api/model/order.py
@@ -62,7 +62,13 @@ class Order(ModelNormal):
validations = {
}
- additional_properties_type = None
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
diff --git a/samples/client/petstore/python/petstore_api/model/parent.py b/samples/client/petstore/python/petstore_api/model/parent.py
index a5e5d878d844..063d5051747d 100644
--- a/samples/client/petstore/python/petstore_api/model/parent.py
+++ b/samples/client/petstore/python/petstore_api/model/parent.py
@@ -63,7 +63,14 @@ class Parent(ModelComposed):
validations = {
}
- additional_properties_type = None
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ lazy_import()
+ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
@@ -174,25 +181,18 @@ def __init__(self, *args, **kwargs): # noqa: E501
'_configuration': _configuration,
'_visited_composed_classes': self._visited_composed_classes,
}
- required_args = {
- }
- model_args = {}
- model_args.update(required_args)
- model_args.update(kwargs)
composed_info = validate_get_composed_info(
- constant_args, model_args, self)
+ constant_args, kwargs, self)
self._composed_instances = composed_info[0]
self._var_name_to_model_instances = composed_info[1]
self._additional_properties_model_instances = composed_info[2]
- unused_args = composed_info[3]
+ discarded_args = composed_info[3]
- for var_name, var_value in required_args.items():
- setattr(self, var_name, var_value)
for var_name, var_value in kwargs.items():
- if var_name in unused_args and \
+ if var_name in discarded_args and \
self._configuration is not None and \
self._configuration.discard_unknown_keys and \
- not self._additional_properties_model_instances:
+ self._additional_properties_model_instances:
# discard variable.
continue
setattr(self, var_name, var_value)
diff --git a/samples/client/petstore/python/petstore_api/model/parent_all_of.py b/samples/client/petstore/python/petstore_api/model/parent_all_of.py
index 0d109f25a4c2..2f7b8a791d29 100644
--- a/samples/client/petstore/python/petstore_api/model/parent_all_of.py
+++ b/samples/client/petstore/python/petstore_api/model/parent_all_of.py
@@ -57,7 +57,13 @@ class ParentAllOf(ModelNormal):
validations = {
}
- additional_properties_type = None
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
diff --git a/samples/client/petstore/python/petstore_api/model/parent_pet.py b/samples/client/petstore/python/petstore_api/model/parent_pet.py
index aac0ff12e86b..b012d1558a79 100644
--- a/samples/client/petstore/python/petstore_api/model/parent_pet.py
+++ b/samples/client/petstore/python/petstore_api/model/parent_pet.py
@@ -67,7 +67,14 @@ class ParentPet(ModelComposed):
validations = {
}
- additional_properties_type = None
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ lazy_import()
+ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
@@ -115,13 +122,11 @@ def discriminator():
])
@convert_js_args_to_python_args
- def __init__(self, pet_type, *args, **kwargs): # noqa: E501
+ def __init__(self, *args, **kwargs): # noqa: E501
"""ParentPet - a model defined in OpenAPI
- Args:
- pet_type (str):
-
Keyword Args:
+ pet_type (str):
_check_type (bool): if True, values for parameters in openapi_types
will be type checked and a TypeError will be
raised if the wrong type is input.
@@ -184,26 +189,18 @@ def __init__(self, pet_type, *args, **kwargs): # noqa: E501
'_configuration': _configuration,
'_visited_composed_classes': self._visited_composed_classes,
}
- required_args = {
- 'pet_type': pet_type,
- }
- model_args = {}
- model_args.update(required_args)
- model_args.update(kwargs)
composed_info = validate_get_composed_info(
- constant_args, model_args, self)
+ constant_args, kwargs, self)
self._composed_instances = composed_info[0]
self._var_name_to_model_instances = composed_info[1]
self._additional_properties_model_instances = composed_info[2]
- unused_args = composed_info[3]
+ discarded_args = composed_info[3]
- for var_name, var_value in required_args.items():
- setattr(self, var_name, var_value)
for var_name, var_value in kwargs.items():
- if var_name in unused_args and \
+ if var_name in discarded_args and \
self._configuration is not None and \
self._configuration.discard_unknown_keys and \
- not self._additional_properties_model_instances:
+ self._additional_properties_model_instances:
# discard variable.
continue
setattr(self, var_name, var_value)
diff --git a/samples/client/petstore/python/petstore_api/model/pet.py b/samples/client/petstore/python/petstore_api/model/pet.py
index e9f1e30a3196..b0c8b08607d1 100644
--- a/samples/client/petstore/python/petstore_api/model/pet.py
+++ b/samples/client/petstore/python/petstore_api/model/pet.py
@@ -68,7 +68,14 @@ class Pet(ModelNormal):
validations = {
}
- additional_properties_type = None
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ lazy_import()
+ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
diff --git a/samples/client/petstore/python/petstore_api/model/player.py b/samples/client/petstore/python/petstore_api/model/player.py
index 6e4485fb6500..2c51f9b57af7 100644
--- a/samples/client/petstore/python/petstore_api/model/player.py
+++ b/samples/client/petstore/python/petstore_api/model/player.py
@@ -57,7 +57,13 @@ class Player(ModelNormal):
validations = {
}
- additional_properties_type = None
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
diff --git a/samples/client/petstore/python/petstore_api/model/read_only_first.py b/samples/client/petstore/python/petstore_api/model/read_only_first.py
index 5c68eab91ea3..0302bf96a7e5 100644
--- a/samples/client/petstore/python/petstore_api/model/read_only_first.py
+++ b/samples/client/petstore/python/petstore_api/model/read_only_first.py
@@ -57,7 +57,13 @@ class ReadOnlyFirst(ModelNormal):
validations = {
}
- additional_properties_type = None
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
diff --git a/samples/client/petstore/python/petstore_api/model/special_model_name.py b/samples/client/petstore/python/petstore_api/model/special_model_name.py
index 823e77596636..cfaedbc78815 100644
--- a/samples/client/petstore/python/petstore_api/model/special_model_name.py
+++ b/samples/client/petstore/python/petstore_api/model/special_model_name.py
@@ -57,7 +57,13 @@ class SpecialModelName(ModelNormal):
validations = {
}
- additional_properties_type = None
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
diff --git a/samples/client/petstore/python/petstore_api/model/string_enum.py b/samples/client/petstore/python/petstore_api/model/string_enum.py
index 37dc04332cac..4c92316cb7e0 100644
--- a/samples/client/petstore/python/petstore_api/model/string_enum.py
+++ b/samples/client/petstore/python/petstore_api/model/string_enum.py
@@ -58,7 +58,13 @@ class StringEnum(ModelSimple):
validations = {
}
- additional_properties_type = None
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
diff --git a/samples/client/petstore/python/petstore_api/model/tag.py b/samples/client/petstore/python/petstore_api/model/tag.py
index d3dcb78b7ea0..01c28233598b 100644
--- a/samples/client/petstore/python/petstore_api/model/tag.py
+++ b/samples/client/petstore/python/petstore_api/model/tag.py
@@ -57,7 +57,13 @@ class Tag(ModelNormal):
validations = {
}
- additional_properties_type = None
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
diff --git a/samples/client/petstore/python/petstore_api/model/type_holder_default.py b/samples/client/petstore/python/petstore_api/model/type_holder_default.py
index 324b131f3a2d..04a96f7e9060 100644
--- a/samples/client/petstore/python/petstore_api/model/type_holder_default.py
+++ b/samples/client/petstore/python/petstore_api/model/type_holder_default.py
@@ -57,7 +57,13 @@ class TypeHolderDefault(ModelNormal):
validations = {
}
- additional_properties_type = None
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
diff --git a/samples/client/petstore/python/petstore_api/model/type_holder_example.py b/samples/client/petstore/python/petstore_api/model/type_holder_example.py
index 30bbba178f4f..f6e5f44c389b 100644
--- a/samples/client/petstore/python/petstore_api/model/type_holder_example.py
+++ b/samples/client/petstore/python/petstore_api/model/type_holder_example.py
@@ -66,7 +66,13 @@ class TypeHolderExample(ModelNormal):
validations = {
}
- additional_properties_type = None
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
diff --git a/samples/client/petstore/python/petstore_api/model/user.py b/samples/client/petstore/python/petstore_api/model/user.py
index 9a3cd0814114..64bd69849330 100644
--- a/samples/client/petstore/python/petstore_api/model/user.py
+++ b/samples/client/petstore/python/petstore_api/model/user.py
@@ -57,7 +57,13 @@ class User(ModelNormal):
validations = {
}
- additional_properties_type = None
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
diff --git a/samples/client/petstore/python/petstore_api/model/xml_item.py b/samples/client/petstore/python/petstore_api/model/xml_item.py
index 8401b3f40076..ba096779721b 100644
--- a/samples/client/petstore/python/petstore_api/model/xml_item.py
+++ b/samples/client/petstore/python/petstore_api/model/xml_item.py
@@ -57,7 +57,13 @@ class XmlItem(ModelNormal):
validations = {
}
- additional_properties_type = None
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
diff --git a/samples/client/petstore/python/petstore_api/model_utils.py b/samples/client/petstore/python/petstore_api/model_utils.py
index ae5547106703..b6d5934170a3 100644
--- a/samples/client/petstore/python/petstore_api/model_utils.py
+++ b/samples/client/petstore/python/petstore_api/model_utils.py
@@ -434,27 +434,43 @@ def __setitem__(self, name, value):
self.__dict__[name] = value
return
- # set the attribute on the correct instance
- model_instances = self._var_name_to_model_instances.get(
- name, self._additional_properties_model_instances)
- if model_instances:
- for model_instance in model_instances:
- if model_instance == self:
- self.set_attribute(name, value)
- else:
- setattr(model_instance, name, value)
- if name not in self._var_name_to_model_instances:
- # we assigned an additional property
- self.__dict__['_var_name_to_model_instances'][name] = (
- model_instance
- )
- return None
-
- raise ApiAttributeError(
- "{0} has no attribute '{1}'".format(
- type(self).__name__, name),
- [e for e in [self._path_to_item, name] if e]
- )
+ """
+ Use cases:
+ 1. additional_properties_type is None (additionalProperties == False in spec)
+ Check for property presence in self.openapi_types
+ if not present then throw an error
+ if present set in self, set attribute
+ always set on composed schemas
+ 2. additional_properties_type exists
+ set attribute on self
+ always set on composed schemas
+ """
+ if self.additional_properties_type is None:
+ """
+ For an attribute to exist on a composed schema it must:
+ - fulfill schema_requirements in the self composed schema not considering oneOf/anyOf/allOf schemas AND
+ - fulfill schema_requirements in each oneOf/anyOf/allOf schemas
+
+ schema_requirements:
+ For an attribute to exist on a schema it must:
+ - be present in properties at the schema OR
+ - have additionalProperties unset (defaults additionalProperties = any type) OR
+ - have additionalProperties set
+ """
+ if name not in self.openapi_types:
+ raise ApiAttributeError(
+ "{0} has no attribute '{1}'".format(
+ type(self).__name__, name),
+ [e for e in [self._path_to_item, name] if e]
+ )
+ # attribute must be set on self and composed instances
+ self.set_attribute(name, value)
+ for model_instance in self._composed_instances:
+ setattr(model_instance, name, value)
+ if name not in self._var_name_to_model_instances:
+ # we assigned an additional property
+ self.__dict__['_var_name_to_model_instances'][name] = self._composed_instances + [self]
+ return None
__unset_attribute_value__ = object()
@@ -464,13 +480,12 @@ def get(self, name, default=None):
return self.__dict__[name]
# get the attribute from the correct instance
- model_instances = self._var_name_to_model_instances.get(
- name, self._additional_properties_model_instances)
+ model_instances = self._var_name_to_model_instances.get(name)
values = []
- # A composed model stores child (oneof/anyOf/allOf) models under
- # self._var_name_to_model_instances. A named property can exist in
- # multiple child models. If the property is present in more than one
- # child model, the value must be the same across all the child models.
+ # A composed model stores self and child (oneof/anyOf/allOf) models under
+ # self._var_name_to_model_instances.
+ # Any property must exist in self and all model instances
+ # The value stored in all model instances must be the same
if model_instances:
for model_instance in model_instances:
if name in model_instance._data_store:
@@ -1573,8 +1588,13 @@ def get_allof_instances(self, model_args, constant_args):
self: the class we are handling
model_args (dict): var_name to var_value
used to make instances
- constant_args (dict): var_name to var_value
- used to make instances
+ constant_args (dict):
+ metadata arguments:
+ _check_type
+ _path_to_item
+ _spec_property_naming
+ _configuration
+ _visited_composed_classes
Returns
composed_instances (list)
@@ -1582,20 +1602,8 @@ def get_allof_instances(self, model_args, constant_args):
composed_instances = []
for allof_class in self._composed_schemas['allOf']:
- # no need to handle changing js keys to python because
- # for composed schemas, allof parameters are included in the
- # composed schema and were changed to python keys in __new__
- # extract a dict of only required keys from fixed_model_args
- kwargs = {}
- var_names = set(allof_class.openapi_types.keys())
- for var_name in var_names:
- if var_name in model_args:
- kwargs[var_name] = model_args[var_name]
-
- # and use it to make the instance
- kwargs.update(constant_args)
try:
- allof_instance = allof_class(**kwargs)
+ allof_instance = allof_class(**model_args, **constant_args)
composed_instances.append(allof_instance)
except Exception as ex:
raise ApiValueError(
@@ -1655,31 +1663,9 @@ def get_oneof_instance(cls, model_kwargs, constant_kwargs, model_arg=None):
single_value_input = allows_single_value_input(oneof_class)
- if not single_value_input:
- # transform js keys from input data to python keys in fixed_model_args
- fixed_model_args = change_keys_js_to_python(
- model_kwargs, oneof_class)
-
- # Extract a dict with the properties that are declared in the oneOf schema.
- # Undeclared properties (e.g. properties that are allowed because of the
- # additionalProperties attribute in the OAS document) are not added to
- # the dict.
- kwargs = {}
- var_names = set(oneof_class.openapi_types.keys())
- for var_name in var_names:
- if var_name in fixed_model_args:
- kwargs[var_name] = fixed_model_args[var_name]
-
- # do not try to make a model with no input args
- if len(kwargs) == 0:
- continue
-
- # and use it to make the instance
- kwargs.update(constant_kwargs)
-
try:
if not single_value_input:
- oneof_instance = oneof_class(**kwargs)
+ oneof_instance = oneof_class(**model_kwargs, **constant_kwargs)
else:
if issubclass(oneof_class, ModelSimple):
oneof_instance = oneof_class(model_arg, **constant_kwargs)
@@ -1736,24 +1722,8 @@ def get_anyof_instances(self, model_args, constant_args):
# none_type deserialization is handled in the __new__ method
continue
- # transform js keys to python keys in fixed_model_args
- fixed_model_args = change_keys_js_to_python(model_args, anyof_class)
-
- # extract a dict of only required keys from these_model_vars
- kwargs = {}
- var_names = set(anyof_class.openapi_types.keys())
- for var_name in var_names:
- if var_name in fixed_model_args:
- kwargs[var_name] = fixed_model_args[var_name]
-
- # do not try to make a model with no input args
- if len(kwargs) == 0:
- continue
-
- # and use it to make the instance
- kwargs.update(constant_args)
try:
- anyof_instance = anyof_class(**kwargs)
+ anyof_instance = anyof_class(**model_args, **constant_args)
anyof_instances.append(anyof_instance)
except Exception:
pass
@@ -1766,47 +1736,34 @@ def get_anyof_instances(self, model_args, constant_args):
return anyof_instances
-def get_additional_properties_model_instances(
- composed_instances, self):
- additional_properties_model_instances = []
- all_instances = [self]
- all_instances.extend(composed_instances)
- for instance in all_instances:
- if instance.additional_properties_type is not None:
- additional_properties_model_instances.append(instance)
- return additional_properties_model_instances
-
-
-def get_var_name_to_model_instances(self, composed_instances):
- var_name_to_model_instances = {}
- all_instances = [self]
- all_instances.extend(composed_instances)
- for instance in all_instances:
- for var_name in instance.openapi_types:
- if var_name not in var_name_to_model_instances:
- var_name_to_model_instances[var_name] = [instance]
- else:
- var_name_to_model_instances[var_name].append(instance)
- return var_name_to_model_instances
-
-
-def get_unused_args(self, composed_instances, model_args):
- unused_args = dict(model_args)
- # arguments apssed to self were already converted to python names
+def get_discarded_args(self, composed_instances, model_args):
+ """
+ Gathers the args that were discarded by configuration.discard_unknown_keys
+ """
+ model_arg_keys = model_args.keys()
+ discarded_args = set()
+ # arguments passed to self were already converted to python names
# before __init__ was called
- for var_name_py in self.attribute_map:
- if var_name_py in unused_args:
- del unused_args[var_name_py]
for instance in composed_instances:
if instance.__class__ in self._composed_schemas['allOf']:
- for var_name_py in instance.attribute_map:
- if var_name_py in unused_args:
- del unused_args[var_name_py]
+ try:
+ keys = instance.to_dict().keys()
+ discarded_keys = model_args - keys
+ discarded_args.update(discarded_keys)
+ except Exception:
+ # allOf integer schema will throw exception
+ pass
else:
- for var_name_js in instance.attribute_map.values():
- if var_name_js in unused_args:
- del unused_args[var_name_js]
- return unused_args
+ try:
+ all_keys = set(model_to_dict(instance, serialize=False).keys())
+ js_keys = model_to_dict(instance, serialize=True).keys()
+ all_keys.update(js_keys)
+ discarded_keys = model_arg_keys - all_keys
+ discarded_args.update(discarded_keys)
+ except Exception:
+ # allOf integer schema will throw exception
+ pass
+ return discarded_args
def validate_get_composed_info(constant_args, model_args, self):
@@ -1850,36 +1807,42 @@ def validate_get_composed_info(constant_args, model_args, self):
composed_instances.append(oneof_instance)
anyof_instances = get_anyof_instances(self, model_args, constant_args)
composed_instances.extend(anyof_instances)
+ """
+ set additional_properties_model_instances
+ additional properties must be evaluated at the schema level
+ so self's additional properties are most important
+ If self is a composed schema with:
+ - no properties defined in self
+ - additionalProperties: False
+ Then for object payloads every property is an additional property
+ and they are not allowed, so only empty dict is allowed
+
+ Properties must be set on all matching schemas
+ so when a property is assigned toa composed instance, it must be set on all
+ composed instances regardless of additionalProperties presence
+ keeping it to prevent breaking changes in v5.0.1
+ TODO remove cls._additional_properties_model_instances in 6.0.0
+ """
+ additional_properties_model_instances = []
+ if self.additional_properties_type is not None:
+ additional_properties_model_instances = [self]
- # map variable names to composed_instances
- var_name_to_model_instances = get_var_name_to_model_instances(
- self, composed_instances)
-
- # set additional_properties_model_instances
- additional_properties_model_instances = (
- get_additional_properties_model_instances(composed_instances, self)
- )
-
- # set any remaining values
- unused_args = get_unused_args(self, composed_instances, model_args)
- if len(unused_args) > 0 and \
- len(additional_properties_model_instances) == 0 and \
- (self._configuration is None or
- not self._configuration.discard_unknown_keys):
- raise ApiValueError(
- "Invalid input arguments input when making an instance of "
- "class %s. Not all inputs were used. The unused input data "
- "is %s" % (self.__class__.__name__, unused_args)
- )
+ """
+ no need to set properties on self in here, they will be set in __init__
+ By here all composed schema oneOf/anyOf/allOf instances have their properties set using
+ model_args
+ """
+ discarded_args = get_discarded_args(self, composed_instances, model_args)
- # no need to add additional_properties to var_name_to_model_instances here
- # because additional_properties_model_instances will direct us to that
- # instance when we use getattr or setattr
- # and we update var_name_to_model_instances in setattr
+ # map variable names to composed_instances
+ var_name_to_model_instances = {}
+ for prop_name in model_args:
+ if prop_name not in discarded_args:
+ var_name_to_model_instances[prop_name] = [self] + composed_instances
return [
composed_instances,
var_name_to_model_instances,
additional_properties_model_instances,
- unused_args
+ discarded_args
]
diff --git a/samples/client/petstore/python/pom.xml b/samples/client/petstore/python/pom.xml
index 9dc399cc8089..f6178c5c09c8 100644
--- a/samples/client/petstore/python/pom.xml
+++ b/samples/client/petstore/python/pom.xml
@@ -1,10 +1,10 @@
4.0.0
org.openapitools
- PythonExperimentalPetstoreClientTests
+ PythonV2PetstoreClientTestsWithComposition
pom
1.0-SNAPSHOT
- Python Experimental OpenAPI Petstore Client
+ Python OpenAPI Petstore Client
diff --git a/samples/client/petstore/python/test/test_child.py b/samples/client/petstore/python/test/test_child.py
index 3b49febd9532..88e6b9ed4a8e 100644
--- a/samples/client/petstore/python/test/test_child.py
+++ b/samples/client/petstore/python/test/test_child.py
@@ -73,14 +73,6 @@ def testChild(self):
}
)
- # setting a value that doesn't exist raises an exception
- # with a key
- with self.assertRaises(petstore_api.ApiAttributeError):
- child['invalid_variable'] = 'some value'
- # with setattr
- with self.assertRaises(petstore_api.ApiAttributeError):
- setattr(child, 'invalid_variable', 'some value')
-
# with hasattr
self.assertFalse(hasattr(child, 'invalid_variable'))
@@ -123,17 +115,26 @@ def testChild(self):
self.assertEqual(
child._var_name_to_model_instances,
{
- 'radio_waves': [child, parent_instance],
- 'tele_vision': [child, parent_instance],
- 'inter_net': [child, child_allof_instance]
+ 'radio_waves': [child, child_allof_instance, parent_instance],
+ 'tele_vision': [child, child_allof_instance, parent_instance],
+ 'inter_net': [child, child_allof_instance, parent_instance]
}
)
# model._additional_properties_model_instances stores a list of
# models which have the property additional_properties_type != None
self.assertEqual(
- child._additional_properties_model_instances, []
+ child._additional_properties_model_instances, [child]
)
+ # setting a value that doesn't exist works
+ # with a key
+ child['invalid_variable'] = 'a'
+ assert child.invalid_variable == 'a'
+ # with setattr
+ setattr(child, 'invalid_variable', 'b')
+ assert child.invalid_variable == 'b'
+
+
# if we modify one of the properties owned by multiple
# model_instances we get an exception when we try to access that
# property because the retrieved values are not all the same
@@ -141,13 +142,13 @@ def testChild(self):
with self.assertRaises(petstore_api.ApiValueError):
inter_net = child.inter_net
- # including extra parameters raises an exception
- with self.assertRaises(petstore_api.ApiValueError):
- child = Child(
- radio_waves=radio_waves,
- tele_vision=tele_vision,
- inter_net=inter_net,
- unknown_property='some value')
+ # including extra parameters works
+ child = Child(
+ radio_waves=radio_waves,
+ tele_vision=tele_vision,
+ inter_net=inter_net,
+ unknown_property='some value')
+ assert child.unknown_property == 'some value'
if __name__ == '__main__':
unittest.main()
diff --git a/samples/client/petstore/python/test/test_dog.py b/samples/client/petstore/python/test/test_dog.py
index 0b95c0a4c83a..0352d794c928 100644
--- a/samples/client/petstore/python/test/test_dog.py
+++ b/samples/client/petstore/python/test/test_dog.py
@@ -73,23 +73,15 @@ def testDog(self):
}
)
- # setting a value that doesn't exist raises an exception
- # with a key
- with self.assertRaises(AttributeError):
- dog['invalid_variable'] = 'some value'
- # with setattr
- with self.assertRaises(AttributeError):
- setattr(dog, 'invalid_variable', 'some value')
-
# getting a value that doesn't exist raises an exception
# with a key
with self.assertRaises(AttributeError):
- invalid_variable = dog['invalid_variable']
+ invalid_variable = dog['not_here_a']
# with getattr
- self.assertEqual(getattr(dog, 'invalid_variable', 'some value'), 'some value')
+ self.assertEqual(getattr(dog, 'not_here_a', 'some value'), 'some value')
with self.assertRaises(AttributeError):
- invalid_variable = getattr(dog, 'invalid_variable')
+ invalid_variable = getattr(dog, 'not_here_a')
# make sure that the ModelComposed class properties are correct
# model.composed_schemas() stores the anyOf/allOf/oneOf info
@@ -120,17 +112,25 @@ def testDog(self):
self.assertEqual(
dog._var_name_to_model_instances,
{
- 'breed': [dog, dog_allof_instance],
- 'class_name': [dog, animal_instance],
- 'color': [dog, animal_instance]
+ 'breed': [dog, animal_instance, dog_allof_instance],
+ 'class_name': [dog, animal_instance, dog_allof_instance],
+ 'color': [dog, animal_instance, dog_allof_instance]
}
)
# model._additional_properties_model_instances stores a list of
# models which have the property additional_properties_type != None
self.assertEqual(
- dog._additional_properties_model_instances, []
+ dog._additional_properties_model_instances, [dog]
)
+ # setting a value that doesn't exist works
+ dog['invalid_variable'] = 'a'
+ assert dog.invalid_variable == 'a'
+
+ # with setattr
+ setattr(dog, 'invalid_variable', 'b')
+ assert dog.invalid_variable == 'b'
+
# if we modify one of the properties owned by multiple
# model_instances we get an exception when we try to access that
# property because the retrieved values are not all the same
@@ -138,14 +138,14 @@ def testDog(self):
with self.assertRaises(petstore_api.ApiValueError):
breed = dog.breed
- # including extra parameters raises an exception
- with self.assertRaises(petstore_api.ApiValueError):
- dog = Dog(
- class_name=class_name,
- color=color,
- breed=breed,
- unknown_property='some value'
- )
+ # including extra parameters works
+ dog = Dog(
+ class_name=class_name,
+ color=color,
+ breed=breed,
+ unknown_property='some value'
+ )
+ assert dog.unknown_property == 'some value'
if __name__ == '__main__':
unittest.main()
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/.gitignore b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/.gitignore
new file mode 100644
index 000000000000..43995bd42fa2
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/.gitignore
@@ -0,0 +1,66 @@
+# Byte-compiled / optimized / DLL files
+__pycache__/
+*.py[cod]
+*$py.class
+
+# C extensions
+*.so
+
+# Distribution / packaging
+.Python
+env/
+build/
+develop-eggs/
+dist/
+downloads/
+eggs/
+.eggs/
+lib/
+lib64/
+parts/
+sdist/
+var/
+*.egg-info/
+.installed.cfg
+*.egg
+
+# PyInstaller
+# Usually these files are written by a python script from a template
+# before PyInstaller builds the exe, so as to inject date/other infos into it.
+*.manifest
+*.spec
+
+# Installer logs
+pip-log.txt
+pip-delete-this-directory.txt
+
+# Unit test / coverage reports
+htmlcov/
+.tox/
+.coverage
+.coverage.*
+.cache
+nosetests.xml
+coverage.xml
+*,cover
+.hypothesis/
+venv/
+.venv/
+.python-version
+.pytest_cache
+
+# Translations
+*.mo
+*.pot
+
+# Django stuff:
+*.log
+
+# Sphinx documentation
+docs/_build/
+
+# PyBuilder
+target/
+
+#Ipython Notebook
+.ipynb_checkpoints
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/.gitlab-ci.yml b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/.gitlab-ci.yml
new file mode 100644
index 000000000000..9e84f5176163
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/.gitlab-ci.yml
@@ -0,0 +1,24 @@
+# ref: https://docs.gitlab.com/ee/ci/README.html
+
+stages:
+ - test
+
+.tests:
+ stage: test
+ script:
+ - pip install -r requirements.txt
+ - pip install -r test-requirements.txt
+ - pytest --cov=petstore_api
+
+test-3.6:
+ extends: .tests
+ image: python:3.6-alpine
+test-3.7:
+ extends: .tests
+ image: python:3.7-alpine
+test-3.8:
+ extends: .tests
+ image: python:3.8-alpine
+test-3.9:
+ extends: .tests
+ image: python:3.9-alpine
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/.openapi-generator-ignore b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/.openapi-generator-ignore
new file mode 100644
index 000000000000..7484ee590a38
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/.openapi-generator-ignore
@@ -0,0 +1,23 @@
+# OpenAPI Generator Ignore
+# Generated by openapi-generator https://github.com/openapitools/openapi-generator
+
+# Use this file to prevent files from being overwritten by the generator.
+# The patterns follow closely to .gitignore or .dockerignore.
+
+# As an example, the C# client generator defines ApiClient.cs.
+# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
+#ApiClient.cs
+
+# You can match any string of characters against a directory, file or extension with a single asterisk (*):
+#foo/*/qux
+# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
+
+# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
+#foo/**/qux
+# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
+
+# You can also negate patterns with an exclamation (!).
+# For example, you can ignore all files in a docs folder with the file extension .md:
+#docs/*.md
+# Then explicitly reverse the ignore rule for a single file:
+#!docs/README.md
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/.openapi-generator/FILES b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/.openapi-generator/FILES
new file mode 100644
index 000000000000..94732e37243f
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/.openapi-generator/FILES
@@ -0,0 +1,160 @@
+.gitignore
+.gitlab-ci.yml
+.travis.yml
+README.md
+docs/AdditionalPropertiesAnyType.md
+docs/AdditionalPropertiesArray.md
+docs/AdditionalPropertiesBoolean.md
+docs/AdditionalPropertiesClass.md
+docs/AdditionalPropertiesInteger.md
+docs/AdditionalPropertiesNumber.md
+docs/AdditionalPropertiesObject.md
+docs/AdditionalPropertiesString.md
+docs/Animal.md
+docs/AnimalFarm.md
+docs/AnotherFakeApi.md
+docs/ApiResponse.md
+docs/ArrayOfArrayOfNumberOnly.md
+docs/ArrayOfNumberOnly.md
+docs/ArrayTest.md
+docs/Capitalization.md
+docs/Cat.md
+docs/CatAllOf.md
+docs/Category.md
+docs/Child.md
+docs/ChildAllOf.md
+docs/ChildCat.md
+docs/ChildCatAllOf.md
+docs/ChildDog.md
+docs/ChildDogAllOf.md
+docs/ChildLizard.md
+docs/ChildLizardAllOf.md
+docs/ClassModel.md
+docs/Client.md
+docs/Dog.md
+docs/DogAllOf.md
+docs/EnumArrays.md
+docs/EnumClass.md
+docs/EnumTest.md
+docs/FakeApi.md
+docs/FakeClassnameTags123Api.md
+docs/File.md
+docs/FileSchemaTestClass.md
+docs/FormatTest.md
+docs/Grandparent.md
+docs/GrandparentAnimal.md
+docs/HasOnlyReadOnly.md
+docs/List.md
+docs/MapTest.md
+docs/MixedPropertiesAndAdditionalPropertiesClass.md
+docs/Model200Response.md
+docs/ModelReturn.md
+docs/Name.md
+docs/NumberOnly.md
+docs/NumberWithValidations.md
+docs/ObjectModelWithRefProps.md
+docs/Order.md
+docs/Parent.md
+docs/ParentAllOf.md
+docs/ParentPet.md
+docs/Pet.md
+docs/PetApi.md
+docs/Player.md
+docs/ReadOnlyFirst.md
+docs/SpecialModelName.md
+docs/StoreApi.md
+docs/StringBooleanMap.md
+docs/StringEnum.md
+docs/Tag.md
+docs/TypeHolderDefault.md
+docs/TypeHolderExample.md
+docs/User.md
+docs/UserApi.md
+docs/XmlItem.md
+git_push.sh
+petstore_api/__init__.py
+petstore_api/api/__init__.py
+petstore_api/api/another_fake_api.py
+petstore_api/api/fake_api.py
+petstore_api/api/fake_classname_tags_123_api.py
+petstore_api/api/pet_api.py
+petstore_api/api/store_api.py
+petstore_api/api/user_api.py
+petstore_api/api_client.py
+petstore_api/apis/__init__.py
+petstore_api/configuration.py
+petstore_api/exceptions.py
+petstore_api/model/__init__.py
+petstore_api/model/additional_properties_any_type.py
+petstore_api/model/additional_properties_array.py
+petstore_api/model/additional_properties_boolean.py
+petstore_api/model/additional_properties_class.py
+petstore_api/model/additional_properties_integer.py
+petstore_api/model/additional_properties_number.py
+petstore_api/model/additional_properties_object.py
+petstore_api/model/additional_properties_string.py
+petstore_api/model/animal.py
+petstore_api/model/animal_farm.py
+petstore_api/model/api_response.py
+petstore_api/model/array_of_array_of_number_only.py
+petstore_api/model/array_of_number_only.py
+petstore_api/model/array_test.py
+petstore_api/model/capitalization.py
+petstore_api/model/cat.py
+petstore_api/model/cat_all_of.py
+petstore_api/model/category.py
+petstore_api/model/child.py
+petstore_api/model/child_all_of.py
+petstore_api/model/child_cat.py
+petstore_api/model/child_cat_all_of.py
+petstore_api/model/child_dog.py
+petstore_api/model/child_dog_all_of.py
+petstore_api/model/child_lizard.py
+petstore_api/model/child_lizard_all_of.py
+petstore_api/model/class_model.py
+petstore_api/model/client.py
+petstore_api/model/dog.py
+petstore_api/model/dog_all_of.py
+petstore_api/model/enum_arrays.py
+petstore_api/model/enum_class.py
+petstore_api/model/enum_test.py
+petstore_api/model/file.py
+petstore_api/model/file_schema_test_class.py
+petstore_api/model/format_test.py
+petstore_api/model/grandparent.py
+petstore_api/model/grandparent_animal.py
+petstore_api/model/has_only_read_only.py
+petstore_api/model/list.py
+petstore_api/model/map_test.py
+petstore_api/model/mixed_properties_and_additional_properties_class.py
+petstore_api/model/model200_response.py
+petstore_api/model/model_return.py
+petstore_api/model/name.py
+petstore_api/model/number_only.py
+petstore_api/model/number_with_validations.py
+petstore_api/model/object_model_with_ref_props.py
+petstore_api/model/order.py
+petstore_api/model/parent.py
+petstore_api/model/parent_all_of.py
+petstore_api/model/parent_pet.py
+petstore_api/model/pet.py
+petstore_api/model/player.py
+petstore_api/model/read_only_first.py
+petstore_api/model/special_model_name.py
+petstore_api/model/string_boolean_map.py
+petstore_api/model/string_enum.py
+petstore_api/model/tag.py
+petstore_api/model/type_holder_default.py
+petstore_api/model/type_holder_example.py
+petstore_api/model/user.py
+petstore_api/model/xml_item.py
+petstore_api/model_utils.py
+petstore_api/models/__init__.py
+petstore_api/models/__init__.py
+petstore_api/rest.py
+requirements.txt
+setup.cfg
+setup.py
+test-requirements.txt
+test/__init__.py
+tox.ini
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/.openapi-generator/VERSION b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/.openapi-generator/VERSION
new file mode 100644
index 000000000000..d509cc92aa80
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/.openapi-generator/VERSION
@@ -0,0 +1 @@
+5.1.1-SNAPSHOT
\ No newline at end of file
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/.travis.yml b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/.travis.yml
new file mode 100644
index 000000000000..1fcc4b155964
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/.travis.yml
@@ -0,0 +1,13 @@
+# ref: https://docs.travis-ci.com/user/languages/python
+language: python
+python:
+ - "3.6"
+ - "3.7"
+ - "3.8"
+ - "3.9"
+# command to install dependencies
+install:
+ - "pip install -r requirements.txt"
+ - "pip install -r test-requirements.txt"
+# command to run tests
+script: pytest --cov=petstore_api
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/Makefile b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/Makefile
new file mode 100644
index 000000000000..a6bbba4a434f
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/Makefile
@@ -0,0 +1,18 @@
+ #!/bin/bash
+
+REQUIREMENTS_FILE=dev-requirements.txt
+REQUIREMENTS_OUT=dev-requirements.txt.log
+SETUP_OUT=*.egg-info
+VENV=venv
+
+clean:
+ rm -rf $(REQUIREMENTS_OUT)
+ rm -rf $(SETUP_OUT)
+ rm -rf $(VENV)
+ rm -rf .tox
+ rm -rf .coverage
+ find . -name "*.py[oc]" -delete
+ find . -name "__pycache__" -delete
+
+test: clean
+ bash ./test_python.sh
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/README.md b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/README.md
new file mode 100644
index 000000000000..5f53c0f64235
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/README.md
@@ -0,0 +1,247 @@
+# petstore-api
+This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+
+This Python package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
+
+- API version: 1.0.0
+- Package version: 1.0.0
+- Build package: org.openapitools.codegen.languages.PythonClientCodegen
+
+## Requirements.
+
+Python >= 3.6
+
+## Installation & Usage
+### pip install
+
+If the python package is hosted on a repository, you can install directly using:
+
+```sh
+pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git
+```
+(you may need to run `pip` with root permission: `sudo pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git`)
+
+Then import the package:
+```python
+import petstore_api
+```
+
+### Setuptools
+
+Install via [Setuptools](http://pypi.python.org/pypi/setuptools).
+
+```sh
+python setup.py install --user
+```
+(or `sudo python setup.py install` to install the package for all users)
+
+Then import the package:
+```python
+import petstore_api
+```
+
+## Getting Started
+
+Please follow the [installation procedure](#installation--usage) and then run the following:
+
+```python
+
+import time
+import petstore_api
+from pprint import pprint
+from petstore_api.api import another_fake_api
+from petstore_api.model.client import Client
+# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2
+# See configuration.py for a list of all supported configuration parameters.
+configuration = petstore_api.Configuration(
+ host = "http://petstore.swagger.io:80/v2"
+)
+
+
+
+# Enter a context with an instance of the API client
+with petstore_api.ApiClient(configuration) as api_client:
+ # Create an instance of the API class
+ api_instance = another_fake_api.AnotherFakeApi(api_client)
+ body = Client(
+ client="client_example",
+ ) # Client | client model
+
+ try:
+ # To test special tags
+ api_response = api_instance.call_123_test_special_tags(body)
+ pprint(api_response)
+ except petstore_api.ApiException as e:
+ print("Exception when calling AnotherFakeApi->call_123_test_special_tags: %s\n" % e)
+```
+
+## Documentation for API Endpoints
+
+All URIs are relative to *http://petstore.swagger.io:80/v2*
+
+Class | Method | HTTP request | Description
+------------ | ------------- | ------------- | -------------
+*AnotherFakeApi* | [**call_123_test_special_tags**](docs/AnotherFakeApi.md#call_123_test_special_tags) | **PATCH** /another-fake/dummy | To test special tags
+*FakeApi* | [**array_model**](docs/FakeApi.md#array_model) | **POST** /fake/refs/arraymodel |
+*FakeApi* | [**boolean**](docs/FakeApi.md#boolean) | **POST** /fake/refs/boolean |
+*FakeApi* | [**create_xml_item**](docs/FakeApi.md#create_xml_item) | **POST** /fake/create_xml_item | creates an XmlItem
+*FakeApi* | [**number_with_validations**](docs/FakeApi.md#number_with_validations) | **POST** /fake/refs/number |
+*FakeApi* | [**object_model_with_ref_props**](docs/FakeApi.md#object_model_with_ref_props) | **POST** /fake/refs/object_model_with_ref_props |
+*FakeApi* | [**string**](docs/FakeApi.md#string) | **POST** /fake/refs/string |
+*FakeApi* | [**string_enum**](docs/FakeApi.md#string_enum) | **POST** /fake/refs/enum |
+*FakeApi* | [**test_body_with_file_schema**](docs/FakeApi.md#test_body_with_file_schema) | **PUT** /fake/body-with-file-schema |
+*FakeApi* | [**test_body_with_query_params**](docs/FakeApi.md#test_body_with_query_params) | **PUT** /fake/body-with-query-params |
+*FakeApi* | [**test_client_model**](docs/FakeApi.md#test_client_model) | **PATCH** /fake | To test \"client\" model
+*FakeApi* | [**test_endpoint_enums_length_one**](docs/FakeApi.md#test_endpoint_enums_length_one) | **PUT** /fake/enums-of-length-one/{path_string}/{path_integer} |
+*FakeApi* | [**test_endpoint_parameters**](docs/FakeApi.md#test_endpoint_parameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
+*FakeApi* | [**test_enum_parameters**](docs/FakeApi.md#test_enum_parameters) | **GET** /fake | To test enum parameters
+*FakeApi* | [**test_group_parameters**](docs/FakeApi.md#test_group_parameters) | **DELETE** /fake | Fake endpoint to test group parameters (optional)
+*FakeApi* | [**test_inline_additional_properties**](docs/FakeApi.md#test_inline_additional_properties) | **POST** /fake/inline-additionalProperties | test inline additionalProperties
+*FakeApi* | [**test_json_form_data**](docs/FakeApi.md#test_json_form_data) | **GET** /fake/jsonFormData | test json serialization of form data
+*FakeClassnameTags123Api* | [**test_classname**](docs/FakeClassnameTags123Api.md#test_classname) | **PATCH** /fake_classname_test | To test class name in snake case
+*PetApi* | [**add_pet**](docs/PetApi.md#add_pet) | **POST** /pet | Add a new pet to the store
+*PetApi* | [**delete_pet**](docs/PetApi.md#delete_pet) | **DELETE** /pet/{petId} | Deletes a pet
+*PetApi* | [**find_pets_by_status**](docs/PetApi.md#find_pets_by_status) | **GET** /pet/findByStatus | Finds Pets by status
+*PetApi* | [**find_pets_by_tags**](docs/PetApi.md#find_pets_by_tags) | **GET** /pet/findByTags | Finds Pets by tags
+*PetApi* | [**get_pet_by_id**](docs/PetApi.md#get_pet_by_id) | **GET** /pet/{petId} | Find pet by ID
+*PetApi* | [**update_pet**](docs/PetApi.md#update_pet) | **PUT** /pet | Update an existing pet
+*PetApi* | [**update_pet_with_form**](docs/PetApi.md#update_pet_with_form) | **POST** /pet/{petId} | Updates a pet in the store with form data
+*PetApi* | [**upload_file**](docs/PetApi.md#upload_file) | **POST** /pet/{petId}/uploadImage | uploads an image
+*PetApi* | [**upload_file_with_required_file**](docs/PetApi.md#upload_file_with_required_file) | **POST** /fake/{petId}/uploadImageWithRequiredFile | uploads an image (required)
+*StoreApi* | [**delete_order**](docs/StoreApi.md#delete_order) | **DELETE** /store/order/{order_id} | Delete purchase order by ID
+*StoreApi* | [**get_inventory**](docs/StoreApi.md#get_inventory) | **GET** /store/inventory | Returns pet inventories by status
+*StoreApi* | [**get_order_by_id**](docs/StoreApi.md#get_order_by_id) | **GET** /store/order/{order_id} | Find purchase order by ID
+*StoreApi* | [**place_order**](docs/StoreApi.md#place_order) | **POST** /store/order | Place an order for a pet
+*UserApi* | [**create_user**](docs/UserApi.md#create_user) | **POST** /user | Create user
+*UserApi* | [**create_users_with_array_input**](docs/UserApi.md#create_users_with_array_input) | **POST** /user/createWithArray | Creates list of users with given input array
+*UserApi* | [**create_users_with_list_input**](docs/UserApi.md#create_users_with_list_input) | **POST** /user/createWithList | Creates list of users with given input array
+*UserApi* | [**delete_user**](docs/UserApi.md#delete_user) | **DELETE** /user/{username} | Delete user
+*UserApi* | [**get_user_by_name**](docs/UserApi.md#get_user_by_name) | **GET** /user/{username} | Get user by user name
+*UserApi* | [**login_user**](docs/UserApi.md#login_user) | **GET** /user/login | Logs user into the system
+*UserApi* | [**logout_user**](docs/UserApi.md#logout_user) | **GET** /user/logout | Logs out current logged in user session
+*UserApi* | [**update_user**](docs/UserApi.md#update_user) | **PUT** /user/{username} | Updated user
+
+
+## Documentation For Models
+
+ - [AdditionalPropertiesAnyType](docs/AdditionalPropertiesAnyType.md)
+ - [AdditionalPropertiesArray](docs/AdditionalPropertiesArray.md)
+ - [AdditionalPropertiesBoolean](docs/AdditionalPropertiesBoolean.md)
+ - [AdditionalPropertiesClass](docs/AdditionalPropertiesClass.md)
+ - [AdditionalPropertiesInteger](docs/AdditionalPropertiesInteger.md)
+ - [AdditionalPropertiesNumber](docs/AdditionalPropertiesNumber.md)
+ - [AdditionalPropertiesObject](docs/AdditionalPropertiesObject.md)
+ - [AdditionalPropertiesString](docs/AdditionalPropertiesString.md)
+ - [Animal](docs/Animal.md)
+ - [AnimalFarm](docs/AnimalFarm.md)
+ - [ApiResponse](docs/ApiResponse.md)
+ - [ArrayOfArrayOfNumberOnly](docs/ArrayOfArrayOfNumberOnly.md)
+ - [ArrayOfNumberOnly](docs/ArrayOfNumberOnly.md)
+ - [ArrayTest](docs/ArrayTest.md)
+ - [Capitalization](docs/Capitalization.md)
+ - [Cat](docs/Cat.md)
+ - [CatAllOf](docs/CatAllOf.md)
+ - [Category](docs/Category.md)
+ - [Child](docs/Child.md)
+ - [ChildAllOf](docs/ChildAllOf.md)
+ - [ChildCat](docs/ChildCat.md)
+ - [ChildCatAllOf](docs/ChildCatAllOf.md)
+ - [ChildDog](docs/ChildDog.md)
+ - [ChildDogAllOf](docs/ChildDogAllOf.md)
+ - [ChildLizard](docs/ChildLizard.md)
+ - [ChildLizardAllOf](docs/ChildLizardAllOf.md)
+ - [ClassModel](docs/ClassModel.md)
+ - [Client](docs/Client.md)
+ - [Dog](docs/Dog.md)
+ - [DogAllOf](docs/DogAllOf.md)
+ - [EnumArrays](docs/EnumArrays.md)
+ - [EnumClass](docs/EnumClass.md)
+ - [EnumTest](docs/EnumTest.md)
+ - [File](docs/File.md)
+ - [FileSchemaTestClass](docs/FileSchemaTestClass.md)
+ - [FormatTest](docs/FormatTest.md)
+ - [Grandparent](docs/Grandparent.md)
+ - [GrandparentAnimal](docs/GrandparentAnimal.md)
+ - [HasOnlyReadOnly](docs/HasOnlyReadOnly.md)
+ - [List](docs/List.md)
+ - [MapTest](docs/MapTest.md)
+ - [MixedPropertiesAndAdditionalPropertiesClass](docs/MixedPropertiesAndAdditionalPropertiesClass.md)
+ - [Model200Response](docs/Model200Response.md)
+ - [ModelReturn](docs/ModelReturn.md)
+ - [Name](docs/Name.md)
+ - [NumberOnly](docs/NumberOnly.md)
+ - [NumberWithValidations](docs/NumberWithValidations.md)
+ - [ObjectModelWithRefProps](docs/ObjectModelWithRefProps.md)
+ - [Order](docs/Order.md)
+ - [Parent](docs/Parent.md)
+ - [ParentAllOf](docs/ParentAllOf.md)
+ - [ParentPet](docs/ParentPet.md)
+ - [Pet](docs/Pet.md)
+ - [Player](docs/Player.md)
+ - [ReadOnlyFirst](docs/ReadOnlyFirst.md)
+ - [SpecialModelName](docs/SpecialModelName.md)
+ - [StringBooleanMap](docs/StringBooleanMap.md)
+ - [StringEnum](docs/StringEnum.md)
+ - [Tag](docs/Tag.md)
+ - [TypeHolderDefault](docs/TypeHolderDefault.md)
+ - [TypeHolderExample](docs/TypeHolderExample.md)
+ - [User](docs/User.md)
+ - [XmlItem](docs/XmlItem.md)
+
+
+## Documentation For Authorization
+
+
+## api_key
+
+- **Type**: API key
+- **API key parameter name**: api_key
+- **Location**: HTTP header
+
+
+## api_key_query
+
+- **Type**: API key
+- **API key parameter name**: api_key_query
+- **Location**: URL query string
+
+
+## http_basic_test
+
+- **Type**: HTTP basic authentication
+
+
+## petstore_auth
+
+- **Type**: OAuth
+- **Flow**: implicit
+- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog
+- **Scopes**:
+ - **write:pets**: modify pets in your account
+ - **read:pets**: read your pets
+
+
+## Author
+
+
+
+
+## Notes for Large OpenAPI documents
+If the OpenAPI document is large, imports in petstore_api.apis and petstore_api.models may fail with a
+RecursionError indicating the maximum recursion limit has been exceeded. In that case, there are a couple of solutions:
+
+Solution 1:
+Use specific imports for apis and models like:
+- `from petstore_api.api.default_api import DefaultApi`
+- `from petstore_api.model.pet import Pet`
+
+Solution 2:
+Before importing the package, adjust the maximum recursion limit as shown below:
+```
+import sys
+sys.setrecursionlimit(1500)
+import petstore_api
+from petstore_api.apis import *
+from petstore_api.models import *
+```
+
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/dev-requirements.txt b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/dev-requirements.txt
new file mode 100644
index 000000000000..ccdfca629494
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/dev-requirements.txt
@@ -0,0 +1,2 @@
+tox
+flake8
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/AdditionalPropertiesAnyType.md b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/AdditionalPropertiesAnyType.md
new file mode 100644
index 000000000000..d31d12de0822
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/AdditionalPropertiesAnyType.md
@@ -0,0 +1,12 @@
+# AdditionalPropertiesAnyType
+
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**name** | **str** | | [optional]
+**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/AdditionalPropertiesArray.md b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/AdditionalPropertiesArray.md
new file mode 100644
index 000000000000..40537cbf8384
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/AdditionalPropertiesArray.md
@@ -0,0 +1,12 @@
+# AdditionalPropertiesArray
+
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**name** | **str** | | [optional]
+**any string name** | **[bool, date, datetime, dict, float, int, list, str, none_type]** | any string name can be used but the value must be the correct type | [optional]
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/AdditionalPropertiesBoolean.md b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/AdditionalPropertiesBoolean.md
new file mode 100644
index 000000000000..bf7b5be4c13d
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/AdditionalPropertiesBoolean.md
@@ -0,0 +1,12 @@
+# AdditionalPropertiesBoolean
+
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**name** | **str** | | [optional]
+**any string name** | **bool** | any string name can be used but the value must be the correct type | [optional]
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/AdditionalPropertiesClass.md b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/AdditionalPropertiesClass.md
new file mode 100644
index 000000000000..fe54cef0539f
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/AdditionalPropertiesClass.md
@@ -0,0 +1,21 @@
+# AdditionalPropertiesClass
+
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**map_string** | **{str: (str,)}** | | [optional]
+**map_number** | **{str: (float,)}** | | [optional]
+**map_integer** | **{str: (int,)}** | | [optional]
+**map_boolean** | **{str: (bool,)}** | | [optional]
+**map_array_integer** | **{str: ([int],)}** | | [optional]
+**map_array_anytype** | **{str: ([bool, date, datetime, dict, float, int, list, str, none_type],)}** | | [optional]
+**map_map_string** | **{str: ({str: (str,)},)}** | | [optional]
+**map_map_anytype** | **{str: ({str: (bool, date, datetime, dict, float, int, list, str, none_type,)},)}** | | [optional]
+**anytype_1** | **bool, date, datetime, dict, float, int, list, str, none_type** | | [optional]
+**anytype_2** | **bool, date, datetime, dict, float, int, list, str, none_type** | no type is set for this | [optional]
+**anytype_3** | **bool, date, datetime, dict, float, int, list, str, none_type** | because of a bug in swagger-parser, this should have values {str: (str, int, float...)} but instead we get any type. See https://github.com/swagger-api/swagger-parser/issues/1378 | [optional]
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/AdditionalPropertiesInteger.md b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/AdditionalPropertiesInteger.md
new file mode 100644
index 000000000000..96345efd4cc8
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/AdditionalPropertiesInteger.md
@@ -0,0 +1,12 @@
+# AdditionalPropertiesInteger
+
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**name** | **str** | | [optional]
+**any string name** | **int** | any string name can be used but the value must be the correct type | [optional]
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/AdditionalPropertiesNumber.md b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/AdditionalPropertiesNumber.md
new file mode 100644
index 000000000000..9af52dc6dcfd
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/AdditionalPropertiesNumber.md
@@ -0,0 +1,12 @@
+# AdditionalPropertiesNumber
+
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**name** | **str** | | [optional]
+**any string name** | **float** | any string name can be used but the value must be the correct type | [optional]
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/AdditionalPropertiesObject.md b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/AdditionalPropertiesObject.md
new file mode 100644
index 000000000000..dc64a0d91c24
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/AdditionalPropertiesObject.md
@@ -0,0 +1,12 @@
+# AdditionalPropertiesObject
+
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**name** | **str** | | [optional]
+**any string name** | **{str: (bool, date, datetime, dict, float, int, list, str, none_type,)}** | any string name can be used but the value must be the correct type | [optional]
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/AdditionalPropertiesString.md b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/AdditionalPropertiesString.md
new file mode 100644
index 000000000000..fe3993d02265
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/AdditionalPropertiesString.md
@@ -0,0 +1,12 @@
+# AdditionalPropertiesString
+
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**name** | **str** | | [optional]
+**any string name** | **str** | any string name can be used but the value must be the correct type | [optional]
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/Animal.md b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/Animal.md
new file mode 100644
index 000000000000..1d1c77c01abc
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/Animal.md
@@ -0,0 +1,12 @@
+# Animal
+
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**class_name** | **str** | |
+**color** | **str** | | [optional] if omitted the server will use the default value of "red"
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/AnimalFarm.md b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/AnimalFarm.md
new file mode 100644
index 000000000000..fc299cf27d34
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/AnimalFarm.md
@@ -0,0 +1,11 @@
+# AnimalFarm
+
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**value** | [**[Animal]**](Animal.md) | |
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/AnotherFakeApi.md b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/AnotherFakeApi.md
new file mode 100644
index 000000000000..470caed72cc5
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/AnotherFakeApi.md
@@ -0,0 +1,76 @@
+# petstore_api.AnotherFakeApi
+
+All URIs are relative to *http://petstore.swagger.io:80/v2*
+
+Method | HTTP request | Description
+------------- | ------------- | -------------
+[**call_123_test_special_tags**](AnotherFakeApi.md#call_123_test_special_tags) | **PATCH** /another-fake/dummy | To test special tags
+
+
+# **call_123_test_special_tags**
+> Client call_123_test_special_tags(body)
+
+To test special tags
+
+To test special tags and operation ID starting with number
+
+### Example
+
+```python
+import time
+import petstore_api
+from petstore_api.api import another_fake_api
+from petstore_api.model.client import Client
+from pprint import pprint
+# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2
+# See configuration.py for a list of all supported configuration parameters.
+configuration = petstore_api.Configuration(
+ host = "http://petstore.swagger.io:80/v2"
+)
+
+
+# Enter a context with an instance of the API client
+with petstore_api.ApiClient() as api_client:
+ # Create an instance of the API class
+ api_instance = another_fake_api.AnotherFakeApi(api_client)
+ body = Client(
+ client="client_example",
+ ) # Client | client model
+
+ # example passing only required values which don't have defaults set
+ try:
+ # To test special tags
+ api_response = api_instance.call_123_test_special_tags(body)
+ pprint(api_response)
+ except petstore_api.ApiException as e:
+ print("Exception when calling AnotherFakeApi->call_123_test_special_tags: %s\n" % e)
+```
+
+
+### Parameters
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+ **body** | [**Client**](Client.md)| client model |
+
+### Return type
+
+[**Client**](Client.md)
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+ - **Content-Type**: application/json
+ - **Accept**: application/json
+
+
+### HTTP response details
+| Status code | Description | Response headers |
+|-------------|-------------|------------------|
+**200** | successful operation | - |
+
+[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
+
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/ApiResponse.md b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/ApiResponse.md
new file mode 100644
index 000000000000..81a7d0d85227
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/ApiResponse.md
@@ -0,0 +1,13 @@
+# ApiResponse
+
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**code** | **int** | | [optional]
+**type** | **str** | | [optional]
+**message** | **str** | | [optional]
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/ArrayOfArrayOfNumberOnly.md b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/ArrayOfArrayOfNumberOnly.md
new file mode 100644
index 000000000000..6ab77963788b
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/ArrayOfArrayOfNumberOnly.md
@@ -0,0 +1,11 @@
+# ArrayOfArrayOfNumberOnly
+
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**array_array_number** | **[[float]]** | | [optional]
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/ArrayOfNumberOnly.md b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/ArrayOfNumberOnly.md
new file mode 100644
index 000000000000..ebc65a54ba7e
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/ArrayOfNumberOnly.md
@@ -0,0 +1,11 @@
+# ArrayOfNumberOnly
+
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**array_number** | **[float]** | | [optional]
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/ArrayTest.md b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/ArrayTest.md
new file mode 100644
index 000000000000..4e1bda8fc3af
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/ArrayTest.md
@@ -0,0 +1,13 @@
+# ArrayTest
+
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**array_of_string** | **[str]** | | [optional]
+**array_array_of_integer** | **[[int]]** | | [optional]
+**array_array_of_model** | [**[[ReadOnlyFirst]]**](ReadOnlyFirst.md) | | [optional]
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/Capitalization.md b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/Capitalization.md
new file mode 100644
index 000000000000..1ddeadeb3f46
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/Capitalization.md
@@ -0,0 +1,16 @@
+# Capitalization
+
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**small_camel** | **str** | | [optional]
+**capital_camel** | **str** | | [optional]
+**small_snake** | **str** | | [optional]
+**capital_snake** | **str** | | [optional]
+**sca_eth_flow_points** | **str** | | [optional]
+**att_name** | **str** | Name of the pet | [optional]
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/Cat.md b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/Cat.md
new file mode 100644
index 000000000000..e9ce235cd632
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/Cat.md
@@ -0,0 +1,13 @@
+# Cat
+
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**class_name** | **str** | |
+**declawed** | **bool** | | [optional]
+**color** | **str** | | [optional] if omitted the server will use the default value of "red"
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/CatAllOf.md b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/CatAllOf.md
new file mode 100644
index 000000000000..0ff7809a99ac
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/CatAllOf.md
@@ -0,0 +1,11 @@
+# CatAllOf
+
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**declawed** | **bool** | | [optional]
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/Category.md b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/Category.md
new file mode 100644
index 000000000000..940f6a45e641
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/Category.md
@@ -0,0 +1,12 @@
+# Category
+
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**name** | **str** | | defaults to "default-name"
+**id** | **int** | | [optional]
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/Child.md b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/Child.md
new file mode 100644
index 000000000000..eb4392445710
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/Child.md
@@ -0,0 +1,13 @@
+# Child
+
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**radio_waves** | **bool** | | [optional]
+**tele_vision** | **bool** | | [optional]
+**inter_net** | **bool** | | [optional]
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/ChildAllOf.md b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/ChildAllOf.md
new file mode 100644
index 000000000000..f9ae99c7c157
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/ChildAllOf.md
@@ -0,0 +1,11 @@
+# ChildAllOf
+
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**inter_net** | **bool** | | [optional]
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/ChildCat.md b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/ChildCat.md
new file mode 100644
index 000000000000..9e3a0fb4b51a
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/ChildCat.md
@@ -0,0 +1,12 @@
+# ChildCat
+
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**pet_type** | **str** | |
+**name** | **str** | | [optional]
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/ChildCatAllOf.md b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/ChildCatAllOf.md
new file mode 100644
index 000000000000..c5883b9a87c8
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/ChildCatAllOf.md
@@ -0,0 +1,11 @@
+# ChildCatAllOf
+
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**name** | **str** | | [optional]
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/ChildDog.md b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/ChildDog.md
new file mode 100644
index 000000000000..9a6e5b372664
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/ChildDog.md
@@ -0,0 +1,12 @@
+# ChildDog
+
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**pet_type** | **str** | |
+**bark** | **str** | | [optional]
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/ChildDogAllOf.md b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/ChildDogAllOf.md
new file mode 100644
index 000000000000..673050667cb3
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/ChildDogAllOf.md
@@ -0,0 +1,11 @@
+# ChildDogAllOf
+
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**bark** | **str** | | [optional]
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/ChildLizard.md b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/ChildLizard.md
new file mode 100644
index 000000000000..e881ee0a1d1b
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/ChildLizard.md
@@ -0,0 +1,12 @@
+# ChildLizard
+
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**pet_type** | **str** | |
+**loves_rocks** | **bool** | | [optional]
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/ChildLizardAllOf.md b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/ChildLizardAllOf.md
new file mode 100644
index 000000000000..6e2b70c01505
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/ChildLizardAllOf.md
@@ -0,0 +1,11 @@
+# ChildLizardAllOf
+
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**loves_rocks** | **bool** | | [optional]
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/ClassModel.md b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/ClassModel.md
new file mode 100644
index 000000000000..48ed7cbf2ff0
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/ClassModel.md
@@ -0,0 +1,12 @@
+# ClassModel
+
+Model for testing model with \"_class\" property
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**_class** | **str** | | [optional]
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/Client.md b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/Client.md
new file mode 100644
index 000000000000..c3986008d6c3
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/Client.md
@@ -0,0 +1,11 @@
+# Client
+
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**client** | **str** | | [optional]
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/Dog.md b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/Dog.md
new file mode 100644
index 000000000000..7065c4c983d9
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/Dog.md
@@ -0,0 +1,13 @@
+# Dog
+
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**class_name** | **str** | |
+**breed** | **str** | | [optional]
+**color** | **str** | | [optional] if omitted the server will use the default value of "red"
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/DogAllOf.md b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/DogAllOf.md
new file mode 100644
index 000000000000..6382bbd80671
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/DogAllOf.md
@@ -0,0 +1,11 @@
+# DogAllOf
+
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**breed** | **str** | | [optional]
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/EnumArrays.md b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/EnumArrays.md
new file mode 100644
index 000000000000..9be5c645a809
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/EnumArrays.md
@@ -0,0 +1,12 @@
+# EnumArrays
+
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**just_symbol** | **str** | | [optional]
+**array_enum** | **[str]** | | [optional]
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/EnumClass.md b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/EnumClass.md
new file mode 100644
index 000000000000..a1f9aae58190
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/EnumClass.md
@@ -0,0 +1,11 @@
+# EnumClass
+
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**value** | **str** | | defaults to "-efg", must be one of ["_abc", "-efg", "(xyz)", ]
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/EnumTest.md b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/EnumTest.md
new file mode 100644
index 000000000000..eb8842241390
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/EnumTest.md
@@ -0,0 +1,15 @@
+# EnumTest
+
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**enum_string_required** | **str** | |
+**enum_string** | **str** | | [optional]
+**enum_integer** | **int** | | [optional]
+**enum_number** | **float** | | [optional]
+**string_enum** | [**StringEnum**](StringEnum.md) | | [optional]
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/FakeApi.md b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/FakeApi.md
new file mode 100644
index 000000000000..a107342b75c0
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/FakeApi.md
@@ -0,0 +1,1205 @@
+# petstore_api.FakeApi
+
+All URIs are relative to *http://petstore.swagger.io:80/v2*
+
+Method | HTTP request | Description
+------------- | ------------- | -------------
+[**array_model**](FakeApi.md#array_model) | **POST** /fake/refs/arraymodel |
+[**boolean**](FakeApi.md#boolean) | **POST** /fake/refs/boolean |
+[**create_xml_item**](FakeApi.md#create_xml_item) | **POST** /fake/create_xml_item | creates an XmlItem
+[**number_with_validations**](FakeApi.md#number_with_validations) | **POST** /fake/refs/number |
+[**object_model_with_ref_props**](FakeApi.md#object_model_with_ref_props) | **POST** /fake/refs/object_model_with_ref_props |
+[**string**](FakeApi.md#string) | **POST** /fake/refs/string |
+[**string_enum**](FakeApi.md#string_enum) | **POST** /fake/refs/enum |
+[**test_body_with_file_schema**](FakeApi.md#test_body_with_file_schema) | **PUT** /fake/body-with-file-schema |
+[**test_body_with_query_params**](FakeApi.md#test_body_with_query_params) | **PUT** /fake/body-with-query-params |
+[**test_client_model**](FakeApi.md#test_client_model) | **PATCH** /fake | To test \"client\" model
+[**test_endpoint_enums_length_one**](FakeApi.md#test_endpoint_enums_length_one) | **PUT** /fake/enums-of-length-one/{path_string}/{path_integer} |
+[**test_endpoint_parameters**](FakeApi.md#test_endpoint_parameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
+[**test_enum_parameters**](FakeApi.md#test_enum_parameters) | **GET** /fake | To test enum parameters
+[**test_group_parameters**](FakeApi.md#test_group_parameters) | **DELETE** /fake | Fake endpoint to test group parameters (optional)
+[**test_inline_additional_properties**](FakeApi.md#test_inline_additional_properties) | **POST** /fake/inline-additionalProperties | test inline additionalProperties
+[**test_json_form_data**](FakeApi.md#test_json_form_data) | **GET** /fake/jsonFormData | test json serialization of form data
+
+
+# **array_model**
+> AnimalFarm array_model()
+
+
+
+Test serialization of ArrayModel
+
+### Example
+
+```python
+import time
+import petstore_api
+from petstore_api.api import fake_api
+from petstore_api.model.animal_farm import AnimalFarm
+from pprint import pprint
+# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2
+# See configuration.py for a list of all supported configuration parameters.
+configuration = petstore_api.Configuration(
+ host = "http://petstore.swagger.io:80/v2"
+)
+
+
+# Enter a context with an instance of the API client
+with petstore_api.ApiClient() as api_client:
+ # Create an instance of the API class
+ api_instance = fake_api.FakeApi(api_client)
+ body = AnimalFarm([
+ Animal(),
+ ]) # AnimalFarm | Input model (optional)
+
+ # example passing only required values which don't have defaults set
+ # and optional values
+ try:
+ api_response = api_instance.array_model(body=body)
+ pprint(api_response)
+ except petstore_api.ApiException as e:
+ print("Exception when calling FakeApi->array_model: %s\n" % e)
+```
+
+
+### Parameters
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+ **body** | [**AnimalFarm**](AnimalFarm.md)| Input model | [optional]
+
+### Return type
+
+[**AnimalFarm**](AnimalFarm.md)
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+ - **Content-Type**: Not defined
+ - **Accept**: */*
+
+
+### HTTP response details
+| Status code | Description | Response headers |
+|-------------|-------------|------------------|
+**200** | Output model | - |
+
+[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
+
+# **boolean**
+> bool boolean()
+
+
+
+Test serialization of outer boolean types
+
+### Example
+
+```python
+import time
+import petstore_api
+from petstore_api.api import fake_api
+from pprint import pprint
+# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2
+# See configuration.py for a list of all supported configuration parameters.
+configuration = petstore_api.Configuration(
+ host = "http://petstore.swagger.io:80/v2"
+)
+
+
+# Enter a context with an instance of the API client
+with petstore_api.ApiClient() as api_client:
+ # Create an instance of the API class
+ api_instance = fake_api.FakeApi(api_client)
+ body = True # bool | Input boolean as post body (optional)
+
+ # example passing only required values which don't have defaults set
+ # and optional values
+ try:
+ api_response = api_instance.boolean(body=body)
+ pprint(api_response)
+ except petstore_api.ApiException as e:
+ print("Exception when calling FakeApi->boolean: %s\n" % e)
+```
+
+
+### Parameters
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+ **body** | **bool**| Input boolean as post body | [optional]
+
+### Return type
+
+**bool**
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+ - **Content-Type**: Not defined
+ - **Accept**: */*
+
+
+### HTTP response details
+| Status code | Description | Response headers |
+|-------------|-------------|------------------|
+**200** | Output boolean | - |
+
+[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
+
+# **create_xml_item**
+> create_xml_item(xml_item)
+
+creates an XmlItem
+
+this route creates an XmlItem
+
+### Example
+
+```python
+import time
+import petstore_api
+from petstore_api.api import fake_api
+from petstore_api.model.xml_item import XmlItem
+from pprint import pprint
+# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2
+# See configuration.py for a list of all supported configuration parameters.
+configuration = petstore_api.Configuration(
+ host = "http://petstore.swagger.io:80/v2"
+)
+
+
+# Enter a context with an instance of the API client
+with petstore_api.ApiClient() as api_client:
+ # Create an instance of the API class
+ api_instance = fake_api.FakeApi(api_client)
+ xml_item = XmlItem(
+ attribute_string="string",
+ attribute_number=1.234,
+ attribute_integer=-2,
+ attribute_boolean=True,
+ wrapped_array=[
+ 1,
+ ],
+ name_string="string",
+ name_number=1.234,
+ name_integer=-2,
+ name_boolean=True,
+ name_array=[
+ 1,
+ ],
+ name_wrapped_array=[
+ 1,
+ ],
+ prefix_string="string",
+ prefix_number=1.234,
+ prefix_integer=-2,
+ prefix_boolean=True,
+ prefix_array=[
+ 1,
+ ],
+ prefix_wrapped_array=[
+ 1,
+ ],
+ namespace_string="string",
+ namespace_number=1.234,
+ namespace_integer=-2,
+ namespace_boolean=True,
+ namespace_array=[
+ 1,
+ ],
+ namespace_wrapped_array=[
+ 1,
+ ],
+ prefix_ns_string="string",
+ prefix_ns_number=1.234,
+ prefix_ns_integer=-2,
+ prefix_ns_boolean=True,
+ prefix_ns_array=[
+ 1,
+ ],
+ prefix_ns_wrapped_array=[
+ 1,
+ ],
+ ) # XmlItem | XmlItem Body
+
+ # example passing only required values which don't have defaults set
+ try:
+ # creates an XmlItem
+ api_instance.create_xml_item(xml_item)
+ except petstore_api.ApiException as e:
+ print("Exception when calling FakeApi->create_xml_item: %s\n" % e)
+```
+
+
+### Parameters
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+ **xml_item** | [**XmlItem**](XmlItem.md)| XmlItem Body |
+
+### Return type
+
+void (empty response body)
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+ - **Content-Type**: application/xml, application/xml; charset=utf-8, application/xml; charset=utf-16, text/xml, text/xml; charset=utf-8, text/xml; charset=utf-16
+ - **Accept**: Not defined
+
+
+### HTTP response details
+| Status code | Description | Response headers |
+|-------------|-------------|------------------|
+**200** | successful operation | - |
+
+[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
+
+# **number_with_validations**
+> NumberWithValidations number_with_validations()
+
+
+
+Test serialization of outer number types
+
+### Example
+
+```python
+import time
+import petstore_api
+from petstore_api.api import fake_api
+from petstore_api.model.number_with_validations import NumberWithValidations
+from pprint import pprint
+# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2
+# See configuration.py for a list of all supported configuration parameters.
+configuration = petstore_api.Configuration(
+ host = "http://petstore.swagger.io:80/v2"
+)
+
+
+# Enter a context with an instance of the API client
+with petstore_api.ApiClient() as api_client:
+ # Create an instance of the API class
+ api_instance = fake_api.FakeApi(api_client)
+ body = NumberWithValidations(1E+1) # NumberWithValidations | Input number as post body (optional)
+
+ # example passing only required values which don't have defaults set
+ # and optional values
+ try:
+ api_response = api_instance.number_with_validations(body=body)
+ pprint(api_response)
+ except petstore_api.ApiException as e:
+ print("Exception when calling FakeApi->number_with_validations: %s\n" % e)
+```
+
+
+### Parameters
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+ **body** | [**NumberWithValidations**](NumberWithValidations.md)| Input number as post body | [optional]
+
+### Return type
+
+[**NumberWithValidations**](NumberWithValidations.md)
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+ - **Content-Type**: Not defined
+ - **Accept**: */*
+
+
+### HTTP response details
+| Status code | Description | Response headers |
+|-------------|-------------|------------------|
+**200** | Output number | - |
+
+[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
+
+# **object_model_with_ref_props**
+> ObjectModelWithRefProps object_model_with_ref_props()
+
+
+
+Test serialization of object with $refed properties
+
+### Example
+
+```python
+import time
+import petstore_api
+from petstore_api.api import fake_api
+from petstore_api.model.object_model_with_ref_props import ObjectModelWithRefProps
+from pprint import pprint
+# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2
+# See configuration.py for a list of all supported configuration parameters.
+configuration = petstore_api.Configuration(
+ host = "http://petstore.swagger.io:80/v2"
+)
+
+
+# Enter a context with an instance of the API client
+with petstore_api.ApiClient() as api_client:
+ # Create an instance of the API class
+ api_instance = fake_api.FakeApi(api_client)
+ body = ObjectModelWithRefProps(
+ my_number=NumberWithValidations(1E+1),
+ my_string="my_string_example",
+ my_boolean=True,
+ ) # ObjectModelWithRefProps | Input model (optional)
+
+ # example passing only required values which don't have defaults set
+ # and optional values
+ try:
+ api_response = api_instance.object_model_with_ref_props(body=body)
+ pprint(api_response)
+ except petstore_api.ApiException as e:
+ print("Exception when calling FakeApi->object_model_with_ref_props: %s\n" % e)
+```
+
+
+### Parameters
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+ **body** | [**ObjectModelWithRefProps**](ObjectModelWithRefProps.md)| Input model | [optional]
+
+### Return type
+
+[**ObjectModelWithRefProps**](ObjectModelWithRefProps.md)
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+ - **Content-Type**: Not defined
+ - **Accept**: */*
+
+
+### HTTP response details
+| Status code | Description | Response headers |
+|-------------|-------------|------------------|
+**200** | Output model | - |
+
+[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
+
+# **string**
+> str string()
+
+
+
+Test serialization of outer string types
+
+### Example
+
+```python
+import time
+import petstore_api
+from petstore_api.api import fake_api
+from pprint import pprint
+# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2
+# See configuration.py for a list of all supported configuration parameters.
+configuration = petstore_api.Configuration(
+ host = "http://petstore.swagger.io:80/v2"
+)
+
+
+# Enter a context with an instance of the API client
+with petstore_api.ApiClient() as api_client:
+ # Create an instance of the API class
+ api_instance = fake_api.FakeApi(api_client)
+ body = "body_example" # str | Input string as post body (optional)
+
+ # example passing only required values which don't have defaults set
+ # and optional values
+ try:
+ api_response = api_instance.string(body=body)
+ pprint(api_response)
+ except petstore_api.ApiException as e:
+ print("Exception when calling FakeApi->string: %s\n" % e)
+```
+
+
+### Parameters
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+ **body** | **str**| Input string as post body | [optional]
+
+### Return type
+
+**str**
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+ - **Content-Type**: Not defined
+ - **Accept**: */*
+
+
+### HTTP response details
+| Status code | Description | Response headers |
+|-------------|-------------|------------------|
+**200** | Output string | - |
+
+[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
+
+# **string_enum**
+> StringEnum string_enum()
+
+
+
+Test serialization of outer enum
+
+### Example
+
+```python
+import time
+import petstore_api
+from petstore_api.api import fake_api
+from petstore_api.model.string_enum import StringEnum
+from pprint import pprint
+# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2
+# See configuration.py for a list of all supported configuration parameters.
+configuration = petstore_api.Configuration(
+ host = "http://petstore.swagger.io:80/v2"
+)
+
+
+# Enter a context with an instance of the API client
+with petstore_api.ApiClient() as api_client:
+ # Create an instance of the API class
+ api_instance = fake_api.FakeApi(api_client)
+ body = StringEnum("placed") # StringEnum | Input enum (optional)
+
+ # example passing only required values which don't have defaults set
+ # and optional values
+ try:
+ api_response = api_instance.string_enum(body=body)
+ pprint(api_response)
+ except petstore_api.ApiException as e:
+ print("Exception when calling FakeApi->string_enum: %s\n" % e)
+```
+
+
+### Parameters
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+ **body** | [**StringEnum**](StringEnum.md)| Input enum | [optional]
+
+### Return type
+
+[**StringEnum**](StringEnum.md)
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+ - **Content-Type**: Not defined
+ - **Accept**: */*
+
+
+### HTTP response details
+| Status code | Description | Response headers |
+|-------------|-------------|------------------|
+**200** | Output enum | - |
+
+[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
+
+# **test_body_with_file_schema**
+> test_body_with_file_schema(body)
+
+
+
+For this test, the body for this request much reference a schema named `File`.
+
+### Example
+
+```python
+import time
+import petstore_api
+from petstore_api.api import fake_api
+from petstore_api.model.file_schema_test_class import FileSchemaTestClass
+from pprint import pprint
+# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2
+# See configuration.py for a list of all supported configuration parameters.
+configuration = petstore_api.Configuration(
+ host = "http://petstore.swagger.io:80/v2"
+)
+
+
+# Enter a context with an instance of the API client
+with petstore_api.ApiClient() as api_client:
+ # Create an instance of the API class
+ api_instance = fake_api.FakeApi(api_client)
+ body = FileSchemaTestClass(
+ file=File(
+ source_uri="source_uri_example",
+ ),
+ files=[
+ File(
+ source_uri="source_uri_example",
+ ),
+ ],
+ ) # FileSchemaTestClass |
+
+ # example passing only required values which don't have defaults set
+ try:
+ api_instance.test_body_with_file_schema(body)
+ except petstore_api.ApiException as e:
+ print("Exception when calling FakeApi->test_body_with_file_schema: %s\n" % e)
+```
+
+
+### Parameters
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+ **body** | [**FileSchemaTestClass**](FileSchemaTestClass.md)| |
+
+### Return type
+
+void (empty response body)
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+ - **Content-Type**: application/json
+ - **Accept**: Not defined
+
+
+### HTTP response details
+| Status code | Description | Response headers |
+|-------------|-------------|------------------|
+**200** | Success | - |
+
+[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
+
+# **test_body_with_query_params**
+> test_body_with_query_params(query, body)
+
+
+
+### Example
+
+```python
+import time
+import petstore_api
+from petstore_api.api import fake_api
+from petstore_api.model.user import User
+from pprint import pprint
+# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2
+# See configuration.py for a list of all supported configuration parameters.
+configuration = petstore_api.Configuration(
+ host = "http://petstore.swagger.io:80/v2"
+)
+
+
+# Enter a context with an instance of the API client
+with petstore_api.ApiClient() as api_client:
+ # Create an instance of the API class
+ api_instance = fake_api.FakeApi(api_client)
+ query = "query_example" # str |
+ body = User(
+ id=1,
+ username="username_example",
+ first_name="first_name_example",
+ last_name="last_name_example",
+ email="email_example",
+ password="password_example",
+ phone="phone_example",
+ user_status=1,
+ ) # User |
+
+ # example passing only required values which don't have defaults set
+ try:
+ api_instance.test_body_with_query_params(query, body)
+ except petstore_api.ApiException as e:
+ print("Exception when calling FakeApi->test_body_with_query_params: %s\n" % e)
+```
+
+
+### Parameters
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+ **query** | **str**| |
+ **body** | [**User**](User.md)| |
+
+### Return type
+
+void (empty response body)
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+ - **Content-Type**: application/json
+ - **Accept**: Not defined
+
+
+### HTTP response details
+| Status code | Description | Response headers |
+|-------------|-------------|------------------|
+**200** | Success | - |
+
+[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
+
+# **test_client_model**
+> Client test_client_model(body)
+
+To test \"client\" model
+
+To test \"client\" model
+
+### Example
+
+```python
+import time
+import petstore_api
+from petstore_api.api import fake_api
+from petstore_api.model.client import Client
+from pprint import pprint
+# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2
+# See configuration.py for a list of all supported configuration parameters.
+configuration = petstore_api.Configuration(
+ host = "http://petstore.swagger.io:80/v2"
+)
+
+
+# Enter a context with an instance of the API client
+with petstore_api.ApiClient() as api_client:
+ # Create an instance of the API class
+ api_instance = fake_api.FakeApi(api_client)
+ body = Client(
+ client="client_example",
+ ) # Client | client model
+
+ # example passing only required values which don't have defaults set
+ try:
+ # To test \"client\" model
+ api_response = api_instance.test_client_model(body)
+ pprint(api_response)
+ except petstore_api.ApiException as e:
+ print("Exception when calling FakeApi->test_client_model: %s\n" % e)
+```
+
+
+### Parameters
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+ **body** | [**Client**](Client.md)| client model |
+
+### Return type
+
+[**Client**](Client.md)
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+ - **Content-Type**: application/json
+ - **Accept**: application/json
+
+
+### HTTP response details
+| Status code | Description | Response headers |
+|-------------|-------------|------------------|
+**200** | successful operation | - |
+
+[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
+
+# **test_endpoint_enums_length_one**
+> test_endpoint_enums_length_one()
+
+
+
+This route has required values with enums of 1
+
+### Example
+
+```python
+import time
+import petstore_api
+from petstore_api.api import fake_api
+from pprint import pprint
+# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2
+# See configuration.py for a list of all supported configuration parameters.
+configuration = petstore_api.Configuration(
+ host = "http://petstore.swagger.io:80/v2"
+)
+
+
+# Enter a context with an instance of the API client
+with petstore_api.ApiClient() as api_client:
+ # Create an instance of the API class
+ api_instance = fake_api.FakeApi(api_client)
+
+ # example passing only required values which don't have defaults set
+ try:
+ api_instance.test_endpoint_enums_length_one()
+ except petstore_api.ApiException as e:
+ print("Exception when calling FakeApi->test_endpoint_enums_length_one: %s\n" % e)
+```
+
+
+### Parameters
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+ **query_integer** | **int**| | defaults to 3
+ **query_string** | **str**| | defaults to "brillig"
+ **path_string** | **str**| | defaults to "hello"
+ **path_integer** | **int**| | defaults to 34
+ **header_number** | **float**| | defaults to 1.234
+
+### Return type
+
+void (empty response body)
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+ - **Content-Type**: Not defined
+ - **Accept**: Not defined
+
+
+### HTTP response details
+| Status code | Description | Response headers |
+|-------------|-------------|------------------|
+**200** | Success | - |
+
+[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
+
+# **test_endpoint_parameters**
+> test_endpoint_parameters(number, double, pattern_without_delimiter, byte)
+
+Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
+
+Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
+
+### Example
+
+* Basic Authentication (http_basic_test):
+```python
+import time
+import petstore_api
+from petstore_api.api import fake_api
+from pprint import pprint
+# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2
+# See configuration.py for a list of all supported configuration parameters.
+configuration = petstore_api.Configuration(
+ host = "http://petstore.swagger.io:80/v2"
+)
+
+# The client must configure the authentication and authorization parameters
+# in accordance with the API server security policy.
+# Examples for each auth method are provided below, use the example that
+# satisfies your auth use case.
+
+# Configure HTTP basic authorization: http_basic_test
+configuration = petstore_api.Configuration(
+ username = 'YOUR_USERNAME',
+ password = 'YOUR_PASSWORD'
+)
+
+# Enter a context with an instance of the API client
+with petstore_api.ApiClient(configuration) as api_client:
+ # Create an instance of the API class
+ api_instance = fake_api.FakeApi(api_client)
+ number = 32.1 # float | None
+ double = 67.8 # float | None
+ pattern_without_delimiter = "AUR,rZ#UM/?R,Fp^l6$ARjbhJk C" # str | None
+ byte = 'YQ==' # str | None
+ integer = 10 # int | None (optional)
+ int32 = 20 # int | None (optional)
+ int64 = 1 # int | None (optional)
+ float = 3.14 # float | None (optional)
+ string = "a" # str | None (optional)
+ binary = open('/path/to/file', 'rb') # file_type | None (optional)
+ date = dateutil_parser('1970-01-01').date() # date | None (optional)
+ date_time = dateutil_parser('1970-01-01T00:00:00.00Z') # datetime | None (optional)
+ password = "password_example" # str | None (optional)
+ param_callback = "param_callback_example" # str | None (optional)
+
+ # example passing only required values which don't have defaults set
+ try:
+ # Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
+ api_instance.test_endpoint_parameters(number, double, pattern_without_delimiter, byte)
+ except petstore_api.ApiException as e:
+ print("Exception when calling FakeApi->test_endpoint_parameters: %s\n" % e)
+
+ # example passing only required values which don't have defaults set
+ # and optional values
+ try:
+ # Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
+ api_instance.test_endpoint_parameters(number, double, pattern_without_delimiter, byte, integer=integer, int32=int32, int64=int64, float=float, string=string, binary=binary, date=date, date_time=date_time, password=password, param_callback=param_callback)
+ except petstore_api.ApiException as e:
+ print("Exception when calling FakeApi->test_endpoint_parameters: %s\n" % e)
+```
+
+
+### Parameters
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+ **number** | **float**| None |
+ **double** | **float**| None |
+ **pattern_without_delimiter** | **str**| None |
+ **byte** | **str**| None |
+ **integer** | **int**| None | [optional]
+ **int32** | **int**| None | [optional]
+ **int64** | **int**| None | [optional]
+ **float** | **float**| None | [optional]
+ **string** | **str**| None | [optional]
+ **binary** | **file_type**| None | [optional]
+ **date** | **date**| None | [optional]
+ **date_time** | **datetime**| None | [optional]
+ **password** | **str**| None | [optional]
+ **param_callback** | **str**| None | [optional]
+
+### Return type
+
+void (empty response body)
+
+### Authorization
+
+[http_basic_test](../README.md#http_basic_test)
+
+### HTTP request headers
+
+ - **Content-Type**: application/x-www-form-urlencoded
+ - **Accept**: Not defined
+
+
+### HTTP response details
+| Status code | Description | Response headers |
+|-------------|-------------|------------------|
+**400** | Invalid username supplied | - |
+**404** | User not found | - |
+
+[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
+
+# **test_enum_parameters**
+> test_enum_parameters()
+
+To test enum parameters
+
+To test enum parameters
+
+### Example
+
+```python
+import time
+import petstore_api
+from petstore_api.api import fake_api
+from pprint import pprint
+# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2
+# See configuration.py for a list of all supported configuration parameters.
+configuration = petstore_api.Configuration(
+ host = "http://petstore.swagger.io:80/v2"
+)
+
+
+# Enter a context with an instance of the API client
+with petstore_api.ApiClient() as api_client:
+ # Create an instance of the API class
+ api_instance = fake_api.FakeApi(api_client)
+ enum_header_string_array = [
+ "$",
+ ] # [str] | Header parameter enum test (string array) (optional)
+ enum_header_string = "-efg" # str | Header parameter enum test (string) (optional) if omitted the server will use the default value of "-efg"
+ enum_query_string_array = [
+ "$",
+ ] # [str] | Query parameter enum test (string array) (optional)
+ enum_query_string = "-efg" # str | Query parameter enum test (string) (optional) if omitted the server will use the default value of "-efg"
+ enum_query_integer = 1 # int | Query parameter enum test (double) (optional)
+ enum_query_double = 1.1 # float | Query parameter enum test (double) (optional)
+ enum_form_string_array = "$" # [str] | Form parameter enum test (string array) (optional) if omitted the server will use the default value of "$"
+ enum_form_string = "-efg" # str | Form parameter enum test (string) (optional) if omitted the server will use the default value of "-efg"
+
+ # example passing only required values which don't have defaults set
+ # and optional values
+ try:
+ # To test enum parameters
+ api_instance.test_enum_parameters(enum_header_string_array=enum_header_string_array, enum_header_string=enum_header_string, enum_query_string_array=enum_query_string_array, enum_query_string=enum_query_string, enum_query_integer=enum_query_integer, enum_query_double=enum_query_double, enum_form_string_array=enum_form_string_array, enum_form_string=enum_form_string)
+ except petstore_api.ApiException as e:
+ print("Exception when calling FakeApi->test_enum_parameters: %s\n" % e)
+```
+
+
+### Parameters
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+ **enum_header_string_array** | **[str]**| Header parameter enum test (string array) | [optional]
+ **enum_header_string** | **str**| Header parameter enum test (string) | [optional] if omitted the server will use the default value of "-efg"
+ **enum_query_string_array** | **[str]**| Query parameter enum test (string array) | [optional]
+ **enum_query_string** | **str**| Query parameter enum test (string) | [optional] if omitted the server will use the default value of "-efg"
+ **enum_query_integer** | **int**| Query parameter enum test (double) | [optional]
+ **enum_query_double** | **float**| Query parameter enum test (double) | [optional]
+ **enum_form_string_array** | **[str]**| Form parameter enum test (string array) | [optional] if omitted the server will use the default value of "$"
+ **enum_form_string** | **str**| Form parameter enum test (string) | [optional] if omitted the server will use the default value of "-efg"
+
+### Return type
+
+void (empty response body)
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+ - **Content-Type**: application/x-www-form-urlencoded
+ - **Accept**: Not defined
+
+
+### HTTP response details
+| Status code | Description | Response headers |
+|-------------|-------------|------------------|
+**400** | Invalid request | - |
+**404** | Not found | - |
+
+[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
+
+# **test_group_parameters**
+> test_group_parameters(required_string_group, required_boolean_group, required_int64_group)
+
+Fake endpoint to test group parameters (optional)
+
+Fake endpoint to test group parameters (optional)
+
+### Example
+
+```python
+import time
+import petstore_api
+from petstore_api.api import fake_api
+from pprint import pprint
+# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2
+# See configuration.py for a list of all supported configuration parameters.
+configuration = petstore_api.Configuration(
+ host = "http://petstore.swagger.io:80/v2"
+)
+
+
+# Enter a context with an instance of the API client
+with petstore_api.ApiClient() as api_client:
+ # Create an instance of the API class
+ api_instance = fake_api.FakeApi(api_client)
+ required_string_group = 1 # int | Required String in group parameters
+ required_boolean_group = True # bool | Required Boolean in group parameters
+ required_int64_group = 1 # int | Required Integer in group parameters
+ string_group = 1 # int | String in group parameters (optional)
+ boolean_group = True # bool | Boolean in group parameters (optional)
+ int64_group = 1 # int | Integer in group parameters (optional)
+
+ # example passing only required values which don't have defaults set
+ try:
+ # Fake endpoint to test group parameters (optional)
+ api_instance.test_group_parameters(required_string_group, required_boolean_group, required_int64_group)
+ except petstore_api.ApiException as e:
+ print("Exception when calling FakeApi->test_group_parameters: %s\n" % e)
+
+ # example passing only required values which don't have defaults set
+ # and optional values
+ try:
+ # Fake endpoint to test group parameters (optional)
+ api_instance.test_group_parameters(required_string_group, required_boolean_group, required_int64_group, string_group=string_group, boolean_group=boolean_group, int64_group=int64_group)
+ except petstore_api.ApiException as e:
+ print("Exception when calling FakeApi->test_group_parameters: %s\n" % e)
+```
+
+
+### Parameters
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+ **required_string_group** | **int**| Required String in group parameters |
+ **required_boolean_group** | **bool**| Required Boolean in group parameters |
+ **required_int64_group** | **int**| Required Integer in group parameters |
+ **string_group** | **int**| String in group parameters | [optional]
+ **boolean_group** | **bool**| Boolean in group parameters | [optional]
+ **int64_group** | **int**| Integer in group parameters | [optional]
+
+### Return type
+
+void (empty response body)
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+ - **Content-Type**: Not defined
+ - **Accept**: Not defined
+
+
+### HTTP response details
+| Status code | Description | Response headers |
+|-------------|-------------|------------------|
+**400** | Someting wrong | - |
+
+[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
+
+# **test_inline_additional_properties**
+> test_inline_additional_properties(param)
+
+test inline additionalProperties
+
+### Example
+
+```python
+import time
+import petstore_api
+from petstore_api.api import fake_api
+from pprint import pprint
+# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2
+# See configuration.py for a list of all supported configuration parameters.
+configuration = petstore_api.Configuration(
+ host = "http://petstore.swagger.io:80/v2"
+)
+
+
+# Enter a context with an instance of the API client
+with petstore_api.ApiClient() as api_client:
+ # Create an instance of the API class
+ api_instance = fake_api.FakeApi(api_client)
+ param = {
+ "key": "key_example",
+ } # {str: (str,)} | request body
+
+ # example passing only required values which don't have defaults set
+ try:
+ # test inline additionalProperties
+ api_instance.test_inline_additional_properties(param)
+ except petstore_api.ApiException as e:
+ print("Exception when calling FakeApi->test_inline_additional_properties: %s\n" % e)
+```
+
+
+### Parameters
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+ **param** | **{str: (str,)}**| request body |
+
+### Return type
+
+void (empty response body)
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+ - **Content-Type**: application/json
+ - **Accept**: Not defined
+
+
+### HTTP response details
+| Status code | Description | Response headers |
+|-------------|-------------|------------------|
+**200** | successful operation | - |
+
+[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
+
+# **test_json_form_data**
+> test_json_form_data(param, param2)
+
+test json serialization of form data
+
+### Example
+
+```python
+import time
+import petstore_api
+from petstore_api.api import fake_api
+from pprint import pprint
+# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2
+# See configuration.py for a list of all supported configuration parameters.
+configuration = petstore_api.Configuration(
+ host = "http://petstore.swagger.io:80/v2"
+)
+
+
+# Enter a context with an instance of the API client
+with petstore_api.ApiClient() as api_client:
+ # Create an instance of the API class
+ api_instance = fake_api.FakeApi(api_client)
+ param = "param_example" # str | field1
+ param2 = "param2_example" # str | field2
+
+ # example passing only required values which don't have defaults set
+ try:
+ # test json serialization of form data
+ api_instance.test_json_form_data(param, param2)
+ except petstore_api.ApiException as e:
+ print("Exception when calling FakeApi->test_json_form_data: %s\n" % e)
+```
+
+
+### Parameters
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+ **param** | **str**| field1 |
+ **param2** | **str**| field2 |
+
+### Return type
+
+void (empty response body)
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+ - **Content-Type**: application/x-www-form-urlencoded
+ - **Accept**: Not defined
+
+
+### HTTP response details
+| Status code | Description | Response headers |
+|-------------|-------------|------------------|
+**200** | successful operation | - |
+
+[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
+
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/FakeClassnameTags123Api.md b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/FakeClassnameTags123Api.md
new file mode 100644
index 000000000000..3452fd6ddff4
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/FakeClassnameTags123Api.md
@@ -0,0 +1,87 @@
+# petstore_api.FakeClassnameTags123Api
+
+All URIs are relative to *http://petstore.swagger.io:80/v2*
+
+Method | HTTP request | Description
+------------- | ------------- | -------------
+[**test_classname**](FakeClassnameTags123Api.md#test_classname) | **PATCH** /fake_classname_test | To test class name in snake case
+
+
+# **test_classname**
+> Client test_classname(body)
+
+To test class name in snake case
+
+To test class name in snake case
+
+### Example
+
+* Api Key Authentication (api_key_query):
+```python
+import time
+import petstore_api
+from petstore_api.api import fake_classname_tags_123_api
+from petstore_api.model.client import Client
+from pprint import pprint
+# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2
+# See configuration.py for a list of all supported configuration parameters.
+configuration = petstore_api.Configuration(
+ host = "http://petstore.swagger.io:80/v2"
+)
+
+# The client must configure the authentication and authorization parameters
+# in accordance with the API server security policy.
+# Examples for each auth method are provided below, use the example that
+# satisfies your auth use case.
+
+# Configure API key authorization: api_key_query
+configuration.api_key['api_key_query'] = 'YOUR_API_KEY'
+
+# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
+# configuration.api_key_prefix['api_key_query'] = 'Bearer'
+
+# Enter a context with an instance of the API client
+with petstore_api.ApiClient(configuration) as api_client:
+ # Create an instance of the API class
+ api_instance = fake_classname_tags_123_api.FakeClassnameTags123Api(api_client)
+ body = Client(
+ client="client_example",
+ ) # Client | client model
+
+ # example passing only required values which don't have defaults set
+ try:
+ # To test class name in snake case
+ api_response = api_instance.test_classname(body)
+ pprint(api_response)
+ except petstore_api.ApiException as e:
+ print("Exception when calling FakeClassnameTags123Api->test_classname: %s\n" % e)
+```
+
+
+### Parameters
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+ **body** | [**Client**](Client.md)| client model |
+
+### Return type
+
+[**Client**](Client.md)
+
+### Authorization
+
+[api_key_query](../README.md#api_key_query)
+
+### HTTP request headers
+
+ - **Content-Type**: application/json
+ - **Accept**: application/json
+
+
+### HTTP response details
+| Status code | Description | Response headers |
+|-------------|-------------|------------------|
+**200** | successful operation | - |
+
+[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
+
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/File.md b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/File.md
new file mode 100644
index 000000000000..63b1d1a65186
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/File.md
@@ -0,0 +1,12 @@
+# File
+
+Must be named `File` for test.
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**source_uri** | **str** | Test capitalization | [optional]
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/FileSchemaTestClass.md b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/FileSchemaTestClass.md
new file mode 100644
index 000000000000..caf2440821da
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/FileSchemaTestClass.md
@@ -0,0 +1,12 @@
+# FileSchemaTestClass
+
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**file** | [**File**](File.md) | | [optional]
+**files** | [**[File]**](File.md) | | [optional]
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/FormatTest.md b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/FormatTest.md
new file mode 100644
index 000000000000..aef09bfcc83e
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/FormatTest.md
@@ -0,0 +1,23 @@
+# FormatTest
+
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**number** | **float** | |
+**byte** | **str** | |
+**date** | **date** | |
+**password** | **str** | |
+**integer** | **int** | | [optional]
+**int32** | **int** | | [optional]
+**int64** | **int** | | [optional]
+**float** | **float** | | [optional]
+**double** | **float** | | [optional]
+**string** | **str** | | [optional]
+**binary** | **file_type** | | [optional]
+**date_time** | **datetime** | | [optional]
+**uuid** | **str** | | [optional]
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/Grandparent.md b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/Grandparent.md
new file mode 100644
index 000000000000..b6d80a719457
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/Grandparent.md
@@ -0,0 +1,11 @@
+# Grandparent
+
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**radio_waves** | **bool** | | [optional]
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/GrandparentAnimal.md b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/GrandparentAnimal.md
new file mode 100644
index 000000000000..15db0708bb1a
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/GrandparentAnimal.md
@@ -0,0 +1,11 @@
+# GrandparentAnimal
+
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**pet_type** | **str** | |
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/HasOnlyReadOnly.md b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/HasOnlyReadOnly.md
new file mode 100644
index 000000000000..0e1334519a8b
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/HasOnlyReadOnly.md
@@ -0,0 +1,12 @@
+# HasOnlyReadOnly
+
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**bar** | **str** | | [optional] [readonly]
+**foo** | **str** | | [optional] [readonly]
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/List.md b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/List.md
new file mode 100644
index 000000000000..4b60956971aa
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/List.md
@@ -0,0 +1,11 @@
+# List
+
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**_123_list** | **str** | | [optional]
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/MapTest.md b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/MapTest.md
new file mode 100644
index 000000000000..15228ee1f282
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/MapTest.md
@@ -0,0 +1,14 @@
+# MapTest
+
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**map_map_of_string** | **{str: ({str: (str,)},)}** | | [optional]
+**map_of_enum_string** | **{str: (str,)}** | | [optional]
+**direct_map** | **{str: (bool,)}** | | [optional]
+**indirect_map** | [**StringBooleanMap**](StringBooleanMap.md) | | [optional]
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/MixedPropertiesAndAdditionalPropertiesClass.md b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/MixedPropertiesAndAdditionalPropertiesClass.md
new file mode 100644
index 000000000000..f489944a20af
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/MixedPropertiesAndAdditionalPropertiesClass.md
@@ -0,0 +1,13 @@
+# MixedPropertiesAndAdditionalPropertiesClass
+
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**uuid** | **str** | | [optional]
+**date_time** | **datetime** | | [optional]
+**map** | [**{str: (Animal,)}**](Animal.md) | | [optional]
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/Model200Response.md b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/Model200Response.md
new file mode 100644
index 000000000000..c958bd4b33f8
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/Model200Response.md
@@ -0,0 +1,13 @@
+# Model200Response
+
+Model for testing model name starting with number
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**name** | **int** | | [optional]
+**_class** | **str** | | [optional]
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/ModelReturn.md b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/ModelReturn.md
new file mode 100644
index 000000000000..043e9d466fab
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/ModelReturn.md
@@ -0,0 +1,12 @@
+# ModelReturn
+
+Model for testing reserved words
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**_return** | **int** | | [optional]
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/Name.md b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/Name.md
new file mode 100644
index 000000000000..3be719cdbfba
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/Name.md
@@ -0,0 +1,15 @@
+# Name
+
+Model for testing model name same as property name
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**name** | **int** | |
+**snake_case** | **int** | | [optional] [readonly]
+**_property** | **str** | | [optional]
+**_123_number** | **int** | | [optional] [readonly]
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/NumberOnly.md b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/NumberOnly.md
new file mode 100644
index 000000000000..37195c5d8994
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/NumberOnly.md
@@ -0,0 +1,11 @@
+# NumberOnly
+
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**just_number** | **float** | | [optional]
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/NumberWithValidations.md b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/NumberWithValidations.md
new file mode 100644
index 000000000000..119e0f678239
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/NumberWithValidations.md
@@ -0,0 +1,11 @@
+# NumberWithValidations
+
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**value** | **float** | |
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/ObjectModelWithRefProps.md b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/ObjectModelWithRefProps.md
new file mode 100644
index 000000000000..5ff4e52033d6
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/ObjectModelWithRefProps.md
@@ -0,0 +1,14 @@
+# ObjectModelWithRefProps
+
+a model that includes properties which should stay primitive (String + Boolean) and one which is defined as a class, NumberWithValidations
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**my_number** | [**NumberWithValidations**](NumberWithValidations.md) | | [optional]
+**my_string** | **str** | | [optional]
+**my_boolean** | **bool** | | [optional]
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/Order.md b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/Order.md
new file mode 100644
index 000000000000..d29e1a381de8
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/Order.md
@@ -0,0 +1,16 @@
+# Order
+
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**id** | **int** | | [optional]
+**pet_id** | **int** | | [optional]
+**quantity** | **int** | | [optional]
+**ship_date** | **datetime** | | [optional]
+**status** | **str** | Order Status | [optional]
+**complete** | **bool** | | [optional] if omitted the server will use the default value of False
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/Parent.md b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/Parent.md
new file mode 100644
index 000000000000..9d3f02d68b31
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/Parent.md
@@ -0,0 +1,12 @@
+# Parent
+
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**radio_waves** | **bool** | | [optional]
+**tele_vision** | **bool** | | [optional]
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/ParentAllOf.md b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/ParentAllOf.md
new file mode 100644
index 000000000000..569a5e4af14f
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/ParentAllOf.md
@@ -0,0 +1,11 @@
+# ParentAllOf
+
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**tele_vision** | **bool** | | [optional]
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/ParentPet.md b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/ParentPet.md
new file mode 100644
index 000000000000..09e409c8fcf1
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/ParentPet.md
@@ -0,0 +1,11 @@
+# ParentPet
+
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**pet_type** | **str** | |
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/Pet.md b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/Pet.md
new file mode 100644
index 000000000000..6e78495272e4
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/Pet.md
@@ -0,0 +1,16 @@
+# Pet
+
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**name** | **str** | |
+**photo_urls** | **[str]** | |
+**id** | **int** | | [optional]
+**category** | [**Category**](Category.md) | | [optional]
+**tags** | [**[Tag]**](Tag.md) | | [optional]
+**status** | **str** | pet status in the store | [optional]
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/PetApi.md b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/PetApi.md
new file mode 100644
index 000000000000..dcff2fcd0727
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/PetApi.md
@@ -0,0 +1,782 @@
+# petstore_api.PetApi
+
+All URIs are relative to *http://petstore.swagger.io:80/v2*
+
+Method | HTTP request | Description
+------------- | ------------- | -------------
+[**add_pet**](PetApi.md#add_pet) | **POST** /pet | Add a new pet to the store
+[**delete_pet**](PetApi.md#delete_pet) | **DELETE** /pet/{petId} | Deletes a pet
+[**find_pets_by_status**](PetApi.md#find_pets_by_status) | **GET** /pet/findByStatus | Finds Pets by status
+[**find_pets_by_tags**](PetApi.md#find_pets_by_tags) | **GET** /pet/findByTags | Finds Pets by tags
+[**get_pet_by_id**](PetApi.md#get_pet_by_id) | **GET** /pet/{petId} | Find pet by ID
+[**update_pet**](PetApi.md#update_pet) | **PUT** /pet | Update an existing pet
+[**update_pet_with_form**](PetApi.md#update_pet_with_form) | **POST** /pet/{petId} | Updates a pet in the store with form data
+[**upload_file**](PetApi.md#upload_file) | **POST** /pet/{petId}/uploadImage | uploads an image
+[**upload_file_with_required_file**](PetApi.md#upload_file_with_required_file) | **POST** /fake/{petId}/uploadImageWithRequiredFile | uploads an image (required)
+
+
+# **add_pet**
+> add_pet(body)
+
+Add a new pet to the store
+
+### Example
+
+* OAuth Authentication (petstore_auth):
+```python
+import time
+import petstore_api
+from petstore_api.api import pet_api
+from petstore_api.model.pet import Pet
+from pprint import pprint
+# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2
+# See configuration.py for a list of all supported configuration parameters.
+configuration = petstore_api.Configuration(
+ host = "http://petstore.swagger.io:80/v2"
+)
+
+# The client must configure the authentication and authorization parameters
+# in accordance with the API server security policy.
+# Examples for each auth method are provided below, use the example that
+# satisfies your auth use case.
+
+# Configure OAuth2 access token for authorization: petstore_auth
+configuration = petstore_api.Configuration(
+ host = "http://petstore.swagger.io:80/v2"
+)
+configuration.access_token = 'YOUR_ACCESS_TOKEN'
+
+# Enter a context with an instance of the API client
+with petstore_api.ApiClient(configuration) as api_client:
+ # Create an instance of the API class
+ api_instance = pet_api.PetApi(api_client)
+ body = Pet(
+ id=1,
+ category=Category(
+ id=1,
+ name="default-name",
+ ),
+ name="doggie",
+ photo_urls=[
+ "photo_urls_example",
+ ],
+ tags=[
+ Tag(
+ id=1,
+ name="name_example",
+ full_name="full_name_example",
+ ),
+ ],
+ status="available",
+ ) # Pet | Pet object that needs to be added to the store
+
+ # example passing only required values which don't have defaults set
+ try:
+ # Add a new pet to the store
+ api_instance.add_pet(body)
+ except petstore_api.ApiException as e:
+ print("Exception when calling PetApi->add_pet: %s\n" % e)
+```
+
+
+### Parameters
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+ **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store |
+
+### Return type
+
+void (empty response body)
+
+### Authorization
+
+[petstore_auth](../README.md#petstore_auth)
+
+### HTTP request headers
+
+ - **Content-Type**: application/json, application/xml
+ - **Accept**: Not defined
+
+
+### HTTP response details
+| Status code | Description | Response headers |
+|-------------|-------------|------------------|
+**200** | successful operation | - |
+**405** | Invalid input | - |
+
+[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
+
+# **delete_pet**
+> delete_pet(pet_id)
+
+Deletes a pet
+
+### Example
+
+* OAuth Authentication (petstore_auth):
+```python
+import time
+import petstore_api
+from petstore_api.api import pet_api
+from pprint import pprint
+# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2
+# See configuration.py for a list of all supported configuration parameters.
+configuration = petstore_api.Configuration(
+ host = "http://petstore.swagger.io:80/v2"
+)
+
+# The client must configure the authentication and authorization parameters
+# in accordance with the API server security policy.
+# Examples for each auth method are provided below, use the example that
+# satisfies your auth use case.
+
+# Configure OAuth2 access token for authorization: petstore_auth
+configuration = petstore_api.Configuration(
+ host = "http://petstore.swagger.io:80/v2"
+)
+configuration.access_token = 'YOUR_ACCESS_TOKEN'
+
+# Enter a context with an instance of the API client
+with petstore_api.ApiClient(configuration) as api_client:
+ # Create an instance of the API class
+ api_instance = pet_api.PetApi(api_client)
+ pet_id = 1 # int | Pet id to delete
+ api_key = "api_key_example" # str | (optional)
+
+ # example passing only required values which don't have defaults set
+ try:
+ # Deletes a pet
+ api_instance.delete_pet(pet_id)
+ except petstore_api.ApiException as e:
+ print("Exception when calling PetApi->delete_pet: %s\n" % e)
+
+ # example passing only required values which don't have defaults set
+ # and optional values
+ try:
+ # Deletes a pet
+ api_instance.delete_pet(pet_id, api_key=api_key)
+ except petstore_api.ApiException as e:
+ print("Exception when calling PetApi->delete_pet: %s\n" % e)
+```
+
+
+### Parameters
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+ **pet_id** | **int**| Pet id to delete |
+ **api_key** | **str**| | [optional]
+
+### Return type
+
+void (empty response body)
+
+### Authorization
+
+[petstore_auth](../README.md#petstore_auth)
+
+### HTTP request headers
+
+ - **Content-Type**: Not defined
+ - **Accept**: Not defined
+
+
+### HTTP response details
+| Status code | Description | Response headers |
+|-------------|-------------|------------------|
+**200** | successful operation | - |
+**400** | Invalid pet value | - |
+
+[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
+
+# **find_pets_by_status**
+> [Pet] find_pets_by_status(status)
+
+Finds Pets by status
+
+Multiple status values can be provided with comma separated strings
+
+### Example
+
+* OAuth Authentication (petstore_auth):
+```python
+import time
+import petstore_api
+from petstore_api.api import pet_api
+from petstore_api.model.pet import Pet
+from pprint import pprint
+# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2
+# See configuration.py for a list of all supported configuration parameters.
+configuration = petstore_api.Configuration(
+ host = "http://petstore.swagger.io:80/v2"
+)
+
+# The client must configure the authentication and authorization parameters
+# in accordance with the API server security policy.
+# Examples for each auth method are provided below, use the example that
+# satisfies your auth use case.
+
+# Configure OAuth2 access token for authorization: petstore_auth
+configuration = petstore_api.Configuration(
+ host = "http://petstore.swagger.io:80/v2"
+)
+configuration.access_token = 'YOUR_ACCESS_TOKEN'
+
+# Enter a context with an instance of the API client
+with petstore_api.ApiClient(configuration) as api_client:
+ # Create an instance of the API class
+ api_instance = pet_api.PetApi(api_client)
+ status = [
+ "available",
+ ] # [str] | Status values that need to be considered for filter
+
+ # example passing only required values which don't have defaults set
+ try:
+ # Finds Pets by status
+ api_response = api_instance.find_pets_by_status(status)
+ pprint(api_response)
+ except petstore_api.ApiException as e:
+ print("Exception when calling PetApi->find_pets_by_status: %s\n" % e)
+```
+
+
+### Parameters
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+ **status** | **[str]**| Status values that need to be considered for filter |
+
+### Return type
+
+[**[Pet]**](Pet.md)
+
+### Authorization
+
+[petstore_auth](../README.md#petstore_auth)
+
+### HTTP request headers
+
+ - **Content-Type**: Not defined
+ - **Accept**: application/xml, application/json
+
+
+### HTTP response details
+| Status code | Description | Response headers |
+|-------------|-------------|------------------|
+**200** | successful operation | - |
+**400** | Invalid status value | - |
+
+[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
+
+# **find_pets_by_tags**
+> [Pet] find_pets_by_tags(tags)
+
+Finds Pets by tags
+
+Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
+
+### Example
+
+* OAuth Authentication (petstore_auth):
+```python
+import time
+import petstore_api
+from petstore_api.api import pet_api
+from petstore_api.model.pet import Pet
+from pprint import pprint
+# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2
+# See configuration.py for a list of all supported configuration parameters.
+configuration = petstore_api.Configuration(
+ host = "http://petstore.swagger.io:80/v2"
+)
+
+# The client must configure the authentication and authorization parameters
+# in accordance with the API server security policy.
+# Examples for each auth method are provided below, use the example that
+# satisfies your auth use case.
+
+# Configure OAuth2 access token for authorization: petstore_auth
+configuration = petstore_api.Configuration(
+ host = "http://petstore.swagger.io:80/v2"
+)
+configuration.access_token = 'YOUR_ACCESS_TOKEN'
+
+# Enter a context with an instance of the API client
+with petstore_api.ApiClient(configuration) as api_client:
+ # Create an instance of the API class
+ api_instance = pet_api.PetApi(api_client)
+ tags = [
+ "tags_example",
+ ] # [str] | Tags to filter by
+
+ # example passing only required values which don't have defaults set
+ try:
+ # Finds Pets by tags
+ api_response = api_instance.find_pets_by_tags(tags)
+ pprint(api_response)
+ except petstore_api.ApiException as e:
+ print("Exception when calling PetApi->find_pets_by_tags: %s\n" % e)
+```
+
+
+### Parameters
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+ **tags** | **[str]**| Tags to filter by |
+
+### Return type
+
+[**[Pet]**](Pet.md)
+
+### Authorization
+
+[petstore_auth](../README.md#petstore_auth)
+
+### HTTP request headers
+
+ - **Content-Type**: Not defined
+ - **Accept**: application/xml, application/json
+
+
+### HTTP response details
+| Status code | Description | Response headers |
+|-------------|-------------|------------------|
+**200** | successful operation | - |
+**400** | Invalid tag value | - |
+
+[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
+
+# **get_pet_by_id**
+> Pet get_pet_by_id(pet_id)
+
+Find pet by ID
+
+Returns a single pet
+
+### Example
+
+* Api Key Authentication (api_key):
+```python
+import time
+import petstore_api
+from petstore_api.api import pet_api
+from petstore_api.model.pet import Pet
+from pprint import pprint
+# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2
+# See configuration.py for a list of all supported configuration parameters.
+configuration = petstore_api.Configuration(
+ host = "http://petstore.swagger.io:80/v2"
+)
+
+# The client must configure the authentication and authorization parameters
+# in accordance with the API server security policy.
+# Examples for each auth method are provided below, use the example that
+# satisfies your auth use case.
+
+# Configure API key authorization: api_key
+configuration.api_key['api_key'] = 'YOUR_API_KEY'
+
+# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
+# configuration.api_key_prefix['api_key'] = 'Bearer'
+
+# Enter a context with an instance of the API client
+with petstore_api.ApiClient(configuration) as api_client:
+ # Create an instance of the API class
+ api_instance = pet_api.PetApi(api_client)
+ pet_id = 1 # int | ID of pet to return
+
+ # example passing only required values which don't have defaults set
+ try:
+ # Find pet by ID
+ api_response = api_instance.get_pet_by_id(pet_id)
+ pprint(api_response)
+ except petstore_api.ApiException as e:
+ print("Exception when calling PetApi->get_pet_by_id: %s\n" % e)
+```
+
+
+### Parameters
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+ **pet_id** | **int**| ID of pet to return |
+
+### Return type
+
+[**Pet**](Pet.md)
+
+### Authorization
+
+[api_key](../README.md#api_key)
+
+### HTTP request headers
+
+ - **Content-Type**: Not defined
+ - **Accept**: application/xml, application/json
+
+
+### HTTP response details
+| Status code | Description | Response headers |
+|-------------|-------------|------------------|
+**200** | successful operation | - |
+**400** | Invalid ID supplied | - |
+**404** | Pet not found | - |
+
+[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
+
+# **update_pet**
+> update_pet(body)
+
+Update an existing pet
+
+### Example
+
+* OAuth Authentication (petstore_auth):
+```python
+import time
+import petstore_api
+from petstore_api.api import pet_api
+from petstore_api.model.pet import Pet
+from pprint import pprint
+# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2
+# See configuration.py for a list of all supported configuration parameters.
+configuration = petstore_api.Configuration(
+ host = "http://petstore.swagger.io:80/v2"
+)
+
+# The client must configure the authentication and authorization parameters
+# in accordance with the API server security policy.
+# Examples for each auth method are provided below, use the example that
+# satisfies your auth use case.
+
+# Configure OAuth2 access token for authorization: petstore_auth
+configuration = petstore_api.Configuration(
+ host = "http://petstore.swagger.io:80/v2"
+)
+configuration.access_token = 'YOUR_ACCESS_TOKEN'
+
+# Enter a context with an instance of the API client
+with petstore_api.ApiClient(configuration) as api_client:
+ # Create an instance of the API class
+ api_instance = pet_api.PetApi(api_client)
+ body = Pet(
+ id=1,
+ category=Category(
+ id=1,
+ name="default-name",
+ ),
+ name="doggie",
+ photo_urls=[
+ "photo_urls_example",
+ ],
+ tags=[
+ Tag(
+ id=1,
+ name="name_example",
+ full_name="full_name_example",
+ ),
+ ],
+ status="available",
+ ) # Pet | Pet object that needs to be added to the store
+
+ # example passing only required values which don't have defaults set
+ try:
+ # Update an existing pet
+ api_instance.update_pet(body)
+ except petstore_api.ApiException as e:
+ print("Exception when calling PetApi->update_pet: %s\n" % e)
+```
+
+
+### Parameters
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+ **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store |
+
+### Return type
+
+void (empty response body)
+
+### Authorization
+
+[petstore_auth](../README.md#petstore_auth)
+
+### HTTP request headers
+
+ - **Content-Type**: application/json, application/xml
+ - **Accept**: Not defined
+
+
+### HTTP response details
+| Status code | Description | Response headers |
+|-------------|-------------|------------------|
+**200** | successful operation | - |
+**400** | Invalid ID supplied | - |
+**404** | Pet not found | - |
+**405** | Validation exception | - |
+
+[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
+
+# **update_pet_with_form**
+> update_pet_with_form(pet_id)
+
+Updates a pet in the store with form data
+
+### Example
+
+* OAuth Authentication (petstore_auth):
+```python
+import time
+import petstore_api
+from petstore_api.api import pet_api
+from pprint import pprint
+# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2
+# See configuration.py for a list of all supported configuration parameters.
+configuration = petstore_api.Configuration(
+ host = "http://petstore.swagger.io:80/v2"
+)
+
+# The client must configure the authentication and authorization parameters
+# in accordance with the API server security policy.
+# Examples for each auth method are provided below, use the example that
+# satisfies your auth use case.
+
+# Configure OAuth2 access token for authorization: petstore_auth
+configuration = petstore_api.Configuration(
+ host = "http://petstore.swagger.io:80/v2"
+)
+configuration.access_token = 'YOUR_ACCESS_TOKEN'
+
+# Enter a context with an instance of the API client
+with petstore_api.ApiClient(configuration) as api_client:
+ # Create an instance of the API class
+ api_instance = pet_api.PetApi(api_client)
+ pet_id = 1 # int | ID of pet that needs to be updated
+ name = "name_example" # str | Updated name of the pet (optional)
+ status = "status_example" # str | Updated status of the pet (optional)
+
+ # example passing only required values which don't have defaults set
+ try:
+ # Updates a pet in the store with form data
+ api_instance.update_pet_with_form(pet_id)
+ except petstore_api.ApiException as e:
+ print("Exception when calling PetApi->update_pet_with_form: %s\n" % e)
+
+ # example passing only required values which don't have defaults set
+ # and optional values
+ try:
+ # Updates a pet in the store with form data
+ api_instance.update_pet_with_form(pet_id, name=name, status=status)
+ except petstore_api.ApiException as e:
+ print("Exception when calling PetApi->update_pet_with_form: %s\n" % e)
+```
+
+
+### Parameters
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+ **pet_id** | **int**| ID of pet that needs to be updated |
+ **name** | **str**| Updated name of the pet | [optional]
+ **status** | **str**| Updated status of the pet | [optional]
+
+### Return type
+
+void (empty response body)
+
+### Authorization
+
+[petstore_auth](../README.md#petstore_auth)
+
+### HTTP request headers
+
+ - **Content-Type**: application/x-www-form-urlencoded
+ - **Accept**: Not defined
+
+
+### HTTP response details
+| Status code | Description | Response headers |
+|-------------|-------------|------------------|
+**405** | Invalid input | - |
+
+[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
+
+# **upload_file**
+> ApiResponse upload_file(pet_id)
+
+uploads an image
+
+### Example
+
+* OAuth Authentication (petstore_auth):
+```python
+import time
+import petstore_api
+from petstore_api.api import pet_api
+from petstore_api.model.api_response import ApiResponse
+from pprint import pprint
+# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2
+# See configuration.py for a list of all supported configuration parameters.
+configuration = petstore_api.Configuration(
+ host = "http://petstore.swagger.io:80/v2"
+)
+
+# The client must configure the authentication and authorization parameters
+# in accordance with the API server security policy.
+# Examples for each auth method are provided below, use the example that
+# satisfies your auth use case.
+
+# Configure OAuth2 access token for authorization: petstore_auth
+configuration = petstore_api.Configuration(
+ host = "http://petstore.swagger.io:80/v2"
+)
+configuration.access_token = 'YOUR_ACCESS_TOKEN'
+
+# Enter a context with an instance of the API client
+with petstore_api.ApiClient(configuration) as api_client:
+ # Create an instance of the API class
+ api_instance = pet_api.PetApi(api_client)
+ pet_id = 1 # int | ID of pet to update
+ additional_metadata = "additional_metadata_example" # str | Additional data to pass to server (optional)
+ file = open('/path/to/file', 'rb') # file_type | file to upload (optional)
+ files = # [file_type] | files to upload (optional)
+
+ # example passing only required values which don't have defaults set
+ try:
+ # uploads an image
+ api_response = api_instance.upload_file(pet_id)
+ pprint(api_response)
+ except petstore_api.ApiException as e:
+ print("Exception when calling PetApi->upload_file: %s\n" % e)
+
+ # example passing only required values which don't have defaults set
+ # and optional values
+ try:
+ # uploads an image
+ api_response = api_instance.upload_file(pet_id, additional_metadata=additional_metadata, file=file, files=files)
+ pprint(api_response)
+ except petstore_api.ApiException as e:
+ print("Exception when calling PetApi->upload_file: %s\n" % e)
+```
+
+
+### Parameters
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+ **pet_id** | **int**| ID of pet to update |
+ **additional_metadata** | **str**| Additional data to pass to server | [optional]
+ **file** | **file_type**| file to upload | [optional]
+ **files** | **[file_type]**| files to upload | [optional]
+
+### Return type
+
+[**ApiResponse**](ApiResponse.md)
+
+### Authorization
+
+[petstore_auth](../README.md#petstore_auth)
+
+### HTTP request headers
+
+ - **Content-Type**: multipart/form-data
+ - **Accept**: application/json
+
+
+### HTTP response details
+| Status code | Description | Response headers |
+|-------------|-------------|------------------|
+**200** | successful operation | - |
+
+[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
+
+# **upload_file_with_required_file**
+> ApiResponse upload_file_with_required_file(pet_id, required_file)
+
+uploads an image (required)
+
+### Example
+
+* OAuth Authentication (petstore_auth):
+```python
+import time
+import petstore_api
+from petstore_api.api import pet_api
+from petstore_api.model.api_response import ApiResponse
+from pprint import pprint
+# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2
+# See configuration.py for a list of all supported configuration parameters.
+configuration = petstore_api.Configuration(
+ host = "http://petstore.swagger.io:80/v2"
+)
+
+# The client must configure the authentication and authorization parameters
+# in accordance with the API server security policy.
+# Examples for each auth method are provided below, use the example that
+# satisfies your auth use case.
+
+# Configure OAuth2 access token for authorization: petstore_auth
+configuration = petstore_api.Configuration(
+ host = "http://petstore.swagger.io:80/v2"
+)
+configuration.access_token = 'YOUR_ACCESS_TOKEN'
+
+# Enter a context with an instance of the API client
+with petstore_api.ApiClient(configuration) as api_client:
+ # Create an instance of the API class
+ api_instance = pet_api.PetApi(api_client)
+ pet_id = 1 # int | ID of pet to update
+ required_file = open('/path/to/file', 'rb') # file_type | file to upload
+ additional_metadata = "additional_metadata_example" # str | Additional data to pass to server (optional)
+
+ # example passing only required values which don't have defaults set
+ try:
+ # uploads an image (required)
+ api_response = api_instance.upload_file_with_required_file(pet_id, required_file)
+ pprint(api_response)
+ except petstore_api.ApiException as e:
+ print("Exception when calling PetApi->upload_file_with_required_file: %s\n" % e)
+
+ # example passing only required values which don't have defaults set
+ # and optional values
+ try:
+ # uploads an image (required)
+ api_response = api_instance.upload_file_with_required_file(pet_id, required_file, additional_metadata=additional_metadata)
+ pprint(api_response)
+ except petstore_api.ApiException as e:
+ print("Exception when calling PetApi->upload_file_with_required_file: %s\n" % e)
+```
+
+
+### Parameters
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+ **pet_id** | **int**| ID of pet to update |
+ **required_file** | **file_type**| file to upload |
+ **additional_metadata** | **str**| Additional data to pass to server | [optional]
+
+### Return type
+
+[**ApiResponse**](ApiResponse.md)
+
+### Authorization
+
+[petstore_auth](../README.md#petstore_auth)
+
+### HTTP request headers
+
+ - **Content-Type**: multipart/form-data
+ - **Accept**: application/json
+
+
+### HTTP response details
+| Status code | Description | Response headers |
+|-------------|-------------|------------------|
+**200** | successful operation | - |
+
+[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
+
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/Player.md b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/Player.md
new file mode 100644
index 000000000000..2014198aa1bd
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/Player.md
@@ -0,0 +1,12 @@
+# Player
+
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**name** | **str** | |
+**enemy_player** | [**Player**](Player.md) | | [optional]
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/ReadOnlyFirst.md b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/ReadOnlyFirst.md
new file mode 100644
index 000000000000..53b4c61d8445
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/ReadOnlyFirst.md
@@ -0,0 +1,12 @@
+# ReadOnlyFirst
+
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**bar** | **str** | | [optional] [readonly]
+**baz** | **str** | | [optional]
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/SpecialModelName.md b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/SpecialModelName.md
new file mode 100644
index 000000000000..268e1134192d
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/SpecialModelName.md
@@ -0,0 +1,11 @@
+# SpecialModelName
+
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**special_property_name** | **int** | | [optional]
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/StoreApi.md b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/StoreApi.md
new file mode 100644
index 000000000000..b5df4fc1feea
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/StoreApi.md
@@ -0,0 +1,285 @@
+# petstore_api.StoreApi
+
+All URIs are relative to *http://petstore.swagger.io:80/v2*
+
+Method | HTTP request | Description
+------------- | ------------- | -------------
+[**delete_order**](StoreApi.md#delete_order) | **DELETE** /store/order/{order_id} | Delete purchase order by ID
+[**get_inventory**](StoreApi.md#get_inventory) | **GET** /store/inventory | Returns pet inventories by status
+[**get_order_by_id**](StoreApi.md#get_order_by_id) | **GET** /store/order/{order_id} | Find purchase order by ID
+[**place_order**](StoreApi.md#place_order) | **POST** /store/order | Place an order for a pet
+
+
+# **delete_order**
+> delete_order(order_id)
+
+Delete purchase order by ID
+
+For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
+
+### Example
+
+```python
+import time
+import petstore_api
+from petstore_api.api import store_api
+from pprint import pprint
+# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2
+# See configuration.py for a list of all supported configuration parameters.
+configuration = petstore_api.Configuration(
+ host = "http://petstore.swagger.io:80/v2"
+)
+
+
+# Enter a context with an instance of the API client
+with petstore_api.ApiClient() as api_client:
+ # Create an instance of the API class
+ api_instance = store_api.StoreApi(api_client)
+ order_id = "order_id_example" # str | ID of the order that needs to be deleted
+
+ # example passing only required values which don't have defaults set
+ try:
+ # Delete purchase order by ID
+ api_instance.delete_order(order_id)
+ except petstore_api.ApiException as e:
+ print("Exception when calling StoreApi->delete_order: %s\n" % e)
+```
+
+
+### Parameters
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+ **order_id** | **str**| ID of the order that needs to be deleted |
+
+### Return type
+
+void (empty response body)
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+ - **Content-Type**: Not defined
+ - **Accept**: Not defined
+
+
+### HTTP response details
+| Status code | Description | Response headers |
+|-------------|-------------|------------------|
+**400** | Invalid ID supplied | - |
+**404** | Order not found | - |
+
+[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
+
+# **get_inventory**
+> {str: (int,)} get_inventory()
+
+Returns pet inventories by status
+
+Returns a map of status codes to quantities
+
+### Example
+
+* Api Key Authentication (api_key):
+```python
+import time
+import petstore_api
+from petstore_api.api import store_api
+from pprint import pprint
+# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2
+# See configuration.py for a list of all supported configuration parameters.
+configuration = petstore_api.Configuration(
+ host = "http://petstore.swagger.io:80/v2"
+)
+
+# The client must configure the authentication and authorization parameters
+# in accordance with the API server security policy.
+# Examples for each auth method are provided below, use the example that
+# satisfies your auth use case.
+
+# Configure API key authorization: api_key
+configuration.api_key['api_key'] = 'YOUR_API_KEY'
+
+# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
+# configuration.api_key_prefix['api_key'] = 'Bearer'
+
+# Enter a context with an instance of the API client
+with petstore_api.ApiClient(configuration) as api_client:
+ # Create an instance of the API class
+ api_instance = store_api.StoreApi(api_client)
+
+ # example, this endpoint has no required or optional parameters
+ try:
+ # Returns pet inventories by status
+ api_response = api_instance.get_inventory()
+ pprint(api_response)
+ except petstore_api.ApiException as e:
+ print("Exception when calling StoreApi->get_inventory: %s\n" % e)
+```
+
+
+### Parameters
+This endpoint does not need any parameter.
+
+### Return type
+
+**{str: (int,)}**
+
+### Authorization
+
+[api_key](../README.md#api_key)
+
+### HTTP request headers
+
+ - **Content-Type**: Not defined
+ - **Accept**: application/json
+
+
+### HTTP response details
+| Status code | Description | Response headers |
+|-------------|-------------|------------------|
+**200** | successful operation | - |
+
+[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
+
+# **get_order_by_id**
+> Order get_order_by_id(order_id)
+
+Find purchase order by ID
+
+For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
+
+### Example
+
+```python
+import time
+import petstore_api
+from petstore_api.api import store_api
+from petstore_api.model.order import Order
+from pprint import pprint
+# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2
+# See configuration.py for a list of all supported configuration parameters.
+configuration = petstore_api.Configuration(
+ host = "http://petstore.swagger.io:80/v2"
+)
+
+
+# Enter a context with an instance of the API client
+with petstore_api.ApiClient() as api_client:
+ # Create an instance of the API class
+ api_instance = store_api.StoreApi(api_client)
+ order_id = 1 # int | ID of pet that needs to be fetched
+
+ # example passing only required values which don't have defaults set
+ try:
+ # Find purchase order by ID
+ api_response = api_instance.get_order_by_id(order_id)
+ pprint(api_response)
+ except petstore_api.ApiException as e:
+ print("Exception when calling StoreApi->get_order_by_id: %s\n" % e)
+```
+
+
+### Parameters
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+ **order_id** | **int**| ID of pet that needs to be fetched |
+
+### Return type
+
+[**Order**](Order.md)
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+ - **Content-Type**: Not defined
+ - **Accept**: application/xml, application/json
+
+
+### HTTP response details
+| Status code | Description | Response headers |
+|-------------|-------------|------------------|
+**200** | successful operation | - |
+**400** | Invalid ID supplied | - |
+**404** | Order not found | - |
+
+[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
+
+# **place_order**
+> Order place_order(body)
+
+Place an order for a pet
+
+### Example
+
+```python
+import time
+import petstore_api
+from petstore_api.api import store_api
+from petstore_api.model.order import Order
+from pprint import pprint
+# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2
+# See configuration.py for a list of all supported configuration parameters.
+configuration = petstore_api.Configuration(
+ host = "http://petstore.swagger.io:80/v2"
+)
+
+
+# Enter a context with an instance of the API client
+with petstore_api.ApiClient() as api_client:
+ # Create an instance of the API class
+ api_instance = store_api.StoreApi(api_client)
+ body = Order(
+ id=1,
+ pet_id=1,
+ quantity=1,
+ ship_date=dateutil_parser('1970-01-01T00:00:00.00Z'),
+ status="placed",
+ complete=False,
+ ) # Order | order placed for purchasing the pet
+
+ # example passing only required values which don't have defaults set
+ try:
+ # Place an order for a pet
+ api_response = api_instance.place_order(body)
+ pprint(api_response)
+ except petstore_api.ApiException as e:
+ print("Exception when calling StoreApi->place_order: %s\n" % e)
+```
+
+
+### Parameters
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+ **body** | [**Order**](Order.md)| order placed for purchasing the pet |
+
+### Return type
+
+[**Order**](Order.md)
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+ - **Content-Type**: Not defined
+ - **Accept**: application/xml, application/json
+
+
+### HTTP response details
+| Status code | Description | Response headers |
+|-------------|-------------|------------------|
+**200** | successful operation | - |
+**400** | Invalid Order | - |
+
+[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
+
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/StringBooleanMap.md b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/StringBooleanMap.md
new file mode 100644
index 000000000000..217c79704081
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/StringBooleanMap.md
@@ -0,0 +1,11 @@
+# StringBooleanMap
+
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**any string name** | **bool** | any string name can be used but the value must be the correct type | [optional]
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/StringEnum.md b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/StringEnum.md
new file mode 100644
index 000000000000..bb195ec0e453
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/StringEnum.md
@@ -0,0 +1,11 @@
+# StringEnum
+
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**value** | **str** | | must be one of ["placed", "approved", "delivered", ]
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/Tag.md b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/Tag.md
new file mode 100644
index 000000000000..b9fe1e0944c4
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/Tag.md
@@ -0,0 +1,13 @@
+# Tag
+
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**id** | **int** | | [optional]
+**name** | **str** | | [optional]
+**full_name** | **str** | | [optional]
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/TypeHolderDefault.md b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/TypeHolderDefault.md
new file mode 100644
index 000000000000..904915aec010
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/TypeHolderDefault.md
@@ -0,0 +1,18 @@
+# TypeHolderDefault
+
+a model to test optional properties with server defaults
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**array_item** | **[int]** | |
+**string_item** | **str** | | defaults to "what"
+**number_item** | **float** | | defaults to 1.234
+**integer_item** | **int** | | defaults to -2
+**bool_item** | **bool** | | defaults to True
+**date_item** | **date** | | [optional]
+**datetime_item** | **datetime** | | [optional]
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/TypeHolderExample.md b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/TypeHolderExample.md
new file mode 100644
index 000000000000..d2954c64dcef
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/TypeHolderExample.md
@@ -0,0 +1,16 @@
+# TypeHolderExample
+
+a model to test required properties with an example and length one enum
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**bool_item** | **bool** | |
+**array_item** | **[int]** | |
+**string_item** | **str** | | defaults to "what"
+**number_item** | **float** | | defaults to 1.234
+**integer_item** | **int** | | defaults to -2
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/User.md b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/User.md
new file mode 100644
index 000000000000..b0079f591b6e
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/User.md
@@ -0,0 +1,18 @@
+# User
+
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**id** | **int** | | [optional]
+**username** | **str** | | [optional]
+**first_name** | **str** | | [optional]
+**last_name** | **str** | | [optional]
+**email** | **str** | | [optional]
+**password** | **str** | | [optional]
+**phone** | **str** | | [optional]
+**user_status** | **int** | User Status | [optional]
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/UserApi.md b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/UserApi.md
new file mode 100644
index 000000000000..3c04b81d1967
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/UserApi.md
@@ -0,0 +1,562 @@
+# petstore_api.UserApi
+
+All URIs are relative to *http://petstore.swagger.io:80/v2*
+
+Method | HTTP request | Description
+------------- | ------------- | -------------
+[**create_user**](UserApi.md#create_user) | **POST** /user | Create user
+[**create_users_with_array_input**](UserApi.md#create_users_with_array_input) | **POST** /user/createWithArray | Creates list of users with given input array
+[**create_users_with_list_input**](UserApi.md#create_users_with_list_input) | **POST** /user/createWithList | Creates list of users with given input array
+[**delete_user**](UserApi.md#delete_user) | **DELETE** /user/{username} | Delete user
+[**get_user_by_name**](UserApi.md#get_user_by_name) | **GET** /user/{username} | Get user by user name
+[**login_user**](UserApi.md#login_user) | **GET** /user/login | Logs user into the system
+[**logout_user**](UserApi.md#logout_user) | **GET** /user/logout | Logs out current logged in user session
+[**update_user**](UserApi.md#update_user) | **PUT** /user/{username} | Updated user
+
+
+# **create_user**
+> create_user(body)
+
+Create user
+
+This can only be done by the logged in user.
+
+### Example
+
+```python
+import time
+import petstore_api
+from petstore_api.api import user_api
+from petstore_api.model.user import User
+from pprint import pprint
+# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2
+# See configuration.py for a list of all supported configuration parameters.
+configuration = petstore_api.Configuration(
+ host = "http://petstore.swagger.io:80/v2"
+)
+
+
+# Enter a context with an instance of the API client
+with petstore_api.ApiClient() as api_client:
+ # Create an instance of the API class
+ api_instance = user_api.UserApi(api_client)
+ body = User(
+ id=1,
+ username="username_example",
+ first_name="first_name_example",
+ last_name="last_name_example",
+ email="email_example",
+ password="password_example",
+ phone="phone_example",
+ user_status=1,
+ ) # User | Created user object
+
+ # example passing only required values which don't have defaults set
+ try:
+ # Create user
+ api_instance.create_user(body)
+ except petstore_api.ApiException as e:
+ print("Exception when calling UserApi->create_user: %s\n" % e)
+```
+
+
+### Parameters
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+ **body** | [**User**](User.md)| Created user object |
+
+### Return type
+
+void (empty response body)
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+ - **Content-Type**: Not defined
+ - **Accept**: Not defined
+
+
+### HTTP response details
+| Status code | Description | Response headers |
+|-------------|-------------|------------------|
+**0** | successful operation | - |
+
+[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
+
+# **create_users_with_array_input**
+> create_users_with_array_input(body)
+
+Creates list of users with given input array
+
+### Example
+
+```python
+import time
+import petstore_api
+from petstore_api.api import user_api
+from petstore_api.model.user import User
+from pprint import pprint
+# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2
+# See configuration.py for a list of all supported configuration parameters.
+configuration = petstore_api.Configuration(
+ host = "http://petstore.swagger.io:80/v2"
+)
+
+
+# Enter a context with an instance of the API client
+with petstore_api.ApiClient() as api_client:
+ # Create an instance of the API class
+ api_instance = user_api.UserApi(api_client)
+ body = [
+ User(
+ id=1,
+ username="username_example",
+ first_name="first_name_example",
+ last_name="last_name_example",
+ email="email_example",
+ password="password_example",
+ phone="phone_example",
+ user_status=1,
+ ),
+ ] # [User] | List of user object
+
+ # example passing only required values which don't have defaults set
+ try:
+ # Creates list of users with given input array
+ api_instance.create_users_with_array_input(body)
+ except petstore_api.ApiException as e:
+ print("Exception when calling UserApi->create_users_with_array_input: %s\n" % e)
+```
+
+
+### Parameters
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+ **body** | [**[User]**](User.md)| List of user object |
+
+### Return type
+
+void (empty response body)
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+ - **Content-Type**: Not defined
+ - **Accept**: Not defined
+
+
+### HTTP response details
+| Status code | Description | Response headers |
+|-------------|-------------|------------------|
+**0** | successful operation | - |
+
+[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
+
+# **create_users_with_list_input**
+> create_users_with_list_input(body)
+
+Creates list of users with given input array
+
+### Example
+
+```python
+import time
+import petstore_api
+from petstore_api.api import user_api
+from petstore_api.model.user import User
+from pprint import pprint
+# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2
+# See configuration.py for a list of all supported configuration parameters.
+configuration = petstore_api.Configuration(
+ host = "http://petstore.swagger.io:80/v2"
+)
+
+
+# Enter a context with an instance of the API client
+with petstore_api.ApiClient() as api_client:
+ # Create an instance of the API class
+ api_instance = user_api.UserApi(api_client)
+ body = [
+ User(
+ id=1,
+ username="username_example",
+ first_name="first_name_example",
+ last_name="last_name_example",
+ email="email_example",
+ password="password_example",
+ phone="phone_example",
+ user_status=1,
+ ),
+ ] # [User] | List of user object
+
+ # example passing only required values which don't have defaults set
+ try:
+ # Creates list of users with given input array
+ api_instance.create_users_with_list_input(body)
+ except petstore_api.ApiException as e:
+ print("Exception when calling UserApi->create_users_with_list_input: %s\n" % e)
+```
+
+
+### Parameters
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+ **body** | [**[User]**](User.md)| List of user object |
+
+### Return type
+
+void (empty response body)
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+ - **Content-Type**: Not defined
+ - **Accept**: Not defined
+
+
+### HTTP response details
+| Status code | Description | Response headers |
+|-------------|-------------|------------------|
+**0** | successful operation | - |
+
+[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
+
+# **delete_user**
+> delete_user(username)
+
+Delete user
+
+This can only be done by the logged in user.
+
+### Example
+
+```python
+import time
+import petstore_api
+from petstore_api.api import user_api
+from pprint import pprint
+# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2
+# See configuration.py for a list of all supported configuration parameters.
+configuration = petstore_api.Configuration(
+ host = "http://petstore.swagger.io:80/v2"
+)
+
+
+# Enter a context with an instance of the API client
+with petstore_api.ApiClient() as api_client:
+ # Create an instance of the API class
+ api_instance = user_api.UserApi(api_client)
+ username = "username_example" # str | The name that needs to be deleted
+
+ # example passing only required values which don't have defaults set
+ try:
+ # Delete user
+ api_instance.delete_user(username)
+ except petstore_api.ApiException as e:
+ print("Exception when calling UserApi->delete_user: %s\n" % e)
+```
+
+
+### Parameters
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+ **username** | **str**| The name that needs to be deleted |
+
+### Return type
+
+void (empty response body)
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+ - **Content-Type**: Not defined
+ - **Accept**: Not defined
+
+
+### HTTP response details
+| Status code | Description | Response headers |
+|-------------|-------------|------------------|
+**400** | Invalid username supplied | - |
+**404** | User not found | - |
+
+[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
+
+# **get_user_by_name**
+> User get_user_by_name(username)
+
+Get user by user name
+
+### Example
+
+```python
+import time
+import petstore_api
+from petstore_api.api import user_api
+from petstore_api.model.user import User
+from pprint import pprint
+# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2
+# See configuration.py for a list of all supported configuration parameters.
+configuration = petstore_api.Configuration(
+ host = "http://petstore.swagger.io:80/v2"
+)
+
+
+# Enter a context with an instance of the API client
+with petstore_api.ApiClient() as api_client:
+ # Create an instance of the API class
+ api_instance = user_api.UserApi(api_client)
+ username = "username_example" # str | The name that needs to be fetched. Use user1 for testing.
+
+ # example passing only required values which don't have defaults set
+ try:
+ # Get user by user name
+ api_response = api_instance.get_user_by_name(username)
+ pprint(api_response)
+ except petstore_api.ApiException as e:
+ print("Exception when calling UserApi->get_user_by_name: %s\n" % e)
+```
+
+
+### Parameters
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+ **username** | **str**| The name that needs to be fetched. Use user1 for testing. |
+
+### Return type
+
+[**User**](User.md)
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+ - **Content-Type**: Not defined
+ - **Accept**: application/xml, application/json
+
+
+### HTTP response details
+| Status code | Description | Response headers |
+|-------------|-------------|------------------|
+**200** | successful operation | - |
+**400** | Invalid username supplied | - |
+**404** | User not found | - |
+
+[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
+
+# **login_user**
+> str login_user(username, password)
+
+Logs user into the system
+
+### Example
+
+```python
+import time
+import petstore_api
+from petstore_api.api import user_api
+from pprint import pprint
+# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2
+# See configuration.py for a list of all supported configuration parameters.
+configuration = petstore_api.Configuration(
+ host = "http://petstore.swagger.io:80/v2"
+)
+
+
+# Enter a context with an instance of the API client
+with petstore_api.ApiClient() as api_client:
+ # Create an instance of the API class
+ api_instance = user_api.UserApi(api_client)
+ username = "username_example" # str | The user name for login
+ password = "password_example" # str | The password for login in clear text
+
+ # example passing only required values which don't have defaults set
+ try:
+ # Logs user into the system
+ api_response = api_instance.login_user(username, password)
+ pprint(api_response)
+ except petstore_api.ApiException as e:
+ print("Exception when calling UserApi->login_user: %s\n" % e)
+```
+
+
+### Parameters
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+ **username** | **str**| The user name for login |
+ **password** | **str**| The password for login in clear text |
+
+### Return type
+
+**str**
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+ - **Content-Type**: Not defined
+ - **Accept**: application/xml, application/json
+
+
+### HTTP response details
+| Status code | Description | Response headers |
+|-------------|-------------|------------------|
+**200** | successful operation | * X-Rate-Limit - calls per hour allowed by the user
* X-Expires-After - date in UTC when token expires
|
+**400** | Invalid username/password supplied | - |
+
+[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
+
+# **logout_user**
+> logout_user()
+
+Logs out current logged in user session
+
+### Example
+
+```python
+import time
+import petstore_api
+from petstore_api.api import user_api
+from pprint import pprint
+# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2
+# See configuration.py for a list of all supported configuration parameters.
+configuration = petstore_api.Configuration(
+ host = "http://petstore.swagger.io:80/v2"
+)
+
+
+# Enter a context with an instance of the API client
+with petstore_api.ApiClient() as api_client:
+ # Create an instance of the API class
+ api_instance = user_api.UserApi(api_client)
+
+ # example, this endpoint has no required or optional parameters
+ try:
+ # Logs out current logged in user session
+ api_instance.logout_user()
+ except petstore_api.ApiException as e:
+ print("Exception when calling UserApi->logout_user: %s\n" % e)
+```
+
+
+### Parameters
+This endpoint does not need any parameter.
+
+### Return type
+
+void (empty response body)
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+ - **Content-Type**: Not defined
+ - **Accept**: Not defined
+
+
+### HTTP response details
+| Status code | Description | Response headers |
+|-------------|-------------|------------------|
+**0** | successful operation | - |
+
+[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
+
+# **update_user**
+> update_user(username, body)
+
+Updated user
+
+This can only be done by the logged in user.
+
+### Example
+
+```python
+import time
+import petstore_api
+from petstore_api.api import user_api
+from petstore_api.model.user import User
+from pprint import pprint
+# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2
+# See configuration.py for a list of all supported configuration parameters.
+configuration = petstore_api.Configuration(
+ host = "http://petstore.swagger.io:80/v2"
+)
+
+
+# Enter a context with an instance of the API client
+with petstore_api.ApiClient() as api_client:
+ # Create an instance of the API class
+ api_instance = user_api.UserApi(api_client)
+ username = "username_example" # str | name that need to be deleted
+ body = User(
+ id=1,
+ username="username_example",
+ first_name="first_name_example",
+ last_name="last_name_example",
+ email="email_example",
+ password="password_example",
+ phone="phone_example",
+ user_status=1,
+ ) # User | Updated user object
+
+ # example passing only required values which don't have defaults set
+ try:
+ # Updated user
+ api_instance.update_user(username, body)
+ except petstore_api.ApiException as e:
+ print("Exception when calling UserApi->update_user: %s\n" % e)
+```
+
+
+### Parameters
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+ **username** | **str**| name that need to be deleted |
+ **body** | [**User**](User.md)| Updated user object |
+
+### Return type
+
+void (empty response body)
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+ - **Content-Type**: Not defined
+ - **Accept**: Not defined
+
+
+### HTTP response details
+| Status code | Description | Response headers |
+|-------------|-------------|------------------|
+**400** | Invalid user supplied | - |
+**404** | User not found | - |
+
+[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
+
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/XmlItem.md b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/XmlItem.md
new file mode 100644
index 000000000000..ea3d7f92804b
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/XmlItem.md
@@ -0,0 +1,39 @@
+# XmlItem
+
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**attribute_string** | **str** | | [optional]
+**attribute_number** | **float** | | [optional]
+**attribute_integer** | **int** | | [optional]
+**attribute_boolean** | **bool** | | [optional]
+**wrapped_array** | **[int]** | | [optional]
+**name_string** | **str** | | [optional]
+**name_number** | **float** | | [optional]
+**name_integer** | **int** | | [optional]
+**name_boolean** | **bool** | | [optional]
+**name_array** | **[int]** | | [optional]
+**name_wrapped_array** | **[int]** | | [optional]
+**prefix_string** | **str** | | [optional]
+**prefix_number** | **float** | | [optional]
+**prefix_integer** | **int** | | [optional]
+**prefix_boolean** | **bool** | | [optional]
+**prefix_array** | **[int]** | | [optional]
+**prefix_wrapped_array** | **[int]** | | [optional]
+**namespace_string** | **str** | | [optional]
+**namespace_number** | **float** | | [optional]
+**namespace_integer** | **int** | | [optional]
+**namespace_boolean** | **bool** | | [optional]
+**namespace_array** | **[int]** | | [optional]
+**namespace_wrapped_array** | **[int]** | | [optional]
+**prefix_ns_string** | **str** | | [optional]
+**prefix_ns_number** | **float** | | [optional]
+**prefix_ns_integer** | **int** | | [optional]
+**prefix_ns_boolean** | **bool** | | [optional]
+**prefix_ns_array** | **[int]** | | [optional]
+**prefix_ns_wrapped_array** | **[int]** | | [optional]
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/git_push.sh b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/git_push.sh
new file mode 100644
index 000000000000..ced3be2b0c7b
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/git_push.sh
@@ -0,0 +1,58 @@
+#!/bin/sh
+# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
+#
+# Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update" "gitlab.com"
+
+git_user_id=$1
+git_repo_id=$2
+release_note=$3
+git_host=$4
+
+if [ "$git_host" = "" ]; then
+ git_host="github.com"
+ echo "[INFO] No command line input provided. Set \$git_host to $git_host"
+fi
+
+if [ "$git_user_id" = "" ]; then
+ git_user_id="GIT_USER_ID"
+ echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
+fi
+
+if [ "$git_repo_id" = "" ]; then
+ git_repo_id="GIT_REPO_ID"
+ echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
+fi
+
+if [ "$release_note" = "" ]; then
+ release_note="Minor update"
+ echo "[INFO] No command line input provided. Set \$release_note to $release_note"
+fi
+
+# Initialize the local directory as a Git repository
+git init
+
+# Adds the files in the local repository and stages them for commit.
+git add .
+
+# Commits the tracked changes and prepares them to be pushed to a remote repository.
+git commit -m "$release_note"
+
+# Sets the new remote
+git_remote=`git remote`
+if [ "$git_remote" = "" ]; then # git remote not defined
+
+ if [ "$GIT_TOKEN" = "" ]; then
+ echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
+ git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git
+ else
+ git remote add origin https://${git_user_id}:${GIT_TOKEN}@${git_host}/${git_user_id}/${git_repo_id}.git
+ fi
+
+fi
+
+git pull origin master
+
+# Pushes (Forces) the changes in the local repository up to the remote repository
+echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git"
+git push origin master 2>&1 | grep -v 'To https'
+
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/__init__.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/__init__.py
new file mode 100644
index 000000000000..26dd6f84e215
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/__init__.py
@@ -0,0 +1,27 @@
+# flake8: noqa
+
+"""
+ 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: https://openapi-generator.tech
+"""
+
+
+__version__ = "1.0.0"
+
+# import ApiClient
+from petstore_api.api_client import ApiClient
+
+# import Configuration
+from petstore_api.configuration import Configuration
+
+# import exceptions
+from petstore_api.exceptions import OpenApiException
+from petstore_api.exceptions import ApiAttributeError
+from petstore_api.exceptions import ApiTypeError
+from petstore_api.exceptions import ApiValueError
+from petstore_api.exceptions import ApiKeyError
+from petstore_api.exceptions import ApiException
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/api/__init__.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/api/__init__.py
new file mode 100644
index 000000000000..840e9f0cd908
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/api/__init__.py
@@ -0,0 +1,3 @@
+# do not import all apis into this module because that uses a lot of memory and stack frames
+# if you need the ability to import all apis from one package, import them with
+# from petstore_api.apis import AnotherFakeApi
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/api/another_fake_api.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/api/another_fake_api.py
new file mode 100644
index 000000000000..9c75f7d5a83e
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/api/another_fake_api.py
@@ -0,0 +1,155 @@
+"""
+ 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: https://openapi-generator.tech
+"""
+
+
+import re # noqa: F401
+import sys # noqa: F401
+
+from petstore_api.api_client import ApiClient, Endpoint as _Endpoint
+from petstore_api.model_utils import ( # noqa: F401
+ check_allowed_values,
+ check_validations,
+ date,
+ datetime,
+ file_type,
+ none_type,
+ validate_and_convert_types
+)
+from petstore_api.model.client import Client
+
+
+class AnotherFakeApi(object):
+ """NOTE: This class is auto generated by OpenAPI Generator
+ Ref: https://openapi-generator.tech
+
+ Do not edit the class manually.
+ """
+
+ def __init__(self, api_client=None):
+ if api_client is None:
+ api_client = ApiClient()
+ self.api_client = api_client
+
+ def __call_123_test_special_tags(
+ self,
+ body,
+ **kwargs
+ ):
+ """To test special tags # noqa: E501
+
+ To test special tags and operation ID starting with number # noqa: E501
+ This method makes a synchronous HTTP request by default. To make an
+ asynchronous HTTP request, please pass async_req=True
+
+ >>> thread = api.call_123_test_special_tags(body, async_req=True)
+ >>> result = thread.get()
+
+ Args:
+ body (Client): client model
+
+ Keyword Args:
+ _return_http_data_only (bool): response data without head status
+ code and headers. Default is True.
+ _preload_content (bool): if False, the urllib3.HTTPResponse object
+ will be returned without reading/decoding response data.
+ Default is True.
+ _request_timeout (float/tuple): timeout setting for this request. If one
+ number provided, it will be total request timeout. It can also
+ be a pair (tuple) of (connection, read) timeouts.
+ Default is None.
+ _check_input_type (bool): specifies if type checking
+ should be done one the data sent to the server.
+ Default is True.
+ _check_return_type (bool): specifies if type checking
+ should be done one the data received from the server.
+ Default is True.
+ _host_index (int/None): specifies the index of the server
+ that we want to use.
+ Default is read from the configuration.
+ async_req (bool): execute request asynchronously
+
+ Returns:
+ Client
+ If the method is called asynchronously, returns the request
+ thread.
+ """
+ kwargs['async_req'] = kwargs.get(
+ 'async_req', False
+ )
+ kwargs['_return_http_data_only'] = kwargs.get(
+ '_return_http_data_only', True
+ )
+ kwargs['_preload_content'] = kwargs.get(
+ '_preload_content', True
+ )
+ kwargs['_request_timeout'] = kwargs.get(
+ '_request_timeout', None
+ )
+ kwargs['_check_input_type'] = kwargs.get(
+ '_check_input_type', True
+ )
+ kwargs['_check_return_type'] = kwargs.get(
+ '_check_return_type', True
+ )
+ kwargs['_host_index'] = kwargs.get('_host_index')
+ kwargs['body'] = \
+ body
+ return self.call_with_http_info(**kwargs)
+
+ self.call_123_test_special_tags = _Endpoint(
+ settings={
+ 'response_type': (Client,),
+ 'auth': [],
+ 'endpoint_path': '/another-fake/dummy',
+ 'operation_id': 'call_123_test_special_tags',
+ 'http_method': 'PATCH',
+ 'servers': None,
+ },
+ params_map={
+ 'all': [
+ 'body',
+ ],
+ 'required': [
+ 'body',
+ ],
+ 'nullable': [
+ ],
+ 'enum': [
+ ],
+ 'validation': [
+ ]
+ },
+ root_map={
+ 'validations': {
+ },
+ 'allowed_values': {
+ },
+ 'openapi_types': {
+ 'body':
+ (Client,),
+ },
+ 'attribute_map': {
+ },
+ 'location_map': {
+ 'body': 'body',
+ },
+ 'collection_format_map': {
+ }
+ },
+ headers_map={
+ 'accept': [
+ 'application/json'
+ ],
+ 'content_type': [
+ 'application/json'
+ ]
+ },
+ api_client=api_client,
+ callable=__call_123_test_special_tags
+ )
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/api/fake_api.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/api/fake_api.py
new file mode 100644
index 000000000000..aaf44e6f64c8
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/api/fake_api.py
@@ -0,0 +1,2223 @@
+"""
+ 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: https://openapi-generator.tech
+"""
+
+
+import re # noqa: F401
+import sys # noqa: F401
+
+from petstore_api.api_client import ApiClient, Endpoint as _Endpoint
+from petstore_api.model_utils import ( # noqa: F401
+ check_allowed_values,
+ check_validations,
+ date,
+ datetime,
+ file_type,
+ none_type,
+ validate_and_convert_types
+)
+from petstore_api.model.animal_farm import AnimalFarm
+from petstore_api.model.client import Client
+from petstore_api.model.file_schema_test_class import FileSchemaTestClass
+from petstore_api.model.number_with_validations import NumberWithValidations
+from petstore_api.model.object_model_with_ref_props import ObjectModelWithRefProps
+from petstore_api.model.string_enum import StringEnum
+from petstore_api.model.user import User
+from petstore_api.model.xml_item import XmlItem
+
+
+class FakeApi(object):
+ """NOTE: This class is auto generated by OpenAPI Generator
+ Ref: https://openapi-generator.tech
+
+ Do not edit the class manually.
+ """
+
+ def __init__(self, api_client=None):
+ if api_client is None:
+ api_client = ApiClient()
+ self.api_client = api_client
+
+ def __array_model(
+ self,
+ **kwargs
+ ):
+ """array_model # noqa: E501
+
+ Test serialization of ArrayModel # noqa: E501
+ This method makes a synchronous HTTP request by default. To make an
+ asynchronous HTTP request, please pass async_req=True
+
+ >>> thread = api.array_model(async_req=True)
+ >>> result = thread.get()
+
+
+ Keyword Args:
+ body (AnimalFarm): Input model. [optional]
+ _return_http_data_only (bool): response data without head status
+ code and headers. Default is True.
+ _preload_content (bool): if False, the urllib3.HTTPResponse object
+ will be returned without reading/decoding response data.
+ Default is True.
+ _request_timeout (float/tuple): timeout setting for this request. If one
+ number provided, it will be total request timeout. It can also
+ be a pair (tuple) of (connection, read) timeouts.
+ Default is None.
+ _check_input_type (bool): specifies if type checking
+ should be done one the data sent to the server.
+ Default is True.
+ _check_return_type (bool): specifies if type checking
+ should be done one the data received from the server.
+ Default is True.
+ _host_index (int/None): specifies the index of the server
+ that we want to use.
+ Default is read from the configuration.
+ async_req (bool): execute request asynchronously
+
+ Returns:
+ AnimalFarm
+ If the method is called asynchronously, returns the request
+ thread.
+ """
+ kwargs['async_req'] = kwargs.get(
+ 'async_req', False
+ )
+ kwargs['_return_http_data_only'] = kwargs.get(
+ '_return_http_data_only', True
+ )
+ kwargs['_preload_content'] = kwargs.get(
+ '_preload_content', True
+ )
+ kwargs['_request_timeout'] = kwargs.get(
+ '_request_timeout', None
+ )
+ kwargs['_check_input_type'] = kwargs.get(
+ '_check_input_type', True
+ )
+ kwargs['_check_return_type'] = kwargs.get(
+ '_check_return_type', True
+ )
+ kwargs['_host_index'] = kwargs.get('_host_index')
+ return self.call_with_http_info(**kwargs)
+
+ self.array_model = _Endpoint(
+ settings={
+ 'response_type': (AnimalFarm,),
+ 'auth': [],
+ 'endpoint_path': '/fake/refs/arraymodel',
+ 'operation_id': 'array_model',
+ 'http_method': 'POST',
+ 'servers': None,
+ },
+ params_map={
+ 'all': [
+ 'body',
+ ],
+ 'required': [],
+ 'nullable': [
+ ],
+ 'enum': [
+ ],
+ 'validation': [
+ ]
+ },
+ root_map={
+ 'validations': {
+ },
+ 'allowed_values': {
+ },
+ 'openapi_types': {
+ 'body':
+ (AnimalFarm,),
+ },
+ 'attribute_map': {
+ },
+ 'location_map': {
+ 'body': 'body',
+ },
+ 'collection_format_map': {
+ }
+ },
+ headers_map={
+ 'accept': [
+ '*/*'
+ ],
+ 'content_type': [],
+ },
+ api_client=api_client,
+ callable=__array_model
+ )
+
+ def __boolean(
+ self,
+ **kwargs
+ ):
+ """boolean # noqa: E501
+
+ Test serialization of outer boolean types # noqa: E501
+ This method makes a synchronous HTTP request by default. To make an
+ asynchronous HTTP request, please pass async_req=True
+
+ >>> thread = api.boolean(async_req=True)
+ >>> result = thread.get()
+
+
+ Keyword Args:
+ body (bool): Input boolean as post body. [optional]
+ _return_http_data_only (bool): response data without head status
+ code and headers. Default is True.
+ _preload_content (bool): if False, the urllib3.HTTPResponse object
+ will be returned without reading/decoding response data.
+ Default is True.
+ _request_timeout (float/tuple): timeout setting for this request. If one
+ number provided, it will be total request timeout. It can also
+ be a pair (tuple) of (connection, read) timeouts.
+ Default is None.
+ _check_input_type (bool): specifies if type checking
+ should be done one the data sent to the server.
+ Default is True.
+ _check_return_type (bool): specifies if type checking
+ should be done one the data received from the server.
+ Default is True.
+ _host_index (int/None): specifies the index of the server
+ that we want to use.
+ Default is read from the configuration.
+ async_req (bool): execute request asynchronously
+
+ Returns:
+ bool
+ If the method is called asynchronously, returns the request
+ thread.
+ """
+ kwargs['async_req'] = kwargs.get(
+ 'async_req', False
+ )
+ kwargs['_return_http_data_only'] = kwargs.get(
+ '_return_http_data_only', True
+ )
+ kwargs['_preload_content'] = kwargs.get(
+ '_preload_content', True
+ )
+ kwargs['_request_timeout'] = kwargs.get(
+ '_request_timeout', None
+ )
+ kwargs['_check_input_type'] = kwargs.get(
+ '_check_input_type', True
+ )
+ kwargs['_check_return_type'] = kwargs.get(
+ '_check_return_type', True
+ )
+ kwargs['_host_index'] = kwargs.get('_host_index')
+ return self.call_with_http_info(**kwargs)
+
+ self.boolean = _Endpoint(
+ settings={
+ 'response_type': (bool,),
+ 'auth': [],
+ 'endpoint_path': '/fake/refs/boolean',
+ 'operation_id': 'boolean',
+ 'http_method': 'POST',
+ 'servers': None,
+ },
+ params_map={
+ 'all': [
+ 'body',
+ ],
+ 'required': [],
+ 'nullable': [
+ ],
+ 'enum': [
+ ],
+ 'validation': [
+ ]
+ },
+ root_map={
+ 'validations': {
+ },
+ 'allowed_values': {
+ },
+ 'openapi_types': {
+ 'body':
+ (bool,),
+ },
+ 'attribute_map': {
+ },
+ 'location_map': {
+ 'body': 'body',
+ },
+ 'collection_format_map': {
+ }
+ },
+ headers_map={
+ 'accept': [
+ '*/*'
+ ],
+ 'content_type': [],
+ },
+ api_client=api_client,
+ callable=__boolean
+ )
+
+ def __create_xml_item(
+ self,
+ xml_item,
+ **kwargs
+ ):
+ """creates an XmlItem # noqa: E501
+
+ this route creates an XmlItem # noqa: E501
+ This method makes a synchronous HTTP request by default. To make an
+ asynchronous HTTP request, please pass async_req=True
+
+ >>> thread = api.create_xml_item(xml_item, async_req=True)
+ >>> result = thread.get()
+
+ Args:
+ xml_item (XmlItem): XmlItem Body
+
+ Keyword Args:
+ _return_http_data_only (bool): response data without head status
+ code and headers. Default is True.
+ _preload_content (bool): if False, the urllib3.HTTPResponse object
+ will be returned without reading/decoding response data.
+ Default is True.
+ _request_timeout (float/tuple): timeout setting for this request. If one
+ number provided, it will be total request timeout. It can also
+ be a pair (tuple) of (connection, read) timeouts.
+ Default is None.
+ _check_input_type (bool): specifies if type checking
+ should be done one the data sent to the server.
+ Default is True.
+ _check_return_type (bool): specifies if type checking
+ should be done one the data received from the server.
+ Default is True.
+ _host_index (int/None): specifies the index of the server
+ that we want to use.
+ Default is read from the configuration.
+ async_req (bool): execute request asynchronously
+
+ Returns:
+ None
+ If the method is called asynchronously, returns the request
+ thread.
+ """
+ kwargs['async_req'] = kwargs.get(
+ 'async_req', False
+ )
+ kwargs['_return_http_data_only'] = kwargs.get(
+ '_return_http_data_only', True
+ )
+ kwargs['_preload_content'] = kwargs.get(
+ '_preload_content', True
+ )
+ kwargs['_request_timeout'] = kwargs.get(
+ '_request_timeout', None
+ )
+ kwargs['_check_input_type'] = kwargs.get(
+ '_check_input_type', True
+ )
+ kwargs['_check_return_type'] = kwargs.get(
+ '_check_return_type', True
+ )
+ kwargs['_host_index'] = kwargs.get('_host_index')
+ kwargs['xml_item'] = \
+ xml_item
+ return self.call_with_http_info(**kwargs)
+
+ self.create_xml_item = _Endpoint(
+ settings={
+ 'response_type': None,
+ 'auth': [],
+ 'endpoint_path': '/fake/create_xml_item',
+ 'operation_id': 'create_xml_item',
+ 'http_method': 'POST',
+ 'servers': None,
+ },
+ params_map={
+ 'all': [
+ 'xml_item',
+ ],
+ 'required': [
+ 'xml_item',
+ ],
+ 'nullable': [
+ ],
+ 'enum': [
+ ],
+ 'validation': [
+ ]
+ },
+ root_map={
+ 'validations': {
+ },
+ 'allowed_values': {
+ },
+ 'openapi_types': {
+ 'xml_item':
+ (XmlItem,),
+ },
+ 'attribute_map': {
+ },
+ 'location_map': {
+ 'xml_item': 'body',
+ },
+ 'collection_format_map': {
+ }
+ },
+ headers_map={
+ 'accept': [],
+ 'content_type': [
+ 'application/xml',
+ 'application/xml; charset=utf-8',
+ 'application/xml; charset=utf-16',
+ 'text/xml',
+ 'text/xml; charset=utf-8',
+ 'text/xml; charset=utf-16'
+ ]
+ },
+ api_client=api_client,
+ callable=__create_xml_item
+ )
+
+ def __number_with_validations(
+ self,
+ **kwargs
+ ):
+ """number_with_validations # noqa: E501
+
+ Test serialization of outer number types # noqa: E501
+ This method makes a synchronous HTTP request by default. To make an
+ asynchronous HTTP request, please pass async_req=True
+
+ >>> thread = api.number_with_validations(async_req=True)
+ >>> result = thread.get()
+
+
+ Keyword Args:
+ body (NumberWithValidations): Input number as post body. [optional]
+ _return_http_data_only (bool): response data without head status
+ code and headers. Default is True.
+ _preload_content (bool): if False, the urllib3.HTTPResponse object
+ will be returned without reading/decoding response data.
+ Default is True.
+ _request_timeout (float/tuple): timeout setting for this request. If one
+ number provided, it will be total request timeout. It can also
+ be a pair (tuple) of (connection, read) timeouts.
+ Default is None.
+ _check_input_type (bool): specifies if type checking
+ should be done one the data sent to the server.
+ Default is True.
+ _check_return_type (bool): specifies if type checking
+ should be done one the data received from the server.
+ Default is True.
+ _host_index (int/None): specifies the index of the server
+ that we want to use.
+ Default is read from the configuration.
+ async_req (bool): execute request asynchronously
+
+ Returns:
+ NumberWithValidations
+ If the method is called asynchronously, returns the request
+ thread.
+ """
+ kwargs['async_req'] = kwargs.get(
+ 'async_req', False
+ )
+ kwargs['_return_http_data_only'] = kwargs.get(
+ '_return_http_data_only', True
+ )
+ kwargs['_preload_content'] = kwargs.get(
+ '_preload_content', True
+ )
+ kwargs['_request_timeout'] = kwargs.get(
+ '_request_timeout', None
+ )
+ kwargs['_check_input_type'] = kwargs.get(
+ '_check_input_type', True
+ )
+ kwargs['_check_return_type'] = kwargs.get(
+ '_check_return_type', True
+ )
+ kwargs['_host_index'] = kwargs.get('_host_index')
+ return self.call_with_http_info(**kwargs)
+
+ self.number_with_validations = _Endpoint(
+ settings={
+ 'response_type': (NumberWithValidations,),
+ 'auth': [],
+ 'endpoint_path': '/fake/refs/number',
+ 'operation_id': 'number_with_validations',
+ 'http_method': 'POST',
+ 'servers': None,
+ },
+ params_map={
+ 'all': [
+ 'body',
+ ],
+ 'required': [],
+ 'nullable': [
+ ],
+ 'enum': [
+ ],
+ 'validation': [
+ ]
+ },
+ root_map={
+ 'validations': {
+ },
+ 'allowed_values': {
+ },
+ 'openapi_types': {
+ 'body':
+ (NumberWithValidations,),
+ },
+ 'attribute_map': {
+ },
+ 'location_map': {
+ 'body': 'body',
+ },
+ 'collection_format_map': {
+ }
+ },
+ headers_map={
+ 'accept': [
+ '*/*'
+ ],
+ 'content_type': [],
+ },
+ api_client=api_client,
+ callable=__number_with_validations
+ )
+
+ def __object_model_with_ref_props(
+ self,
+ **kwargs
+ ):
+ """object_model_with_ref_props # noqa: E501
+
+ Test serialization of object with $refed properties # noqa: E501
+ This method makes a synchronous HTTP request by default. To make an
+ asynchronous HTTP request, please pass async_req=True
+
+ >>> thread = api.object_model_with_ref_props(async_req=True)
+ >>> result = thread.get()
+
+
+ Keyword Args:
+ body (ObjectModelWithRefProps): Input model. [optional]
+ _return_http_data_only (bool): response data without head status
+ code and headers. Default is True.
+ _preload_content (bool): if False, the urllib3.HTTPResponse object
+ will be returned without reading/decoding response data.
+ Default is True.
+ _request_timeout (float/tuple): timeout setting for this request. If one
+ number provided, it will be total request timeout. It can also
+ be a pair (tuple) of (connection, read) timeouts.
+ Default is None.
+ _check_input_type (bool): specifies if type checking
+ should be done one the data sent to the server.
+ Default is True.
+ _check_return_type (bool): specifies if type checking
+ should be done one the data received from the server.
+ Default is True.
+ _host_index (int/None): specifies the index of the server
+ that we want to use.
+ Default is read from the configuration.
+ async_req (bool): execute request asynchronously
+
+ Returns:
+ ObjectModelWithRefProps
+ If the method is called asynchronously, returns the request
+ thread.
+ """
+ kwargs['async_req'] = kwargs.get(
+ 'async_req', False
+ )
+ kwargs['_return_http_data_only'] = kwargs.get(
+ '_return_http_data_only', True
+ )
+ kwargs['_preload_content'] = kwargs.get(
+ '_preload_content', True
+ )
+ kwargs['_request_timeout'] = kwargs.get(
+ '_request_timeout', None
+ )
+ kwargs['_check_input_type'] = kwargs.get(
+ '_check_input_type', True
+ )
+ kwargs['_check_return_type'] = kwargs.get(
+ '_check_return_type', True
+ )
+ kwargs['_host_index'] = kwargs.get('_host_index')
+ return self.call_with_http_info(**kwargs)
+
+ self.object_model_with_ref_props = _Endpoint(
+ settings={
+ 'response_type': (ObjectModelWithRefProps,),
+ 'auth': [],
+ 'endpoint_path': '/fake/refs/object_model_with_ref_props',
+ 'operation_id': 'object_model_with_ref_props',
+ 'http_method': 'POST',
+ 'servers': None,
+ },
+ params_map={
+ 'all': [
+ 'body',
+ ],
+ 'required': [],
+ 'nullable': [
+ ],
+ 'enum': [
+ ],
+ 'validation': [
+ ]
+ },
+ root_map={
+ 'validations': {
+ },
+ 'allowed_values': {
+ },
+ 'openapi_types': {
+ 'body':
+ (ObjectModelWithRefProps,),
+ },
+ 'attribute_map': {
+ },
+ 'location_map': {
+ 'body': 'body',
+ },
+ 'collection_format_map': {
+ }
+ },
+ headers_map={
+ 'accept': [
+ '*/*'
+ ],
+ 'content_type': [],
+ },
+ api_client=api_client,
+ callable=__object_model_with_ref_props
+ )
+
+ def __string(
+ self,
+ **kwargs
+ ):
+ """string # noqa: E501
+
+ Test serialization of outer string types # noqa: E501
+ This method makes a synchronous HTTP request by default. To make an
+ asynchronous HTTP request, please pass async_req=True
+
+ >>> thread = api.string(async_req=True)
+ >>> result = thread.get()
+
+
+ Keyword Args:
+ body (str): Input string as post body. [optional]
+ _return_http_data_only (bool): response data without head status
+ code and headers. Default is True.
+ _preload_content (bool): if False, the urllib3.HTTPResponse object
+ will be returned without reading/decoding response data.
+ Default is True.
+ _request_timeout (float/tuple): timeout setting for this request. If one
+ number provided, it will be total request timeout. It can also
+ be a pair (tuple) of (connection, read) timeouts.
+ Default is None.
+ _check_input_type (bool): specifies if type checking
+ should be done one the data sent to the server.
+ Default is True.
+ _check_return_type (bool): specifies if type checking
+ should be done one the data received from the server.
+ Default is True.
+ _host_index (int/None): specifies the index of the server
+ that we want to use.
+ Default is read from the configuration.
+ async_req (bool): execute request asynchronously
+
+ Returns:
+ str
+ If the method is called asynchronously, returns the request
+ thread.
+ """
+ kwargs['async_req'] = kwargs.get(
+ 'async_req', False
+ )
+ kwargs['_return_http_data_only'] = kwargs.get(
+ '_return_http_data_only', True
+ )
+ kwargs['_preload_content'] = kwargs.get(
+ '_preload_content', True
+ )
+ kwargs['_request_timeout'] = kwargs.get(
+ '_request_timeout', None
+ )
+ kwargs['_check_input_type'] = kwargs.get(
+ '_check_input_type', True
+ )
+ kwargs['_check_return_type'] = kwargs.get(
+ '_check_return_type', True
+ )
+ kwargs['_host_index'] = kwargs.get('_host_index')
+ return self.call_with_http_info(**kwargs)
+
+ self.string = _Endpoint(
+ settings={
+ 'response_type': (str,),
+ 'auth': [],
+ 'endpoint_path': '/fake/refs/string',
+ 'operation_id': 'string',
+ 'http_method': 'POST',
+ 'servers': None,
+ },
+ params_map={
+ 'all': [
+ 'body',
+ ],
+ 'required': [],
+ 'nullable': [
+ ],
+ 'enum': [
+ ],
+ 'validation': [
+ ]
+ },
+ root_map={
+ 'validations': {
+ },
+ 'allowed_values': {
+ },
+ 'openapi_types': {
+ 'body':
+ (str,),
+ },
+ 'attribute_map': {
+ },
+ 'location_map': {
+ 'body': 'body',
+ },
+ 'collection_format_map': {
+ }
+ },
+ headers_map={
+ 'accept': [
+ '*/*'
+ ],
+ 'content_type': [],
+ },
+ api_client=api_client,
+ callable=__string
+ )
+
+ def __string_enum(
+ self,
+ **kwargs
+ ):
+ """string_enum # noqa: E501
+
+ Test serialization of outer enum # noqa: E501
+ This method makes a synchronous HTTP request by default. To make an
+ asynchronous HTTP request, please pass async_req=True
+
+ >>> thread = api.string_enum(async_req=True)
+ >>> result = thread.get()
+
+
+ Keyword Args:
+ body (StringEnum): Input enum. [optional]
+ _return_http_data_only (bool): response data without head status
+ code and headers. Default is True.
+ _preload_content (bool): if False, the urllib3.HTTPResponse object
+ will be returned without reading/decoding response data.
+ Default is True.
+ _request_timeout (float/tuple): timeout setting for this request. If one
+ number provided, it will be total request timeout. It can also
+ be a pair (tuple) of (connection, read) timeouts.
+ Default is None.
+ _check_input_type (bool): specifies if type checking
+ should be done one the data sent to the server.
+ Default is True.
+ _check_return_type (bool): specifies if type checking
+ should be done one the data received from the server.
+ Default is True.
+ _host_index (int/None): specifies the index of the server
+ that we want to use.
+ Default is read from the configuration.
+ async_req (bool): execute request asynchronously
+
+ Returns:
+ StringEnum
+ If the method is called asynchronously, returns the request
+ thread.
+ """
+ kwargs['async_req'] = kwargs.get(
+ 'async_req', False
+ )
+ kwargs['_return_http_data_only'] = kwargs.get(
+ '_return_http_data_only', True
+ )
+ kwargs['_preload_content'] = kwargs.get(
+ '_preload_content', True
+ )
+ kwargs['_request_timeout'] = kwargs.get(
+ '_request_timeout', None
+ )
+ kwargs['_check_input_type'] = kwargs.get(
+ '_check_input_type', True
+ )
+ kwargs['_check_return_type'] = kwargs.get(
+ '_check_return_type', True
+ )
+ kwargs['_host_index'] = kwargs.get('_host_index')
+ return self.call_with_http_info(**kwargs)
+
+ self.string_enum = _Endpoint(
+ settings={
+ 'response_type': (StringEnum,),
+ 'auth': [],
+ 'endpoint_path': '/fake/refs/enum',
+ 'operation_id': 'string_enum',
+ 'http_method': 'POST',
+ 'servers': None,
+ },
+ params_map={
+ 'all': [
+ 'body',
+ ],
+ 'required': [],
+ 'nullable': [
+ ],
+ 'enum': [
+ ],
+ 'validation': [
+ ]
+ },
+ root_map={
+ 'validations': {
+ },
+ 'allowed_values': {
+ },
+ 'openapi_types': {
+ 'body':
+ (StringEnum,),
+ },
+ 'attribute_map': {
+ },
+ 'location_map': {
+ 'body': 'body',
+ },
+ 'collection_format_map': {
+ }
+ },
+ headers_map={
+ 'accept': [
+ '*/*'
+ ],
+ 'content_type': [],
+ },
+ api_client=api_client,
+ callable=__string_enum
+ )
+
+ def __test_body_with_file_schema(
+ self,
+ body,
+ **kwargs
+ ):
+ """test_body_with_file_schema # noqa: E501
+
+ For this test, the body for this request much reference a schema named `File`. # noqa: E501
+ This method makes a synchronous HTTP request by default. To make an
+ asynchronous HTTP request, please pass async_req=True
+
+ >>> thread = api.test_body_with_file_schema(body, async_req=True)
+ >>> result = thread.get()
+
+ Args:
+ body (FileSchemaTestClass):
+
+ Keyword Args:
+ _return_http_data_only (bool): response data without head status
+ code and headers. Default is True.
+ _preload_content (bool): if False, the urllib3.HTTPResponse object
+ will be returned without reading/decoding response data.
+ Default is True.
+ _request_timeout (float/tuple): timeout setting for this request. If one
+ number provided, it will be total request timeout. It can also
+ be a pair (tuple) of (connection, read) timeouts.
+ Default is None.
+ _check_input_type (bool): specifies if type checking
+ should be done one the data sent to the server.
+ Default is True.
+ _check_return_type (bool): specifies if type checking
+ should be done one the data received from the server.
+ Default is True.
+ _host_index (int/None): specifies the index of the server
+ that we want to use.
+ Default is read from the configuration.
+ async_req (bool): execute request asynchronously
+
+ Returns:
+ None
+ If the method is called asynchronously, returns the request
+ thread.
+ """
+ kwargs['async_req'] = kwargs.get(
+ 'async_req', False
+ )
+ kwargs['_return_http_data_only'] = kwargs.get(
+ '_return_http_data_only', True
+ )
+ kwargs['_preload_content'] = kwargs.get(
+ '_preload_content', True
+ )
+ kwargs['_request_timeout'] = kwargs.get(
+ '_request_timeout', None
+ )
+ kwargs['_check_input_type'] = kwargs.get(
+ '_check_input_type', True
+ )
+ kwargs['_check_return_type'] = kwargs.get(
+ '_check_return_type', True
+ )
+ kwargs['_host_index'] = kwargs.get('_host_index')
+ kwargs['body'] = \
+ body
+ return self.call_with_http_info(**kwargs)
+
+ self.test_body_with_file_schema = _Endpoint(
+ settings={
+ 'response_type': None,
+ 'auth': [],
+ 'endpoint_path': '/fake/body-with-file-schema',
+ 'operation_id': 'test_body_with_file_schema',
+ 'http_method': 'PUT',
+ 'servers': None,
+ },
+ params_map={
+ 'all': [
+ 'body',
+ ],
+ 'required': [
+ 'body',
+ ],
+ 'nullable': [
+ ],
+ 'enum': [
+ ],
+ 'validation': [
+ ]
+ },
+ root_map={
+ 'validations': {
+ },
+ 'allowed_values': {
+ },
+ 'openapi_types': {
+ 'body':
+ (FileSchemaTestClass,),
+ },
+ 'attribute_map': {
+ },
+ 'location_map': {
+ 'body': 'body',
+ },
+ 'collection_format_map': {
+ }
+ },
+ headers_map={
+ 'accept': [],
+ 'content_type': [
+ 'application/json'
+ ]
+ },
+ api_client=api_client,
+ callable=__test_body_with_file_schema
+ )
+
+ def __test_body_with_query_params(
+ self,
+ query,
+ body,
+ **kwargs
+ ):
+ """test_body_with_query_params # noqa: E501
+
+ This method makes a synchronous HTTP request by default. To make an
+ asynchronous HTTP request, please pass async_req=True
+
+ >>> thread = api.test_body_with_query_params(query, body, async_req=True)
+ >>> result = thread.get()
+
+ Args:
+ query (str):
+ body (User):
+
+ Keyword Args:
+ _return_http_data_only (bool): response data without head status
+ code and headers. Default is True.
+ _preload_content (bool): if False, the urllib3.HTTPResponse object
+ will be returned without reading/decoding response data.
+ Default is True.
+ _request_timeout (float/tuple): timeout setting for this request. If one
+ number provided, it will be total request timeout. It can also
+ be a pair (tuple) of (connection, read) timeouts.
+ Default is None.
+ _check_input_type (bool): specifies if type checking
+ should be done one the data sent to the server.
+ Default is True.
+ _check_return_type (bool): specifies if type checking
+ should be done one the data received from the server.
+ Default is True.
+ _host_index (int/None): specifies the index of the server
+ that we want to use.
+ Default is read from the configuration.
+ async_req (bool): execute request asynchronously
+
+ Returns:
+ None
+ If the method is called asynchronously, returns the request
+ thread.
+ """
+ kwargs['async_req'] = kwargs.get(
+ 'async_req', False
+ )
+ kwargs['_return_http_data_only'] = kwargs.get(
+ '_return_http_data_only', True
+ )
+ kwargs['_preload_content'] = kwargs.get(
+ '_preload_content', True
+ )
+ kwargs['_request_timeout'] = kwargs.get(
+ '_request_timeout', None
+ )
+ kwargs['_check_input_type'] = kwargs.get(
+ '_check_input_type', True
+ )
+ kwargs['_check_return_type'] = kwargs.get(
+ '_check_return_type', True
+ )
+ kwargs['_host_index'] = kwargs.get('_host_index')
+ kwargs['query'] = \
+ query
+ kwargs['body'] = \
+ body
+ return self.call_with_http_info(**kwargs)
+
+ self.test_body_with_query_params = _Endpoint(
+ settings={
+ 'response_type': None,
+ 'auth': [],
+ 'endpoint_path': '/fake/body-with-query-params',
+ 'operation_id': 'test_body_with_query_params',
+ 'http_method': 'PUT',
+ 'servers': None,
+ },
+ params_map={
+ 'all': [
+ 'query',
+ 'body',
+ ],
+ 'required': [
+ 'query',
+ 'body',
+ ],
+ 'nullable': [
+ ],
+ 'enum': [
+ ],
+ 'validation': [
+ ]
+ },
+ root_map={
+ 'validations': {
+ },
+ 'allowed_values': {
+ },
+ 'openapi_types': {
+ 'query':
+ (str,),
+ 'body':
+ (User,),
+ },
+ 'attribute_map': {
+ 'query': 'query',
+ },
+ 'location_map': {
+ 'query': 'query',
+ 'body': 'body',
+ },
+ 'collection_format_map': {
+ }
+ },
+ headers_map={
+ 'accept': [],
+ 'content_type': [
+ 'application/json'
+ ]
+ },
+ api_client=api_client,
+ callable=__test_body_with_query_params
+ )
+
+ def __test_client_model(
+ self,
+ body,
+ **kwargs
+ ):
+ """To test \"client\" model # noqa: E501
+
+ To test \"client\" model # noqa: E501
+ This method makes a synchronous HTTP request by default. To make an
+ asynchronous HTTP request, please pass async_req=True
+
+ >>> thread = api.test_client_model(body, async_req=True)
+ >>> result = thread.get()
+
+ Args:
+ body (Client): client model
+
+ Keyword Args:
+ _return_http_data_only (bool): response data without head status
+ code and headers. Default is True.
+ _preload_content (bool): if False, the urllib3.HTTPResponse object
+ will be returned without reading/decoding response data.
+ Default is True.
+ _request_timeout (float/tuple): timeout setting for this request. If one
+ number provided, it will be total request timeout. It can also
+ be a pair (tuple) of (connection, read) timeouts.
+ Default is None.
+ _check_input_type (bool): specifies if type checking
+ should be done one the data sent to the server.
+ Default is True.
+ _check_return_type (bool): specifies if type checking
+ should be done one the data received from the server.
+ Default is True.
+ _host_index (int/None): specifies the index of the server
+ that we want to use.
+ Default is read from the configuration.
+ async_req (bool): execute request asynchronously
+
+ Returns:
+ Client
+ If the method is called asynchronously, returns the request
+ thread.
+ """
+ kwargs['async_req'] = kwargs.get(
+ 'async_req', False
+ )
+ kwargs['_return_http_data_only'] = kwargs.get(
+ '_return_http_data_only', True
+ )
+ kwargs['_preload_content'] = kwargs.get(
+ '_preload_content', True
+ )
+ kwargs['_request_timeout'] = kwargs.get(
+ '_request_timeout', None
+ )
+ kwargs['_check_input_type'] = kwargs.get(
+ '_check_input_type', True
+ )
+ kwargs['_check_return_type'] = kwargs.get(
+ '_check_return_type', True
+ )
+ kwargs['_host_index'] = kwargs.get('_host_index')
+ kwargs['body'] = \
+ body
+ return self.call_with_http_info(**kwargs)
+
+ self.test_client_model = _Endpoint(
+ settings={
+ 'response_type': (Client,),
+ 'auth': [],
+ 'endpoint_path': '/fake',
+ 'operation_id': 'test_client_model',
+ 'http_method': 'PATCH',
+ 'servers': None,
+ },
+ params_map={
+ 'all': [
+ 'body',
+ ],
+ 'required': [
+ 'body',
+ ],
+ 'nullable': [
+ ],
+ 'enum': [
+ ],
+ 'validation': [
+ ]
+ },
+ root_map={
+ 'validations': {
+ },
+ 'allowed_values': {
+ },
+ 'openapi_types': {
+ 'body':
+ (Client,),
+ },
+ 'attribute_map': {
+ },
+ 'location_map': {
+ 'body': 'body',
+ },
+ 'collection_format_map': {
+ }
+ },
+ headers_map={
+ 'accept': [
+ 'application/json'
+ ],
+ 'content_type': [
+ 'application/json'
+ ]
+ },
+ api_client=api_client,
+ callable=__test_client_model
+ )
+
+ def __test_endpoint_enums_length_one(
+ self,
+ query_integer=3,
+ query_string="brillig",
+ path_string="hello",
+ path_integer=34,
+ header_number=1.234,
+ **kwargs
+ ):
+ """test_endpoint_enums_length_one # noqa: E501
+
+ This route has required values with enums of 1 # noqa: E501
+ This method makes a synchronous HTTP request by default. To make an
+ asynchronous HTTP request, please pass async_req=True
+
+ >>> thread = api.test_endpoint_enums_length_one(query_integer=3, query_string="brillig", path_string="hello", path_integer=34, header_number=1.234, async_req=True)
+ >>> result = thread.get()
+
+ Args:
+ query_integer (int): defaults to 3, must be one of [3]
+ query_string (str): defaults to "brillig", must be one of ["brillig"]
+ path_string (str): defaults to "hello", must be one of ["hello"]
+ path_integer (int): defaults to 34, must be one of [34]
+ header_number (float): defaults to 1.234, must be one of [1.234]
+
+ Keyword Args:
+ _return_http_data_only (bool): response data without head status
+ code and headers. Default is True.
+ _preload_content (bool): if False, the urllib3.HTTPResponse object
+ will be returned without reading/decoding response data.
+ Default is True.
+ _request_timeout (float/tuple): timeout setting for this request. If one
+ number provided, it will be total request timeout. It can also
+ be a pair (tuple) of (connection, read) timeouts.
+ Default is None.
+ _check_input_type (bool): specifies if type checking
+ should be done one the data sent to the server.
+ Default is True.
+ _check_return_type (bool): specifies if type checking
+ should be done one the data received from the server.
+ Default is True.
+ _host_index (int/None): specifies the index of the server
+ that we want to use.
+ Default is read from the configuration.
+ async_req (bool): execute request asynchronously
+
+ Returns:
+ None
+ If the method is called asynchronously, returns the request
+ thread.
+ """
+ kwargs['async_req'] = kwargs.get(
+ 'async_req', False
+ )
+ kwargs['_return_http_data_only'] = kwargs.get(
+ '_return_http_data_only', True
+ )
+ kwargs['_preload_content'] = kwargs.get(
+ '_preload_content', True
+ )
+ kwargs['_request_timeout'] = kwargs.get(
+ '_request_timeout', None
+ )
+ kwargs['_check_input_type'] = kwargs.get(
+ '_check_input_type', True
+ )
+ kwargs['_check_return_type'] = kwargs.get(
+ '_check_return_type', True
+ )
+ kwargs['_host_index'] = kwargs.get('_host_index')
+ kwargs['query_integer'] = \
+ query_integer
+ kwargs['query_string'] = \
+ query_string
+ kwargs['path_string'] = \
+ path_string
+ kwargs['path_integer'] = \
+ path_integer
+ kwargs['header_number'] = \
+ header_number
+ return self.call_with_http_info(**kwargs)
+
+ self.test_endpoint_enums_length_one = _Endpoint(
+ settings={
+ 'response_type': None,
+ 'auth': [],
+ 'endpoint_path': '/fake/enums-of-length-one/{path_string}/{path_integer}',
+ 'operation_id': 'test_endpoint_enums_length_one',
+ 'http_method': 'PUT',
+ 'servers': None,
+ },
+ params_map={
+ 'all': [
+ 'query_integer',
+ 'query_string',
+ 'path_string',
+ 'path_integer',
+ 'header_number',
+ ],
+ 'required': [
+ 'query_integer',
+ 'query_string',
+ 'path_string',
+ 'path_integer',
+ 'header_number',
+ ],
+ 'nullable': [
+ ],
+ 'enum': [
+ 'query_integer',
+ 'query_string',
+ 'path_string',
+ 'path_integer',
+ 'header_number',
+ ],
+ 'validation': [
+ ]
+ },
+ root_map={
+ 'validations': {
+ },
+ 'allowed_values': {
+ ('query_integer',): {
+
+ "3": 3
+ },
+ ('query_string',): {
+
+ "BRILLIG": "brillig"
+ },
+ ('path_string',): {
+
+ "HELLO": "hello"
+ },
+ ('path_integer',): {
+
+ "34": 34
+ },
+ ('header_number',): {
+
+ "1.234": 1.234
+ },
+ },
+ 'openapi_types': {
+ 'query_integer':
+ (int,),
+ 'query_string':
+ (str,),
+ 'path_string':
+ (str,),
+ 'path_integer':
+ (int,),
+ 'header_number':
+ (float,),
+ },
+ 'attribute_map': {
+ 'query_integer': 'query_integer',
+ 'query_string': 'query_string',
+ 'path_string': 'path_string',
+ 'path_integer': 'path_integer',
+ 'header_number': 'header_number',
+ },
+ 'location_map': {
+ 'query_integer': 'query',
+ 'query_string': 'query',
+ 'path_string': 'path',
+ 'path_integer': 'path',
+ 'header_number': 'header',
+ },
+ 'collection_format_map': {
+ }
+ },
+ headers_map={
+ 'accept': [],
+ 'content_type': [],
+ },
+ api_client=api_client,
+ callable=__test_endpoint_enums_length_one
+ )
+
+ def __test_endpoint_parameters(
+ self,
+ number,
+ double,
+ pattern_without_delimiter,
+ byte,
+ **kwargs
+ ):
+ """Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 # noqa: E501
+
+ Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 # noqa: E501
+ This method makes a synchronous HTTP request by default. To make an
+ asynchronous HTTP request, please pass async_req=True
+
+ >>> thread = api.test_endpoint_parameters(number, double, pattern_without_delimiter, byte, async_req=True)
+ >>> result = thread.get()
+
+ Args:
+ number (float): None
+ double (float): None
+ pattern_without_delimiter (str): None
+ byte (str): None
+
+ Keyword Args:
+ integer (int): None. [optional]
+ int32 (int): None. [optional]
+ int64 (int): None. [optional]
+ float (float): None. [optional]
+ string (str): None. [optional]
+ binary (file_type): None. [optional]
+ date (date): None. [optional]
+ date_time (datetime): None. [optional]
+ password (str): None. [optional]
+ param_callback (str): None. [optional]
+ _return_http_data_only (bool): response data without head status
+ code and headers. Default is True.
+ _preload_content (bool): if False, the urllib3.HTTPResponse object
+ will be returned without reading/decoding response data.
+ Default is True.
+ _request_timeout (float/tuple): timeout setting for this request. If one
+ number provided, it will be total request timeout. It can also
+ be a pair (tuple) of (connection, read) timeouts.
+ Default is None.
+ _check_input_type (bool): specifies if type checking
+ should be done one the data sent to the server.
+ Default is True.
+ _check_return_type (bool): specifies if type checking
+ should be done one the data received from the server.
+ Default is True.
+ _host_index (int/None): specifies the index of the server
+ that we want to use.
+ Default is read from the configuration.
+ async_req (bool): execute request asynchronously
+
+ Returns:
+ None
+ If the method is called asynchronously, returns the request
+ thread.
+ """
+ kwargs['async_req'] = kwargs.get(
+ 'async_req', False
+ )
+ kwargs['_return_http_data_only'] = kwargs.get(
+ '_return_http_data_only', True
+ )
+ kwargs['_preload_content'] = kwargs.get(
+ '_preload_content', True
+ )
+ kwargs['_request_timeout'] = kwargs.get(
+ '_request_timeout', None
+ )
+ kwargs['_check_input_type'] = kwargs.get(
+ '_check_input_type', True
+ )
+ kwargs['_check_return_type'] = kwargs.get(
+ '_check_return_type', True
+ )
+ kwargs['_host_index'] = kwargs.get('_host_index')
+ kwargs['number'] = \
+ number
+ kwargs['double'] = \
+ double
+ kwargs['pattern_without_delimiter'] = \
+ pattern_without_delimiter
+ kwargs['byte'] = \
+ byte
+ return self.call_with_http_info(**kwargs)
+
+ self.test_endpoint_parameters = _Endpoint(
+ settings={
+ 'response_type': None,
+ 'auth': [
+ 'http_basic_test'
+ ],
+ 'endpoint_path': '/fake',
+ 'operation_id': 'test_endpoint_parameters',
+ 'http_method': 'POST',
+ 'servers': None,
+ },
+ params_map={
+ 'all': [
+ 'number',
+ 'double',
+ 'pattern_without_delimiter',
+ 'byte',
+ 'integer',
+ 'int32',
+ 'int64',
+ 'float',
+ 'string',
+ 'binary',
+ 'date',
+ 'date_time',
+ 'password',
+ 'param_callback',
+ ],
+ 'required': [
+ 'number',
+ 'double',
+ 'pattern_without_delimiter',
+ 'byte',
+ ],
+ 'nullable': [
+ ],
+ 'enum': [
+ ],
+ 'validation': [
+ 'number',
+ 'double',
+ 'pattern_without_delimiter',
+ 'integer',
+ 'int32',
+ 'float',
+ 'string',
+ 'password',
+ ]
+ },
+ root_map={
+ 'validations': {
+ ('number',): {
+
+ 'inclusive_maximum': 543.2,
+ 'inclusive_minimum': 32.1,
+ },
+ ('double',): {
+
+ 'inclusive_maximum': 123.4,
+ 'inclusive_minimum': 67.8,
+ },
+ ('pattern_without_delimiter',): {
+
+ 'regex': {
+ 'pattern': r'^[A-Z].*', # noqa: E501
+ },
+ },
+ ('integer',): {
+
+ 'inclusive_maximum': 100,
+ 'inclusive_minimum': 10,
+ },
+ ('int32',): {
+
+ 'inclusive_maximum': 200,
+ 'inclusive_minimum': 20,
+ },
+ ('float',): {
+
+ 'inclusive_maximum': 987.6,
+ },
+ ('string',): {
+
+ 'regex': {
+ 'pattern': r'[a-z]', # noqa: E501
+ 'flags': (re.IGNORECASE)
+ },
+ },
+ ('password',): {
+ 'max_length': 64,
+ 'min_length': 10,
+ },
+ },
+ 'allowed_values': {
+ },
+ 'openapi_types': {
+ 'number':
+ (float,),
+ 'double':
+ (float,),
+ 'pattern_without_delimiter':
+ (str,),
+ 'byte':
+ (str,),
+ 'integer':
+ (int,),
+ 'int32':
+ (int,),
+ 'int64':
+ (int,),
+ 'float':
+ (float,),
+ 'string':
+ (str,),
+ 'binary':
+ (file_type,),
+ 'date':
+ (date,),
+ 'date_time':
+ (datetime,),
+ 'password':
+ (str,),
+ 'param_callback':
+ (str,),
+ },
+ 'attribute_map': {
+ 'number': 'number',
+ 'double': 'double',
+ 'pattern_without_delimiter': 'pattern_without_delimiter',
+ 'byte': 'byte',
+ 'integer': 'integer',
+ 'int32': 'int32',
+ 'int64': 'int64',
+ 'float': 'float',
+ 'string': 'string',
+ 'binary': 'binary',
+ 'date': 'date',
+ 'date_time': 'dateTime',
+ 'password': 'password',
+ 'param_callback': 'callback',
+ },
+ 'location_map': {
+ 'number': 'form',
+ 'double': 'form',
+ 'pattern_without_delimiter': 'form',
+ 'byte': 'form',
+ 'integer': 'form',
+ 'int32': 'form',
+ 'int64': 'form',
+ 'float': 'form',
+ 'string': 'form',
+ 'binary': 'form',
+ 'date': 'form',
+ 'date_time': 'form',
+ 'password': 'form',
+ 'param_callback': 'form',
+ },
+ 'collection_format_map': {
+ }
+ },
+ headers_map={
+ 'accept': [],
+ 'content_type': [
+ 'application/x-www-form-urlencoded'
+ ]
+ },
+ api_client=api_client,
+ callable=__test_endpoint_parameters
+ )
+
+ def __test_enum_parameters(
+ self,
+ **kwargs
+ ):
+ """To test enum parameters # noqa: E501
+
+ To test enum parameters # noqa: E501
+ This method makes a synchronous HTTP request by default. To make an
+ asynchronous HTTP request, please pass async_req=True
+
+ >>> thread = api.test_enum_parameters(async_req=True)
+ >>> result = thread.get()
+
+
+ Keyword Args:
+ enum_header_string_array ([str]): Header parameter enum test (string array). [optional]
+ enum_header_string (str): Header parameter enum test (string). [optional] if omitted the server will use the default value of "-efg"
+ enum_query_string_array ([str]): Query parameter enum test (string array). [optional]
+ enum_query_string (str): Query parameter enum test (string). [optional] if omitted the server will use the default value of "-efg"
+ enum_query_integer (int): Query parameter enum test (double). [optional]
+ enum_query_double (float): Query parameter enum test (double). [optional]
+ enum_form_string_array ([str]): Form parameter enum test (string array). [optional] if omitted the server will use the default value of "$"
+ enum_form_string (str): Form parameter enum test (string). [optional] if omitted the server will use the default value of "-efg"
+ _return_http_data_only (bool): response data without head status
+ code and headers. Default is True.
+ _preload_content (bool): if False, the urllib3.HTTPResponse object
+ will be returned without reading/decoding response data.
+ Default is True.
+ _request_timeout (float/tuple): timeout setting for this request. If one
+ number provided, it will be total request timeout. It can also
+ be a pair (tuple) of (connection, read) timeouts.
+ Default is None.
+ _check_input_type (bool): specifies if type checking
+ should be done one the data sent to the server.
+ Default is True.
+ _check_return_type (bool): specifies if type checking
+ should be done one the data received from the server.
+ Default is True.
+ _host_index (int/None): specifies the index of the server
+ that we want to use.
+ Default is read from the configuration.
+ async_req (bool): execute request asynchronously
+
+ Returns:
+ None
+ If the method is called asynchronously, returns the request
+ thread.
+ """
+ kwargs['async_req'] = kwargs.get(
+ 'async_req', False
+ )
+ kwargs['_return_http_data_only'] = kwargs.get(
+ '_return_http_data_only', True
+ )
+ kwargs['_preload_content'] = kwargs.get(
+ '_preload_content', True
+ )
+ kwargs['_request_timeout'] = kwargs.get(
+ '_request_timeout', None
+ )
+ kwargs['_check_input_type'] = kwargs.get(
+ '_check_input_type', True
+ )
+ kwargs['_check_return_type'] = kwargs.get(
+ '_check_return_type', True
+ )
+ kwargs['_host_index'] = kwargs.get('_host_index')
+ return self.call_with_http_info(**kwargs)
+
+ self.test_enum_parameters = _Endpoint(
+ settings={
+ 'response_type': None,
+ 'auth': [],
+ 'endpoint_path': '/fake',
+ 'operation_id': 'test_enum_parameters',
+ 'http_method': 'GET',
+ 'servers': None,
+ },
+ params_map={
+ 'all': [
+ 'enum_header_string_array',
+ 'enum_header_string',
+ 'enum_query_string_array',
+ 'enum_query_string',
+ 'enum_query_integer',
+ 'enum_query_double',
+ 'enum_form_string_array',
+ 'enum_form_string',
+ ],
+ 'required': [],
+ 'nullable': [
+ ],
+ 'enum': [
+ 'enum_header_string_array',
+ 'enum_header_string',
+ 'enum_query_string_array',
+ 'enum_query_string',
+ 'enum_query_integer',
+ 'enum_query_double',
+ 'enum_form_string_array',
+ 'enum_form_string',
+ ],
+ 'validation': [
+ ]
+ },
+ root_map={
+ 'validations': {
+ },
+ 'allowed_values': {
+ ('enum_header_string_array',): {
+
+ ">": ">",
+ "$": "$"
+ },
+ ('enum_header_string',): {
+
+ "_ABC": "_abc",
+ "-EFG": "-efg",
+ "(XYZ)": "(xyz)"
+ },
+ ('enum_query_string_array',): {
+
+ ">": ">",
+ "$": "$"
+ },
+ ('enum_query_string',): {
+
+ "_ABC": "_abc",
+ "-EFG": "-efg",
+ "(XYZ)": "(xyz)"
+ },
+ ('enum_query_integer',): {
+
+ "1": 1,
+ "-2": -2
+ },
+ ('enum_query_double',): {
+
+ "1.1": 1.1,
+ "-1.2": -1.2
+ },
+ ('enum_form_string_array',): {
+
+ ">": ">",
+ "$": "$"
+ },
+ ('enum_form_string',): {
+
+ "_ABC": "_abc",
+ "-EFG": "-efg",
+ "(XYZ)": "(xyz)"
+ },
+ },
+ 'openapi_types': {
+ 'enum_header_string_array':
+ ([str],),
+ 'enum_header_string':
+ (str,),
+ 'enum_query_string_array':
+ ([str],),
+ 'enum_query_string':
+ (str,),
+ 'enum_query_integer':
+ (int,),
+ 'enum_query_double':
+ (float,),
+ 'enum_form_string_array':
+ ([str],),
+ 'enum_form_string':
+ (str,),
+ },
+ 'attribute_map': {
+ 'enum_header_string_array': 'enum_header_string_array',
+ 'enum_header_string': 'enum_header_string',
+ 'enum_query_string_array': 'enum_query_string_array',
+ 'enum_query_string': 'enum_query_string',
+ 'enum_query_integer': 'enum_query_integer',
+ 'enum_query_double': 'enum_query_double',
+ 'enum_form_string_array': 'enum_form_string_array',
+ 'enum_form_string': 'enum_form_string',
+ },
+ 'location_map': {
+ 'enum_header_string_array': 'header',
+ 'enum_header_string': 'header',
+ 'enum_query_string_array': 'query',
+ 'enum_query_string': 'query',
+ 'enum_query_integer': 'query',
+ 'enum_query_double': 'query',
+ 'enum_form_string_array': 'form',
+ 'enum_form_string': 'form',
+ },
+ 'collection_format_map': {
+ 'enum_header_string_array': 'csv',
+ 'enum_query_string_array': 'csv',
+ 'enum_form_string_array': 'csv',
+ }
+ },
+ headers_map={
+ 'accept': [],
+ 'content_type': [
+ 'application/x-www-form-urlencoded'
+ ]
+ },
+ api_client=api_client,
+ callable=__test_enum_parameters
+ )
+
+ def __test_group_parameters(
+ self,
+ required_string_group,
+ required_boolean_group,
+ required_int64_group,
+ **kwargs
+ ):
+ """Fake endpoint to test group parameters (optional) # noqa: E501
+
+ Fake endpoint to test group parameters (optional) # noqa: E501
+ This method makes a synchronous HTTP request by default. To make an
+ asynchronous HTTP request, please pass async_req=True
+
+ >>> thread = api.test_group_parameters(required_string_group, required_boolean_group, required_int64_group, async_req=True)
+ >>> result = thread.get()
+
+ Args:
+ required_string_group (int): Required String in group parameters
+ required_boolean_group (bool): Required Boolean in group parameters
+ required_int64_group (int): Required Integer in group parameters
+
+ Keyword Args:
+ string_group (int): String in group parameters. [optional]
+ boolean_group (bool): Boolean in group parameters. [optional]
+ int64_group (int): Integer in group parameters. [optional]
+ _return_http_data_only (bool): response data without head status
+ code and headers. Default is True.
+ _preload_content (bool): if False, the urllib3.HTTPResponse object
+ will be returned without reading/decoding response data.
+ Default is True.
+ _request_timeout (float/tuple): timeout setting for this request. If one
+ number provided, it will be total request timeout. It can also
+ be a pair (tuple) of (connection, read) timeouts.
+ Default is None.
+ _check_input_type (bool): specifies if type checking
+ should be done one the data sent to the server.
+ Default is True.
+ _check_return_type (bool): specifies if type checking
+ should be done one the data received from the server.
+ Default is True.
+ _host_index (int/None): specifies the index of the server
+ that we want to use.
+ Default is read from the configuration.
+ async_req (bool): execute request asynchronously
+
+ Returns:
+ None
+ If the method is called asynchronously, returns the request
+ thread.
+ """
+ kwargs['async_req'] = kwargs.get(
+ 'async_req', False
+ )
+ kwargs['_return_http_data_only'] = kwargs.get(
+ '_return_http_data_only', True
+ )
+ kwargs['_preload_content'] = kwargs.get(
+ '_preload_content', True
+ )
+ kwargs['_request_timeout'] = kwargs.get(
+ '_request_timeout', None
+ )
+ kwargs['_check_input_type'] = kwargs.get(
+ '_check_input_type', True
+ )
+ kwargs['_check_return_type'] = kwargs.get(
+ '_check_return_type', True
+ )
+ kwargs['_host_index'] = kwargs.get('_host_index')
+ kwargs['required_string_group'] = \
+ required_string_group
+ kwargs['required_boolean_group'] = \
+ required_boolean_group
+ kwargs['required_int64_group'] = \
+ required_int64_group
+ return self.call_with_http_info(**kwargs)
+
+ self.test_group_parameters = _Endpoint(
+ settings={
+ 'response_type': None,
+ 'auth': [],
+ 'endpoint_path': '/fake',
+ 'operation_id': 'test_group_parameters',
+ 'http_method': 'DELETE',
+ 'servers': None,
+ },
+ params_map={
+ 'all': [
+ 'required_string_group',
+ 'required_boolean_group',
+ 'required_int64_group',
+ 'string_group',
+ 'boolean_group',
+ 'int64_group',
+ ],
+ 'required': [
+ 'required_string_group',
+ 'required_boolean_group',
+ 'required_int64_group',
+ ],
+ 'nullable': [
+ ],
+ 'enum': [
+ ],
+ 'validation': [
+ ]
+ },
+ root_map={
+ 'validations': {
+ },
+ 'allowed_values': {
+ },
+ 'openapi_types': {
+ 'required_string_group':
+ (int,),
+ 'required_boolean_group':
+ (bool,),
+ 'required_int64_group':
+ (int,),
+ 'string_group':
+ (int,),
+ 'boolean_group':
+ (bool,),
+ 'int64_group':
+ (int,),
+ },
+ 'attribute_map': {
+ 'required_string_group': 'required_string_group',
+ 'required_boolean_group': 'required_boolean_group',
+ 'required_int64_group': 'required_int64_group',
+ 'string_group': 'string_group',
+ 'boolean_group': 'boolean_group',
+ 'int64_group': 'int64_group',
+ },
+ 'location_map': {
+ 'required_string_group': 'query',
+ 'required_boolean_group': 'header',
+ 'required_int64_group': 'query',
+ 'string_group': 'query',
+ 'boolean_group': 'header',
+ 'int64_group': 'query',
+ },
+ 'collection_format_map': {
+ }
+ },
+ headers_map={
+ 'accept': [],
+ 'content_type': [],
+ },
+ api_client=api_client,
+ callable=__test_group_parameters
+ )
+
+ def __test_inline_additional_properties(
+ self,
+ param,
+ **kwargs
+ ):
+ """test inline additionalProperties # noqa: E501
+
+ This method makes a synchronous HTTP request by default. To make an
+ asynchronous HTTP request, please pass async_req=True
+
+ >>> thread = api.test_inline_additional_properties(param, async_req=True)
+ >>> result = thread.get()
+
+ Args:
+ param ({str: (str,)}): request body
+
+ Keyword Args:
+ _return_http_data_only (bool): response data without head status
+ code and headers. Default is True.
+ _preload_content (bool): if False, the urllib3.HTTPResponse object
+ will be returned without reading/decoding response data.
+ Default is True.
+ _request_timeout (float/tuple): timeout setting for this request. If one
+ number provided, it will be total request timeout. It can also
+ be a pair (tuple) of (connection, read) timeouts.
+ Default is None.
+ _check_input_type (bool): specifies if type checking
+ should be done one the data sent to the server.
+ Default is True.
+ _check_return_type (bool): specifies if type checking
+ should be done one the data received from the server.
+ Default is True.
+ _host_index (int/None): specifies the index of the server
+ that we want to use.
+ Default is read from the configuration.
+ async_req (bool): execute request asynchronously
+
+ Returns:
+ None
+ If the method is called asynchronously, returns the request
+ thread.
+ """
+ kwargs['async_req'] = kwargs.get(
+ 'async_req', False
+ )
+ kwargs['_return_http_data_only'] = kwargs.get(
+ '_return_http_data_only', True
+ )
+ kwargs['_preload_content'] = kwargs.get(
+ '_preload_content', True
+ )
+ kwargs['_request_timeout'] = kwargs.get(
+ '_request_timeout', None
+ )
+ kwargs['_check_input_type'] = kwargs.get(
+ '_check_input_type', True
+ )
+ kwargs['_check_return_type'] = kwargs.get(
+ '_check_return_type', True
+ )
+ kwargs['_host_index'] = kwargs.get('_host_index')
+ kwargs['param'] = \
+ param
+ return self.call_with_http_info(**kwargs)
+
+ self.test_inline_additional_properties = _Endpoint(
+ settings={
+ 'response_type': None,
+ 'auth': [],
+ 'endpoint_path': '/fake/inline-additionalProperties',
+ 'operation_id': 'test_inline_additional_properties',
+ 'http_method': 'POST',
+ 'servers': None,
+ },
+ params_map={
+ 'all': [
+ 'param',
+ ],
+ 'required': [
+ 'param',
+ ],
+ 'nullable': [
+ ],
+ 'enum': [
+ ],
+ 'validation': [
+ ]
+ },
+ root_map={
+ 'validations': {
+ },
+ 'allowed_values': {
+ },
+ 'openapi_types': {
+ 'param':
+ ({str: (str,)},),
+ },
+ 'attribute_map': {
+ },
+ 'location_map': {
+ 'param': 'body',
+ },
+ 'collection_format_map': {
+ }
+ },
+ headers_map={
+ 'accept': [],
+ 'content_type': [
+ 'application/json'
+ ]
+ },
+ api_client=api_client,
+ callable=__test_inline_additional_properties
+ )
+
+ def __test_json_form_data(
+ self,
+ param,
+ param2,
+ **kwargs
+ ):
+ """test json serialization of form data # noqa: E501
+
+ This method makes a synchronous HTTP request by default. To make an
+ asynchronous HTTP request, please pass async_req=True
+
+ >>> thread = api.test_json_form_data(param, param2, async_req=True)
+ >>> result = thread.get()
+
+ Args:
+ param (str): field1
+ param2 (str): field2
+
+ Keyword Args:
+ _return_http_data_only (bool): response data without head status
+ code and headers. Default is True.
+ _preload_content (bool): if False, the urllib3.HTTPResponse object
+ will be returned without reading/decoding response data.
+ Default is True.
+ _request_timeout (float/tuple): timeout setting for this request. If one
+ number provided, it will be total request timeout. It can also
+ be a pair (tuple) of (connection, read) timeouts.
+ Default is None.
+ _check_input_type (bool): specifies if type checking
+ should be done one the data sent to the server.
+ Default is True.
+ _check_return_type (bool): specifies if type checking
+ should be done one the data received from the server.
+ Default is True.
+ _host_index (int/None): specifies the index of the server
+ that we want to use.
+ Default is read from the configuration.
+ async_req (bool): execute request asynchronously
+
+ Returns:
+ None
+ If the method is called asynchronously, returns the request
+ thread.
+ """
+ kwargs['async_req'] = kwargs.get(
+ 'async_req', False
+ )
+ kwargs['_return_http_data_only'] = kwargs.get(
+ '_return_http_data_only', True
+ )
+ kwargs['_preload_content'] = kwargs.get(
+ '_preload_content', True
+ )
+ kwargs['_request_timeout'] = kwargs.get(
+ '_request_timeout', None
+ )
+ kwargs['_check_input_type'] = kwargs.get(
+ '_check_input_type', True
+ )
+ kwargs['_check_return_type'] = kwargs.get(
+ '_check_return_type', True
+ )
+ kwargs['_host_index'] = kwargs.get('_host_index')
+ kwargs['param'] = \
+ param
+ kwargs['param2'] = \
+ param2
+ return self.call_with_http_info(**kwargs)
+
+ self.test_json_form_data = _Endpoint(
+ settings={
+ 'response_type': None,
+ 'auth': [],
+ 'endpoint_path': '/fake/jsonFormData',
+ 'operation_id': 'test_json_form_data',
+ 'http_method': 'GET',
+ 'servers': None,
+ },
+ params_map={
+ 'all': [
+ 'param',
+ 'param2',
+ ],
+ 'required': [
+ 'param',
+ 'param2',
+ ],
+ 'nullable': [
+ ],
+ 'enum': [
+ ],
+ 'validation': [
+ ]
+ },
+ root_map={
+ 'validations': {
+ },
+ 'allowed_values': {
+ },
+ 'openapi_types': {
+ 'param':
+ (str,),
+ 'param2':
+ (str,),
+ },
+ 'attribute_map': {
+ 'param': 'param',
+ 'param2': 'param2',
+ },
+ 'location_map': {
+ 'param': 'form',
+ 'param2': 'form',
+ },
+ 'collection_format_map': {
+ }
+ },
+ headers_map={
+ 'accept': [],
+ 'content_type': [
+ 'application/x-www-form-urlencoded'
+ ]
+ },
+ api_client=api_client,
+ callable=__test_json_form_data
+ )
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/api/fake_classname_tags_123_api.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/api/fake_classname_tags_123_api.py
new file mode 100644
index 000000000000..1d1afc214c14
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/api/fake_classname_tags_123_api.py
@@ -0,0 +1,157 @@
+"""
+ 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: https://openapi-generator.tech
+"""
+
+
+import re # noqa: F401
+import sys # noqa: F401
+
+from petstore_api.api_client import ApiClient, Endpoint as _Endpoint
+from petstore_api.model_utils import ( # noqa: F401
+ check_allowed_values,
+ check_validations,
+ date,
+ datetime,
+ file_type,
+ none_type,
+ validate_and_convert_types
+)
+from petstore_api.model.client import Client
+
+
+class FakeClassnameTags123Api(object):
+ """NOTE: This class is auto generated by OpenAPI Generator
+ Ref: https://openapi-generator.tech
+
+ Do not edit the class manually.
+ """
+
+ def __init__(self, api_client=None):
+ if api_client is None:
+ api_client = ApiClient()
+ self.api_client = api_client
+
+ def __test_classname(
+ self,
+ body,
+ **kwargs
+ ):
+ """To test class name in snake case # noqa: E501
+
+ To test class name in snake case # noqa: E501
+ This method makes a synchronous HTTP request by default. To make an
+ asynchronous HTTP request, please pass async_req=True
+
+ >>> thread = api.test_classname(body, async_req=True)
+ >>> result = thread.get()
+
+ Args:
+ body (Client): client model
+
+ Keyword Args:
+ _return_http_data_only (bool): response data without head status
+ code and headers. Default is True.
+ _preload_content (bool): if False, the urllib3.HTTPResponse object
+ will be returned without reading/decoding response data.
+ Default is True.
+ _request_timeout (float/tuple): timeout setting for this request. If one
+ number provided, it will be total request timeout. It can also
+ be a pair (tuple) of (connection, read) timeouts.
+ Default is None.
+ _check_input_type (bool): specifies if type checking
+ should be done one the data sent to the server.
+ Default is True.
+ _check_return_type (bool): specifies if type checking
+ should be done one the data received from the server.
+ Default is True.
+ _host_index (int/None): specifies the index of the server
+ that we want to use.
+ Default is read from the configuration.
+ async_req (bool): execute request asynchronously
+
+ Returns:
+ Client
+ If the method is called asynchronously, returns the request
+ thread.
+ """
+ kwargs['async_req'] = kwargs.get(
+ 'async_req', False
+ )
+ kwargs['_return_http_data_only'] = kwargs.get(
+ '_return_http_data_only', True
+ )
+ kwargs['_preload_content'] = kwargs.get(
+ '_preload_content', True
+ )
+ kwargs['_request_timeout'] = kwargs.get(
+ '_request_timeout', None
+ )
+ kwargs['_check_input_type'] = kwargs.get(
+ '_check_input_type', True
+ )
+ kwargs['_check_return_type'] = kwargs.get(
+ '_check_return_type', True
+ )
+ kwargs['_host_index'] = kwargs.get('_host_index')
+ kwargs['body'] = \
+ body
+ return self.call_with_http_info(**kwargs)
+
+ self.test_classname = _Endpoint(
+ settings={
+ 'response_type': (Client,),
+ 'auth': [
+ 'api_key_query'
+ ],
+ 'endpoint_path': '/fake_classname_test',
+ 'operation_id': 'test_classname',
+ 'http_method': 'PATCH',
+ 'servers': None,
+ },
+ params_map={
+ 'all': [
+ 'body',
+ ],
+ 'required': [
+ 'body',
+ ],
+ 'nullable': [
+ ],
+ 'enum': [
+ ],
+ 'validation': [
+ ]
+ },
+ root_map={
+ 'validations': {
+ },
+ 'allowed_values': {
+ },
+ 'openapi_types': {
+ 'body':
+ (Client,),
+ },
+ 'attribute_map': {
+ },
+ 'location_map': {
+ 'body': 'body',
+ },
+ 'collection_format_map': {
+ }
+ },
+ headers_map={
+ 'accept': [
+ 'application/json'
+ ],
+ 'content_type': [
+ 'application/json'
+ ]
+ },
+ api_client=api_client,
+ callable=__test_classname
+ )
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/api/pet_api.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/api/pet_api.py
new file mode 100644
index 000000000000..2989ca8d4ab7
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/api/pet_api.py
@@ -0,0 +1,1170 @@
+"""
+ 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: https://openapi-generator.tech
+"""
+
+
+import re # noqa: F401
+import sys # noqa: F401
+
+from petstore_api.api_client import ApiClient, Endpoint as _Endpoint
+from petstore_api.model_utils import ( # noqa: F401
+ check_allowed_values,
+ check_validations,
+ date,
+ datetime,
+ file_type,
+ none_type,
+ validate_and_convert_types
+)
+from petstore_api.model.api_response import ApiResponse
+from petstore_api.model.pet import Pet
+
+
+class PetApi(object):
+ """NOTE: This class is auto generated by OpenAPI Generator
+ Ref: https://openapi-generator.tech
+
+ Do not edit the class manually.
+ """
+
+ def __init__(self, api_client=None):
+ if api_client is None:
+ api_client = ApiClient()
+ self.api_client = api_client
+
+ def __add_pet(
+ self,
+ body,
+ **kwargs
+ ):
+ """Add a new pet to the store # noqa: E501
+
+ This method makes a synchronous HTTP request by default. To make an
+ asynchronous HTTP request, please pass async_req=True
+
+ >>> thread = api.add_pet(body, async_req=True)
+ >>> result = thread.get()
+
+ Args:
+ body (Pet): Pet object that needs to be added to the store
+
+ Keyword Args:
+ _return_http_data_only (bool): response data without head status
+ code and headers. Default is True.
+ _preload_content (bool): if False, the urllib3.HTTPResponse object
+ will be returned without reading/decoding response data.
+ Default is True.
+ _request_timeout (float/tuple): timeout setting for this request. If one
+ number provided, it will be total request timeout. It can also
+ be a pair (tuple) of (connection, read) timeouts.
+ Default is None.
+ _check_input_type (bool): specifies if type checking
+ should be done one the data sent to the server.
+ Default is True.
+ _check_return_type (bool): specifies if type checking
+ should be done one the data received from the server.
+ Default is True.
+ _host_index (int/None): specifies the index of the server
+ that we want to use.
+ Default is read from the configuration.
+ async_req (bool): execute request asynchronously
+
+ Returns:
+ None
+ If the method is called asynchronously, returns the request
+ thread.
+ """
+ kwargs['async_req'] = kwargs.get(
+ 'async_req', False
+ )
+ kwargs['_return_http_data_only'] = kwargs.get(
+ '_return_http_data_only', True
+ )
+ kwargs['_preload_content'] = kwargs.get(
+ '_preload_content', True
+ )
+ kwargs['_request_timeout'] = kwargs.get(
+ '_request_timeout', None
+ )
+ kwargs['_check_input_type'] = kwargs.get(
+ '_check_input_type', True
+ )
+ kwargs['_check_return_type'] = kwargs.get(
+ '_check_return_type', True
+ )
+ kwargs['_host_index'] = kwargs.get('_host_index')
+ kwargs['body'] = \
+ body
+ return self.call_with_http_info(**kwargs)
+
+ self.add_pet = _Endpoint(
+ settings={
+ 'response_type': None,
+ 'auth': [
+ 'petstore_auth'
+ ],
+ 'endpoint_path': '/pet',
+ 'operation_id': 'add_pet',
+ 'http_method': 'POST',
+ 'servers': None,
+ },
+ params_map={
+ 'all': [
+ 'body',
+ ],
+ 'required': [
+ 'body',
+ ],
+ 'nullable': [
+ ],
+ 'enum': [
+ ],
+ 'validation': [
+ ]
+ },
+ root_map={
+ 'validations': {
+ },
+ 'allowed_values': {
+ },
+ 'openapi_types': {
+ 'body':
+ (Pet,),
+ },
+ 'attribute_map': {
+ },
+ 'location_map': {
+ 'body': 'body',
+ },
+ 'collection_format_map': {
+ }
+ },
+ headers_map={
+ 'accept': [],
+ 'content_type': [
+ 'application/json',
+ 'application/xml'
+ ]
+ },
+ api_client=api_client,
+ callable=__add_pet
+ )
+
+ def __delete_pet(
+ self,
+ pet_id,
+ **kwargs
+ ):
+ """Deletes a pet # noqa: E501
+
+ This method makes a synchronous HTTP request by default. To make an
+ asynchronous HTTP request, please pass async_req=True
+
+ >>> thread = api.delete_pet(pet_id, async_req=True)
+ >>> result = thread.get()
+
+ Args:
+ pet_id (int): Pet id to delete
+
+ Keyword Args:
+ api_key (str): [optional]
+ _return_http_data_only (bool): response data without head status
+ code and headers. Default is True.
+ _preload_content (bool): if False, the urllib3.HTTPResponse object
+ will be returned without reading/decoding response data.
+ Default is True.
+ _request_timeout (float/tuple): timeout setting for this request. If one
+ number provided, it will be total request timeout. It can also
+ be a pair (tuple) of (connection, read) timeouts.
+ Default is None.
+ _check_input_type (bool): specifies if type checking
+ should be done one the data sent to the server.
+ Default is True.
+ _check_return_type (bool): specifies if type checking
+ should be done one the data received from the server.
+ Default is True.
+ _host_index (int/None): specifies the index of the server
+ that we want to use.
+ Default is read from the configuration.
+ async_req (bool): execute request asynchronously
+
+ Returns:
+ None
+ If the method is called asynchronously, returns the request
+ thread.
+ """
+ kwargs['async_req'] = kwargs.get(
+ 'async_req', False
+ )
+ kwargs['_return_http_data_only'] = kwargs.get(
+ '_return_http_data_only', True
+ )
+ kwargs['_preload_content'] = kwargs.get(
+ '_preload_content', True
+ )
+ kwargs['_request_timeout'] = kwargs.get(
+ '_request_timeout', None
+ )
+ kwargs['_check_input_type'] = kwargs.get(
+ '_check_input_type', True
+ )
+ kwargs['_check_return_type'] = kwargs.get(
+ '_check_return_type', True
+ )
+ kwargs['_host_index'] = kwargs.get('_host_index')
+ kwargs['pet_id'] = \
+ pet_id
+ return self.call_with_http_info(**kwargs)
+
+ self.delete_pet = _Endpoint(
+ settings={
+ 'response_type': None,
+ 'auth': [
+ 'petstore_auth'
+ ],
+ 'endpoint_path': '/pet/{petId}',
+ 'operation_id': 'delete_pet',
+ 'http_method': 'DELETE',
+ 'servers': None,
+ },
+ params_map={
+ 'all': [
+ 'pet_id',
+ 'api_key',
+ ],
+ 'required': [
+ 'pet_id',
+ ],
+ 'nullable': [
+ ],
+ 'enum': [
+ ],
+ 'validation': [
+ ]
+ },
+ root_map={
+ 'validations': {
+ },
+ 'allowed_values': {
+ },
+ 'openapi_types': {
+ 'pet_id':
+ (int,),
+ 'api_key':
+ (str,),
+ },
+ 'attribute_map': {
+ 'pet_id': 'petId',
+ 'api_key': 'api_key',
+ },
+ 'location_map': {
+ 'pet_id': 'path',
+ 'api_key': 'header',
+ },
+ 'collection_format_map': {
+ }
+ },
+ headers_map={
+ 'accept': [],
+ 'content_type': [],
+ },
+ api_client=api_client,
+ callable=__delete_pet
+ )
+
+ def __find_pets_by_status(
+ self,
+ status,
+ **kwargs
+ ):
+ """Finds Pets by status # noqa: E501
+
+ Multiple status values can be provided with comma separated strings # noqa: E501
+ This method makes a synchronous HTTP request by default. To make an
+ asynchronous HTTP request, please pass async_req=True
+
+ >>> thread = api.find_pets_by_status(status, async_req=True)
+ >>> result = thread.get()
+
+ Args:
+ status ([str]): Status values that need to be considered for filter
+
+ Keyword Args:
+ _return_http_data_only (bool): response data without head status
+ code and headers. Default is True.
+ _preload_content (bool): if False, the urllib3.HTTPResponse object
+ will be returned without reading/decoding response data.
+ Default is True.
+ _request_timeout (float/tuple): timeout setting for this request. If one
+ number provided, it will be total request timeout. It can also
+ be a pair (tuple) of (connection, read) timeouts.
+ Default is None.
+ _check_input_type (bool): specifies if type checking
+ should be done one the data sent to the server.
+ Default is True.
+ _check_return_type (bool): specifies if type checking
+ should be done one the data received from the server.
+ Default is True.
+ _host_index (int/None): specifies the index of the server
+ that we want to use.
+ Default is read from the configuration.
+ async_req (bool): execute request asynchronously
+
+ Returns:
+ [Pet]
+ If the method is called asynchronously, returns the request
+ thread.
+ """
+ kwargs['async_req'] = kwargs.get(
+ 'async_req', False
+ )
+ kwargs['_return_http_data_only'] = kwargs.get(
+ '_return_http_data_only', True
+ )
+ kwargs['_preload_content'] = kwargs.get(
+ '_preload_content', True
+ )
+ kwargs['_request_timeout'] = kwargs.get(
+ '_request_timeout', None
+ )
+ kwargs['_check_input_type'] = kwargs.get(
+ '_check_input_type', True
+ )
+ kwargs['_check_return_type'] = kwargs.get(
+ '_check_return_type', True
+ )
+ kwargs['_host_index'] = kwargs.get('_host_index')
+ kwargs['status'] = \
+ status
+ return self.call_with_http_info(**kwargs)
+
+ self.find_pets_by_status = _Endpoint(
+ settings={
+ 'response_type': ([Pet],),
+ 'auth': [
+ 'petstore_auth'
+ ],
+ 'endpoint_path': '/pet/findByStatus',
+ 'operation_id': 'find_pets_by_status',
+ 'http_method': 'GET',
+ 'servers': None,
+ },
+ params_map={
+ 'all': [
+ 'status',
+ ],
+ 'required': [
+ 'status',
+ ],
+ 'nullable': [
+ ],
+ 'enum': [
+ 'status',
+ ],
+ 'validation': [
+ ]
+ },
+ root_map={
+ 'validations': {
+ },
+ 'allowed_values': {
+ ('status',): {
+
+ "AVAILABLE": "available",
+ "PENDING": "pending",
+ "SOLD": "sold"
+ },
+ },
+ 'openapi_types': {
+ 'status':
+ ([str],),
+ },
+ 'attribute_map': {
+ 'status': 'status',
+ },
+ 'location_map': {
+ 'status': 'query',
+ },
+ 'collection_format_map': {
+ 'status': 'csv',
+ }
+ },
+ headers_map={
+ 'accept': [
+ 'application/xml',
+ 'application/json'
+ ],
+ 'content_type': [],
+ },
+ api_client=api_client,
+ callable=__find_pets_by_status
+ )
+
+ def __find_pets_by_tags(
+ self,
+ tags,
+ **kwargs
+ ):
+ """Finds Pets by tags # noqa: E501
+
+ Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. # noqa: E501
+ This method makes a synchronous HTTP request by default. To make an
+ asynchronous HTTP request, please pass async_req=True
+
+ >>> thread = api.find_pets_by_tags(tags, async_req=True)
+ >>> result = thread.get()
+
+ Args:
+ tags ([str]): Tags to filter by
+
+ Keyword Args:
+ _return_http_data_only (bool): response data without head status
+ code and headers. Default is True.
+ _preload_content (bool): if False, the urllib3.HTTPResponse object
+ will be returned without reading/decoding response data.
+ Default is True.
+ _request_timeout (float/tuple): timeout setting for this request. If one
+ number provided, it will be total request timeout. It can also
+ be a pair (tuple) of (connection, read) timeouts.
+ Default is None.
+ _check_input_type (bool): specifies if type checking
+ should be done one the data sent to the server.
+ Default is True.
+ _check_return_type (bool): specifies if type checking
+ should be done one the data received from the server.
+ Default is True.
+ _host_index (int/None): specifies the index of the server
+ that we want to use.
+ Default is read from the configuration.
+ async_req (bool): execute request asynchronously
+
+ Returns:
+ [Pet]
+ If the method is called asynchronously, returns the request
+ thread.
+ """
+ kwargs['async_req'] = kwargs.get(
+ 'async_req', False
+ )
+ kwargs['_return_http_data_only'] = kwargs.get(
+ '_return_http_data_only', True
+ )
+ kwargs['_preload_content'] = kwargs.get(
+ '_preload_content', True
+ )
+ kwargs['_request_timeout'] = kwargs.get(
+ '_request_timeout', None
+ )
+ kwargs['_check_input_type'] = kwargs.get(
+ '_check_input_type', True
+ )
+ kwargs['_check_return_type'] = kwargs.get(
+ '_check_return_type', True
+ )
+ kwargs['_host_index'] = kwargs.get('_host_index')
+ kwargs['tags'] = \
+ tags
+ return self.call_with_http_info(**kwargs)
+
+ self.find_pets_by_tags = _Endpoint(
+ settings={
+ 'response_type': ([Pet],),
+ 'auth': [
+ 'petstore_auth'
+ ],
+ 'endpoint_path': '/pet/findByTags',
+ 'operation_id': 'find_pets_by_tags',
+ 'http_method': 'GET',
+ 'servers': None,
+ },
+ params_map={
+ 'all': [
+ 'tags',
+ ],
+ 'required': [
+ 'tags',
+ ],
+ 'nullable': [
+ ],
+ 'enum': [
+ ],
+ 'validation': [
+ ]
+ },
+ root_map={
+ 'validations': {
+ },
+ 'allowed_values': {
+ },
+ 'openapi_types': {
+ 'tags':
+ ([str],),
+ },
+ 'attribute_map': {
+ 'tags': 'tags',
+ },
+ 'location_map': {
+ 'tags': 'query',
+ },
+ 'collection_format_map': {
+ 'tags': 'csv',
+ }
+ },
+ headers_map={
+ 'accept': [
+ 'application/xml',
+ 'application/json'
+ ],
+ 'content_type': [],
+ },
+ api_client=api_client,
+ callable=__find_pets_by_tags
+ )
+
+ def __get_pet_by_id(
+ self,
+ pet_id,
+ **kwargs
+ ):
+ """Find pet by ID # noqa: E501
+
+ Returns a single pet # noqa: E501
+ This method makes a synchronous HTTP request by default. To make an
+ asynchronous HTTP request, please pass async_req=True
+
+ >>> thread = api.get_pet_by_id(pet_id, async_req=True)
+ >>> result = thread.get()
+
+ Args:
+ pet_id (int): ID of pet to return
+
+ Keyword Args:
+ _return_http_data_only (bool): response data without head status
+ code and headers. Default is True.
+ _preload_content (bool): if False, the urllib3.HTTPResponse object
+ will be returned without reading/decoding response data.
+ Default is True.
+ _request_timeout (float/tuple): timeout setting for this request. If one
+ number provided, it will be total request timeout. It can also
+ be a pair (tuple) of (connection, read) timeouts.
+ Default is None.
+ _check_input_type (bool): specifies if type checking
+ should be done one the data sent to the server.
+ Default is True.
+ _check_return_type (bool): specifies if type checking
+ should be done one the data received from the server.
+ Default is True.
+ _host_index (int/None): specifies the index of the server
+ that we want to use.
+ Default is read from the configuration.
+ async_req (bool): execute request asynchronously
+
+ Returns:
+ Pet
+ If the method is called asynchronously, returns the request
+ thread.
+ """
+ kwargs['async_req'] = kwargs.get(
+ 'async_req', False
+ )
+ kwargs['_return_http_data_only'] = kwargs.get(
+ '_return_http_data_only', True
+ )
+ kwargs['_preload_content'] = kwargs.get(
+ '_preload_content', True
+ )
+ kwargs['_request_timeout'] = kwargs.get(
+ '_request_timeout', None
+ )
+ kwargs['_check_input_type'] = kwargs.get(
+ '_check_input_type', True
+ )
+ kwargs['_check_return_type'] = kwargs.get(
+ '_check_return_type', True
+ )
+ kwargs['_host_index'] = kwargs.get('_host_index')
+ kwargs['pet_id'] = \
+ pet_id
+ return self.call_with_http_info(**kwargs)
+
+ self.get_pet_by_id = _Endpoint(
+ settings={
+ 'response_type': (Pet,),
+ 'auth': [
+ 'api_key'
+ ],
+ 'endpoint_path': '/pet/{petId}',
+ 'operation_id': 'get_pet_by_id',
+ 'http_method': 'GET',
+ 'servers': None,
+ },
+ params_map={
+ 'all': [
+ 'pet_id',
+ ],
+ 'required': [
+ 'pet_id',
+ ],
+ 'nullable': [
+ ],
+ 'enum': [
+ ],
+ 'validation': [
+ ]
+ },
+ root_map={
+ 'validations': {
+ },
+ 'allowed_values': {
+ },
+ 'openapi_types': {
+ 'pet_id':
+ (int,),
+ },
+ 'attribute_map': {
+ 'pet_id': 'petId',
+ },
+ 'location_map': {
+ 'pet_id': 'path',
+ },
+ 'collection_format_map': {
+ }
+ },
+ headers_map={
+ 'accept': [
+ 'application/xml',
+ 'application/json'
+ ],
+ 'content_type': [],
+ },
+ api_client=api_client,
+ callable=__get_pet_by_id
+ )
+
+ def __update_pet(
+ self,
+ body,
+ **kwargs
+ ):
+ """Update an existing pet # noqa: E501
+
+ This method makes a synchronous HTTP request by default. To make an
+ asynchronous HTTP request, please pass async_req=True
+
+ >>> thread = api.update_pet(body, async_req=True)
+ >>> result = thread.get()
+
+ Args:
+ body (Pet): Pet object that needs to be added to the store
+
+ Keyword Args:
+ _return_http_data_only (bool): response data without head status
+ code and headers. Default is True.
+ _preload_content (bool): if False, the urllib3.HTTPResponse object
+ will be returned without reading/decoding response data.
+ Default is True.
+ _request_timeout (float/tuple): timeout setting for this request. If one
+ number provided, it will be total request timeout. It can also
+ be a pair (tuple) of (connection, read) timeouts.
+ Default is None.
+ _check_input_type (bool): specifies if type checking
+ should be done one the data sent to the server.
+ Default is True.
+ _check_return_type (bool): specifies if type checking
+ should be done one the data received from the server.
+ Default is True.
+ _host_index (int/None): specifies the index of the server
+ that we want to use.
+ Default is read from the configuration.
+ async_req (bool): execute request asynchronously
+
+ Returns:
+ None
+ If the method is called asynchronously, returns the request
+ thread.
+ """
+ kwargs['async_req'] = kwargs.get(
+ 'async_req', False
+ )
+ kwargs['_return_http_data_only'] = kwargs.get(
+ '_return_http_data_only', True
+ )
+ kwargs['_preload_content'] = kwargs.get(
+ '_preload_content', True
+ )
+ kwargs['_request_timeout'] = kwargs.get(
+ '_request_timeout', None
+ )
+ kwargs['_check_input_type'] = kwargs.get(
+ '_check_input_type', True
+ )
+ kwargs['_check_return_type'] = kwargs.get(
+ '_check_return_type', True
+ )
+ kwargs['_host_index'] = kwargs.get('_host_index')
+ kwargs['body'] = \
+ body
+ return self.call_with_http_info(**kwargs)
+
+ self.update_pet = _Endpoint(
+ settings={
+ 'response_type': None,
+ 'auth': [
+ 'petstore_auth'
+ ],
+ 'endpoint_path': '/pet',
+ 'operation_id': 'update_pet',
+ 'http_method': 'PUT',
+ 'servers': None,
+ },
+ params_map={
+ 'all': [
+ 'body',
+ ],
+ 'required': [
+ 'body',
+ ],
+ 'nullable': [
+ ],
+ 'enum': [
+ ],
+ 'validation': [
+ ]
+ },
+ root_map={
+ 'validations': {
+ },
+ 'allowed_values': {
+ },
+ 'openapi_types': {
+ 'body':
+ (Pet,),
+ },
+ 'attribute_map': {
+ },
+ 'location_map': {
+ 'body': 'body',
+ },
+ 'collection_format_map': {
+ }
+ },
+ headers_map={
+ 'accept': [],
+ 'content_type': [
+ 'application/json',
+ 'application/xml'
+ ]
+ },
+ api_client=api_client,
+ callable=__update_pet
+ )
+
+ def __update_pet_with_form(
+ self,
+ pet_id,
+ **kwargs
+ ):
+ """Updates a pet in the store with form data # noqa: E501
+
+ This method makes a synchronous HTTP request by default. To make an
+ asynchronous HTTP request, please pass async_req=True
+
+ >>> thread = api.update_pet_with_form(pet_id, async_req=True)
+ >>> result = thread.get()
+
+ Args:
+ pet_id (int): ID of pet that needs to be updated
+
+ Keyword Args:
+ name (str): Updated name of the pet. [optional]
+ status (str): Updated status of the pet. [optional]
+ _return_http_data_only (bool): response data without head status
+ code and headers. Default is True.
+ _preload_content (bool): if False, the urllib3.HTTPResponse object
+ will be returned without reading/decoding response data.
+ Default is True.
+ _request_timeout (float/tuple): timeout setting for this request. If one
+ number provided, it will be total request timeout. It can also
+ be a pair (tuple) of (connection, read) timeouts.
+ Default is None.
+ _check_input_type (bool): specifies if type checking
+ should be done one the data sent to the server.
+ Default is True.
+ _check_return_type (bool): specifies if type checking
+ should be done one the data received from the server.
+ Default is True.
+ _host_index (int/None): specifies the index of the server
+ that we want to use.
+ Default is read from the configuration.
+ async_req (bool): execute request asynchronously
+
+ Returns:
+ None
+ If the method is called asynchronously, returns the request
+ thread.
+ """
+ kwargs['async_req'] = kwargs.get(
+ 'async_req', False
+ )
+ kwargs['_return_http_data_only'] = kwargs.get(
+ '_return_http_data_only', True
+ )
+ kwargs['_preload_content'] = kwargs.get(
+ '_preload_content', True
+ )
+ kwargs['_request_timeout'] = kwargs.get(
+ '_request_timeout', None
+ )
+ kwargs['_check_input_type'] = kwargs.get(
+ '_check_input_type', True
+ )
+ kwargs['_check_return_type'] = kwargs.get(
+ '_check_return_type', True
+ )
+ kwargs['_host_index'] = kwargs.get('_host_index')
+ kwargs['pet_id'] = \
+ pet_id
+ return self.call_with_http_info(**kwargs)
+
+ self.update_pet_with_form = _Endpoint(
+ settings={
+ 'response_type': None,
+ 'auth': [
+ 'petstore_auth'
+ ],
+ 'endpoint_path': '/pet/{petId}',
+ 'operation_id': 'update_pet_with_form',
+ 'http_method': 'POST',
+ 'servers': None,
+ },
+ params_map={
+ 'all': [
+ 'pet_id',
+ 'name',
+ 'status',
+ ],
+ 'required': [
+ 'pet_id',
+ ],
+ 'nullable': [
+ ],
+ 'enum': [
+ ],
+ 'validation': [
+ ]
+ },
+ root_map={
+ 'validations': {
+ },
+ 'allowed_values': {
+ },
+ 'openapi_types': {
+ 'pet_id':
+ (int,),
+ 'name':
+ (str,),
+ 'status':
+ (str,),
+ },
+ 'attribute_map': {
+ 'pet_id': 'petId',
+ 'name': 'name',
+ 'status': 'status',
+ },
+ 'location_map': {
+ 'pet_id': 'path',
+ 'name': 'form',
+ 'status': 'form',
+ },
+ 'collection_format_map': {
+ }
+ },
+ headers_map={
+ 'accept': [],
+ 'content_type': [
+ 'application/x-www-form-urlencoded'
+ ]
+ },
+ api_client=api_client,
+ callable=__update_pet_with_form
+ )
+
+ def __upload_file(
+ self,
+ pet_id,
+ **kwargs
+ ):
+ """uploads an image # noqa: E501
+
+ This method makes a synchronous HTTP request by default. To make an
+ asynchronous HTTP request, please pass async_req=True
+
+ >>> thread = api.upload_file(pet_id, async_req=True)
+ >>> result = thread.get()
+
+ Args:
+ pet_id (int): ID of pet to update
+
+ Keyword Args:
+ additional_metadata (str): Additional data to pass to server. [optional]
+ file (file_type): file to upload. [optional]
+ files ([file_type]): files to upload. [optional]
+ _return_http_data_only (bool): response data without head status
+ code and headers. Default is True.
+ _preload_content (bool): if False, the urllib3.HTTPResponse object
+ will be returned without reading/decoding response data.
+ Default is True.
+ _request_timeout (float/tuple): timeout setting for this request. If one
+ number provided, it will be total request timeout. It can also
+ be a pair (tuple) of (connection, read) timeouts.
+ Default is None.
+ _check_input_type (bool): specifies if type checking
+ should be done one the data sent to the server.
+ Default is True.
+ _check_return_type (bool): specifies if type checking
+ should be done one the data received from the server.
+ Default is True.
+ _host_index (int/None): specifies the index of the server
+ that we want to use.
+ Default is read from the configuration.
+ async_req (bool): execute request asynchronously
+
+ Returns:
+ ApiResponse
+ If the method is called asynchronously, returns the request
+ thread.
+ """
+ kwargs['async_req'] = kwargs.get(
+ 'async_req', False
+ )
+ kwargs['_return_http_data_only'] = kwargs.get(
+ '_return_http_data_only', True
+ )
+ kwargs['_preload_content'] = kwargs.get(
+ '_preload_content', True
+ )
+ kwargs['_request_timeout'] = kwargs.get(
+ '_request_timeout', None
+ )
+ kwargs['_check_input_type'] = kwargs.get(
+ '_check_input_type', True
+ )
+ kwargs['_check_return_type'] = kwargs.get(
+ '_check_return_type', True
+ )
+ kwargs['_host_index'] = kwargs.get('_host_index')
+ kwargs['pet_id'] = \
+ pet_id
+ return self.call_with_http_info(**kwargs)
+
+ self.upload_file = _Endpoint(
+ settings={
+ 'response_type': (ApiResponse,),
+ 'auth': [
+ 'petstore_auth'
+ ],
+ 'endpoint_path': '/pet/{petId}/uploadImage',
+ 'operation_id': 'upload_file',
+ 'http_method': 'POST',
+ 'servers': None,
+ },
+ params_map={
+ 'all': [
+ 'pet_id',
+ 'additional_metadata',
+ 'file',
+ 'files',
+ ],
+ 'required': [
+ 'pet_id',
+ ],
+ 'nullable': [
+ ],
+ 'enum': [
+ ],
+ 'validation': [
+ ]
+ },
+ root_map={
+ 'validations': {
+ },
+ 'allowed_values': {
+ },
+ 'openapi_types': {
+ 'pet_id':
+ (int,),
+ 'additional_metadata':
+ (str,),
+ 'file':
+ (file_type,),
+ 'files':
+ ([file_type],),
+ },
+ 'attribute_map': {
+ 'pet_id': 'petId',
+ 'additional_metadata': 'additionalMetadata',
+ 'file': 'file',
+ 'files': 'files',
+ },
+ 'location_map': {
+ 'pet_id': 'path',
+ 'additional_metadata': 'form',
+ 'file': 'form',
+ 'files': 'form',
+ },
+ 'collection_format_map': {
+ 'files': 'csv',
+ }
+ },
+ headers_map={
+ 'accept': [
+ 'application/json'
+ ],
+ 'content_type': [
+ 'multipart/form-data'
+ ]
+ },
+ api_client=api_client,
+ callable=__upload_file
+ )
+
+ def __upload_file_with_required_file(
+ self,
+ pet_id,
+ required_file,
+ **kwargs
+ ):
+ """uploads an image (required) # noqa: E501
+
+ This method makes a synchronous HTTP request by default. To make an
+ asynchronous HTTP request, please pass async_req=True
+
+ >>> thread = api.upload_file_with_required_file(pet_id, required_file, async_req=True)
+ >>> result = thread.get()
+
+ Args:
+ pet_id (int): ID of pet to update
+ required_file (file_type): file to upload
+
+ Keyword Args:
+ additional_metadata (str): Additional data to pass to server. [optional]
+ _return_http_data_only (bool): response data without head status
+ code and headers. Default is True.
+ _preload_content (bool): if False, the urllib3.HTTPResponse object
+ will be returned without reading/decoding response data.
+ Default is True.
+ _request_timeout (float/tuple): timeout setting for this request. If one
+ number provided, it will be total request timeout. It can also
+ be a pair (tuple) of (connection, read) timeouts.
+ Default is None.
+ _check_input_type (bool): specifies if type checking
+ should be done one the data sent to the server.
+ Default is True.
+ _check_return_type (bool): specifies if type checking
+ should be done one the data received from the server.
+ Default is True.
+ _host_index (int/None): specifies the index of the server
+ that we want to use.
+ Default is read from the configuration.
+ async_req (bool): execute request asynchronously
+
+ Returns:
+ ApiResponse
+ If the method is called asynchronously, returns the request
+ thread.
+ """
+ kwargs['async_req'] = kwargs.get(
+ 'async_req', False
+ )
+ kwargs['_return_http_data_only'] = kwargs.get(
+ '_return_http_data_only', True
+ )
+ kwargs['_preload_content'] = kwargs.get(
+ '_preload_content', True
+ )
+ kwargs['_request_timeout'] = kwargs.get(
+ '_request_timeout', None
+ )
+ kwargs['_check_input_type'] = kwargs.get(
+ '_check_input_type', True
+ )
+ kwargs['_check_return_type'] = kwargs.get(
+ '_check_return_type', True
+ )
+ kwargs['_host_index'] = kwargs.get('_host_index')
+ kwargs['pet_id'] = \
+ pet_id
+ kwargs['required_file'] = \
+ required_file
+ return self.call_with_http_info(**kwargs)
+
+ self.upload_file_with_required_file = _Endpoint(
+ settings={
+ 'response_type': (ApiResponse,),
+ 'auth': [
+ 'petstore_auth'
+ ],
+ 'endpoint_path': '/fake/{petId}/uploadImageWithRequiredFile',
+ 'operation_id': 'upload_file_with_required_file',
+ 'http_method': 'POST',
+ 'servers': None,
+ },
+ params_map={
+ 'all': [
+ 'pet_id',
+ 'required_file',
+ 'additional_metadata',
+ ],
+ 'required': [
+ 'pet_id',
+ 'required_file',
+ ],
+ 'nullable': [
+ ],
+ 'enum': [
+ ],
+ 'validation': [
+ ]
+ },
+ root_map={
+ 'validations': {
+ },
+ 'allowed_values': {
+ },
+ 'openapi_types': {
+ 'pet_id':
+ (int,),
+ 'required_file':
+ (file_type,),
+ 'additional_metadata':
+ (str,),
+ },
+ 'attribute_map': {
+ 'pet_id': 'petId',
+ 'required_file': 'requiredFile',
+ 'additional_metadata': 'additionalMetadata',
+ },
+ 'location_map': {
+ 'pet_id': 'path',
+ 'required_file': 'form',
+ 'additional_metadata': 'form',
+ },
+ 'collection_format_map': {
+ }
+ },
+ headers_map={
+ 'accept': [
+ 'application/json'
+ ],
+ 'content_type': [
+ 'multipart/form-data'
+ ]
+ },
+ api_client=api_client,
+ callable=__upload_file_with_required_file
+ )
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/api/store_api.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/api/store_api.py
new file mode 100644
index 000000000000..c30ca943b2dc
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/api/store_api.py
@@ -0,0 +1,499 @@
+"""
+ 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: https://openapi-generator.tech
+"""
+
+
+import re # noqa: F401
+import sys # noqa: F401
+
+from petstore_api.api_client import ApiClient, Endpoint as _Endpoint
+from petstore_api.model_utils import ( # noqa: F401
+ check_allowed_values,
+ check_validations,
+ date,
+ datetime,
+ file_type,
+ none_type,
+ validate_and_convert_types
+)
+from petstore_api.model.order import Order
+
+
+class StoreApi(object):
+ """NOTE: This class is auto generated by OpenAPI Generator
+ Ref: https://openapi-generator.tech
+
+ Do not edit the class manually.
+ """
+
+ def __init__(self, api_client=None):
+ if api_client is None:
+ api_client = ApiClient()
+ self.api_client = api_client
+
+ def __delete_order(
+ self,
+ order_id,
+ **kwargs
+ ):
+ """Delete purchase order by ID # noqa: E501
+
+ For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors # noqa: E501
+ This method makes a synchronous HTTP request by default. To make an
+ asynchronous HTTP request, please pass async_req=True
+
+ >>> thread = api.delete_order(order_id, async_req=True)
+ >>> result = thread.get()
+
+ Args:
+ order_id (str): ID of the order that needs to be deleted
+
+ Keyword Args:
+ _return_http_data_only (bool): response data without head status
+ code and headers. Default is True.
+ _preload_content (bool): if False, the urllib3.HTTPResponse object
+ will be returned without reading/decoding response data.
+ Default is True.
+ _request_timeout (float/tuple): timeout setting for this request. If one
+ number provided, it will be total request timeout. It can also
+ be a pair (tuple) of (connection, read) timeouts.
+ Default is None.
+ _check_input_type (bool): specifies if type checking
+ should be done one the data sent to the server.
+ Default is True.
+ _check_return_type (bool): specifies if type checking
+ should be done one the data received from the server.
+ Default is True.
+ _host_index (int/None): specifies the index of the server
+ that we want to use.
+ Default is read from the configuration.
+ async_req (bool): execute request asynchronously
+
+ Returns:
+ None
+ If the method is called asynchronously, returns the request
+ thread.
+ """
+ kwargs['async_req'] = kwargs.get(
+ 'async_req', False
+ )
+ kwargs['_return_http_data_only'] = kwargs.get(
+ '_return_http_data_only', True
+ )
+ kwargs['_preload_content'] = kwargs.get(
+ '_preload_content', True
+ )
+ kwargs['_request_timeout'] = kwargs.get(
+ '_request_timeout', None
+ )
+ kwargs['_check_input_type'] = kwargs.get(
+ '_check_input_type', True
+ )
+ kwargs['_check_return_type'] = kwargs.get(
+ '_check_return_type', True
+ )
+ kwargs['_host_index'] = kwargs.get('_host_index')
+ kwargs['order_id'] = \
+ order_id
+ return self.call_with_http_info(**kwargs)
+
+ self.delete_order = _Endpoint(
+ settings={
+ 'response_type': None,
+ 'auth': [],
+ 'endpoint_path': '/store/order/{order_id}',
+ 'operation_id': 'delete_order',
+ 'http_method': 'DELETE',
+ 'servers': None,
+ },
+ params_map={
+ 'all': [
+ 'order_id',
+ ],
+ 'required': [
+ 'order_id',
+ ],
+ 'nullable': [
+ ],
+ 'enum': [
+ ],
+ 'validation': [
+ ]
+ },
+ root_map={
+ 'validations': {
+ },
+ 'allowed_values': {
+ },
+ 'openapi_types': {
+ 'order_id':
+ (str,),
+ },
+ 'attribute_map': {
+ 'order_id': 'order_id',
+ },
+ 'location_map': {
+ 'order_id': 'path',
+ },
+ 'collection_format_map': {
+ }
+ },
+ headers_map={
+ 'accept': [],
+ 'content_type': [],
+ },
+ api_client=api_client,
+ callable=__delete_order
+ )
+
+ def __get_inventory(
+ self,
+ **kwargs
+ ):
+ """Returns pet inventories by status # noqa: E501
+
+ Returns a map of status codes to quantities # noqa: E501
+ This method makes a synchronous HTTP request by default. To make an
+ asynchronous HTTP request, please pass async_req=True
+
+ >>> thread = api.get_inventory(async_req=True)
+ >>> result = thread.get()
+
+
+ Keyword Args:
+ _return_http_data_only (bool): response data without head status
+ code and headers. Default is True.
+ _preload_content (bool): if False, the urllib3.HTTPResponse object
+ will be returned without reading/decoding response data.
+ Default is True.
+ _request_timeout (float/tuple): timeout setting for this request. If one
+ number provided, it will be total request timeout. It can also
+ be a pair (tuple) of (connection, read) timeouts.
+ Default is None.
+ _check_input_type (bool): specifies if type checking
+ should be done one the data sent to the server.
+ Default is True.
+ _check_return_type (bool): specifies if type checking
+ should be done one the data received from the server.
+ Default is True.
+ _host_index (int/None): specifies the index of the server
+ that we want to use.
+ Default is read from the configuration.
+ async_req (bool): execute request asynchronously
+
+ Returns:
+ {str: (int,)}
+ If the method is called asynchronously, returns the request
+ thread.
+ """
+ kwargs['async_req'] = kwargs.get(
+ 'async_req', False
+ )
+ kwargs['_return_http_data_only'] = kwargs.get(
+ '_return_http_data_only', True
+ )
+ kwargs['_preload_content'] = kwargs.get(
+ '_preload_content', True
+ )
+ kwargs['_request_timeout'] = kwargs.get(
+ '_request_timeout', None
+ )
+ kwargs['_check_input_type'] = kwargs.get(
+ '_check_input_type', True
+ )
+ kwargs['_check_return_type'] = kwargs.get(
+ '_check_return_type', True
+ )
+ kwargs['_host_index'] = kwargs.get('_host_index')
+ return self.call_with_http_info(**kwargs)
+
+ self.get_inventory = _Endpoint(
+ settings={
+ 'response_type': ({str: (int,)},),
+ 'auth': [
+ 'api_key'
+ ],
+ 'endpoint_path': '/store/inventory',
+ 'operation_id': 'get_inventory',
+ 'http_method': 'GET',
+ 'servers': None,
+ },
+ params_map={
+ 'all': [
+ ],
+ 'required': [],
+ 'nullable': [
+ ],
+ 'enum': [
+ ],
+ 'validation': [
+ ]
+ },
+ root_map={
+ 'validations': {
+ },
+ 'allowed_values': {
+ },
+ 'openapi_types': {
+ },
+ 'attribute_map': {
+ },
+ 'location_map': {
+ },
+ 'collection_format_map': {
+ }
+ },
+ headers_map={
+ 'accept': [
+ 'application/json'
+ ],
+ 'content_type': [],
+ },
+ api_client=api_client,
+ callable=__get_inventory
+ )
+
+ def __get_order_by_id(
+ self,
+ order_id,
+ **kwargs
+ ):
+ """Find purchase order by ID # noqa: E501
+
+ For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions # noqa: E501
+ This method makes a synchronous HTTP request by default. To make an
+ asynchronous HTTP request, please pass async_req=True
+
+ >>> thread = api.get_order_by_id(order_id, async_req=True)
+ >>> result = thread.get()
+
+ Args:
+ order_id (int): ID of pet that needs to be fetched
+
+ Keyword Args:
+ _return_http_data_only (bool): response data without head status
+ code and headers. Default is True.
+ _preload_content (bool): if False, the urllib3.HTTPResponse object
+ will be returned without reading/decoding response data.
+ Default is True.
+ _request_timeout (float/tuple): timeout setting for this request. If one
+ number provided, it will be total request timeout. It can also
+ be a pair (tuple) of (connection, read) timeouts.
+ Default is None.
+ _check_input_type (bool): specifies if type checking
+ should be done one the data sent to the server.
+ Default is True.
+ _check_return_type (bool): specifies if type checking
+ should be done one the data received from the server.
+ Default is True.
+ _host_index (int/None): specifies the index of the server
+ that we want to use.
+ Default is read from the configuration.
+ async_req (bool): execute request asynchronously
+
+ Returns:
+ Order
+ If the method is called asynchronously, returns the request
+ thread.
+ """
+ kwargs['async_req'] = kwargs.get(
+ 'async_req', False
+ )
+ kwargs['_return_http_data_only'] = kwargs.get(
+ '_return_http_data_only', True
+ )
+ kwargs['_preload_content'] = kwargs.get(
+ '_preload_content', True
+ )
+ kwargs['_request_timeout'] = kwargs.get(
+ '_request_timeout', None
+ )
+ kwargs['_check_input_type'] = kwargs.get(
+ '_check_input_type', True
+ )
+ kwargs['_check_return_type'] = kwargs.get(
+ '_check_return_type', True
+ )
+ kwargs['_host_index'] = kwargs.get('_host_index')
+ kwargs['order_id'] = \
+ order_id
+ return self.call_with_http_info(**kwargs)
+
+ self.get_order_by_id = _Endpoint(
+ settings={
+ 'response_type': (Order,),
+ 'auth': [],
+ 'endpoint_path': '/store/order/{order_id}',
+ 'operation_id': 'get_order_by_id',
+ 'http_method': 'GET',
+ 'servers': None,
+ },
+ params_map={
+ 'all': [
+ 'order_id',
+ ],
+ 'required': [
+ 'order_id',
+ ],
+ 'nullable': [
+ ],
+ 'enum': [
+ ],
+ 'validation': [
+ 'order_id',
+ ]
+ },
+ root_map={
+ 'validations': {
+ ('order_id',): {
+
+ 'inclusive_maximum': 5,
+ 'inclusive_minimum': 1,
+ },
+ },
+ 'allowed_values': {
+ },
+ 'openapi_types': {
+ 'order_id':
+ (int,),
+ },
+ 'attribute_map': {
+ 'order_id': 'order_id',
+ },
+ 'location_map': {
+ 'order_id': 'path',
+ },
+ 'collection_format_map': {
+ }
+ },
+ headers_map={
+ 'accept': [
+ 'application/xml',
+ 'application/json'
+ ],
+ 'content_type': [],
+ },
+ api_client=api_client,
+ callable=__get_order_by_id
+ )
+
+ def __place_order(
+ self,
+ body,
+ **kwargs
+ ):
+ """Place an order for a pet # noqa: E501
+
+ This method makes a synchronous HTTP request by default. To make an
+ asynchronous HTTP request, please pass async_req=True
+
+ >>> thread = api.place_order(body, async_req=True)
+ >>> result = thread.get()
+
+ Args:
+ body (Order): order placed for purchasing the pet
+
+ Keyword Args:
+ _return_http_data_only (bool): response data without head status
+ code and headers. Default is True.
+ _preload_content (bool): if False, the urllib3.HTTPResponse object
+ will be returned without reading/decoding response data.
+ Default is True.
+ _request_timeout (float/tuple): timeout setting for this request. If one
+ number provided, it will be total request timeout. It can also
+ be a pair (tuple) of (connection, read) timeouts.
+ Default is None.
+ _check_input_type (bool): specifies if type checking
+ should be done one the data sent to the server.
+ Default is True.
+ _check_return_type (bool): specifies if type checking
+ should be done one the data received from the server.
+ Default is True.
+ _host_index (int/None): specifies the index of the server
+ that we want to use.
+ Default is read from the configuration.
+ async_req (bool): execute request asynchronously
+
+ Returns:
+ Order
+ If the method is called asynchronously, returns the request
+ thread.
+ """
+ kwargs['async_req'] = kwargs.get(
+ 'async_req', False
+ )
+ kwargs['_return_http_data_only'] = kwargs.get(
+ '_return_http_data_only', True
+ )
+ kwargs['_preload_content'] = kwargs.get(
+ '_preload_content', True
+ )
+ kwargs['_request_timeout'] = kwargs.get(
+ '_request_timeout', None
+ )
+ kwargs['_check_input_type'] = kwargs.get(
+ '_check_input_type', True
+ )
+ kwargs['_check_return_type'] = kwargs.get(
+ '_check_return_type', True
+ )
+ kwargs['_host_index'] = kwargs.get('_host_index')
+ kwargs['body'] = \
+ body
+ return self.call_with_http_info(**kwargs)
+
+ self.place_order = _Endpoint(
+ settings={
+ 'response_type': (Order,),
+ 'auth': [],
+ 'endpoint_path': '/store/order',
+ 'operation_id': 'place_order',
+ 'http_method': 'POST',
+ 'servers': None,
+ },
+ params_map={
+ 'all': [
+ 'body',
+ ],
+ 'required': [
+ 'body',
+ ],
+ 'nullable': [
+ ],
+ 'enum': [
+ ],
+ 'validation': [
+ ]
+ },
+ root_map={
+ 'validations': {
+ },
+ 'allowed_values': {
+ },
+ 'openapi_types': {
+ 'body':
+ (Order,),
+ },
+ 'attribute_map': {
+ },
+ 'location_map': {
+ 'body': 'body',
+ },
+ 'collection_format_map': {
+ }
+ },
+ headers_map={
+ 'accept': [
+ 'application/xml',
+ 'application/json'
+ ],
+ 'content_type': [],
+ },
+ api_client=api_client,
+ callable=__place_order
+ )
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/api/user_api.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/api/user_api.py
new file mode 100644
index 000000000000..a5ef0d5c3092
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/api/user_api.py
@@ -0,0 +1,962 @@
+"""
+ 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: https://openapi-generator.tech
+"""
+
+
+import re # noqa: F401
+import sys # noqa: F401
+
+from petstore_api.api_client import ApiClient, Endpoint as _Endpoint
+from petstore_api.model_utils import ( # noqa: F401
+ check_allowed_values,
+ check_validations,
+ date,
+ datetime,
+ file_type,
+ none_type,
+ validate_and_convert_types
+)
+from petstore_api.model.user import User
+
+
+class UserApi(object):
+ """NOTE: This class is auto generated by OpenAPI Generator
+ Ref: https://openapi-generator.tech
+
+ Do not edit the class manually.
+ """
+
+ def __init__(self, api_client=None):
+ if api_client is None:
+ api_client = ApiClient()
+ self.api_client = api_client
+
+ def __create_user(
+ self,
+ body,
+ **kwargs
+ ):
+ """Create user # noqa: E501
+
+ This can only be done by the logged in user. # noqa: E501
+ This method makes a synchronous HTTP request by default. To make an
+ asynchronous HTTP request, please pass async_req=True
+
+ >>> thread = api.create_user(body, async_req=True)
+ >>> result = thread.get()
+
+ Args:
+ body (User): Created user object
+
+ Keyword Args:
+ _return_http_data_only (bool): response data without head status
+ code and headers. Default is True.
+ _preload_content (bool): if False, the urllib3.HTTPResponse object
+ will be returned without reading/decoding response data.
+ Default is True.
+ _request_timeout (float/tuple): timeout setting for this request. If one
+ number provided, it will be total request timeout. It can also
+ be a pair (tuple) of (connection, read) timeouts.
+ Default is None.
+ _check_input_type (bool): specifies if type checking
+ should be done one the data sent to the server.
+ Default is True.
+ _check_return_type (bool): specifies if type checking
+ should be done one the data received from the server.
+ Default is True.
+ _host_index (int/None): specifies the index of the server
+ that we want to use.
+ Default is read from the configuration.
+ async_req (bool): execute request asynchronously
+
+ Returns:
+ None
+ If the method is called asynchronously, returns the request
+ thread.
+ """
+ kwargs['async_req'] = kwargs.get(
+ 'async_req', False
+ )
+ kwargs['_return_http_data_only'] = kwargs.get(
+ '_return_http_data_only', True
+ )
+ kwargs['_preload_content'] = kwargs.get(
+ '_preload_content', True
+ )
+ kwargs['_request_timeout'] = kwargs.get(
+ '_request_timeout', None
+ )
+ kwargs['_check_input_type'] = kwargs.get(
+ '_check_input_type', True
+ )
+ kwargs['_check_return_type'] = kwargs.get(
+ '_check_return_type', True
+ )
+ kwargs['_host_index'] = kwargs.get('_host_index')
+ kwargs['body'] = \
+ body
+ return self.call_with_http_info(**kwargs)
+
+ self.create_user = _Endpoint(
+ settings={
+ 'response_type': None,
+ 'auth': [],
+ 'endpoint_path': '/user',
+ 'operation_id': 'create_user',
+ 'http_method': 'POST',
+ 'servers': None,
+ },
+ params_map={
+ 'all': [
+ 'body',
+ ],
+ 'required': [
+ 'body',
+ ],
+ 'nullable': [
+ ],
+ 'enum': [
+ ],
+ 'validation': [
+ ]
+ },
+ root_map={
+ 'validations': {
+ },
+ 'allowed_values': {
+ },
+ 'openapi_types': {
+ 'body':
+ (User,),
+ },
+ 'attribute_map': {
+ },
+ 'location_map': {
+ 'body': 'body',
+ },
+ 'collection_format_map': {
+ }
+ },
+ headers_map={
+ 'accept': [],
+ 'content_type': [],
+ },
+ api_client=api_client,
+ callable=__create_user
+ )
+
+ def __create_users_with_array_input(
+ self,
+ body,
+ **kwargs
+ ):
+ """Creates list of users with given input array # noqa: E501
+
+ This method makes a synchronous HTTP request by default. To make an
+ asynchronous HTTP request, please pass async_req=True
+
+ >>> thread = api.create_users_with_array_input(body, async_req=True)
+ >>> result = thread.get()
+
+ Args:
+ body ([User]): List of user object
+
+ Keyword Args:
+ _return_http_data_only (bool): response data without head status
+ code and headers. Default is True.
+ _preload_content (bool): if False, the urllib3.HTTPResponse object
+ will be returned without reading/decoding response data.
+ Default is True.
+ _request_timeout (float/tuple): timeout setting for this request. If one
+ number provided, it will be total request timeout. It can also
+ be a pair (tuple) of (connection, read) timeouts.
+ Default is None.
+ _check_input_type (bool): specifies if type checking
+ should be done one the data sent to the server.
+ Default is True.
+ _check_return_type (bool): specifies if type checking
+ should be done one the data received from the server.
+ Default is True.
+ _host_index (int/None): specifies the index of the server
+ that we want to use.
+ Default is read from the configuration.
+ async_req (bool): execute request asynchronously
+
+ Returns:
+ None
+ If the method is called asynchronously, returns the request
+ thread.
+ """
+ kwargs['async_req'] = kwargs.get(
+ 'async_req', False
+ )
+ kwargs['_return_http_data_only'] = kwargs.get(
+ '_return_http_data_only', True
+ )
+ kwargs['_preload_content'] = kwargs.get(
+ '_preload_content', True
+ )
+ kwargs['_request_timeout'] = kwargs.get(
+ '_request_timeout', None
+ )
+ kwargs['_check_input_type'] = kwargs.get(
+ '_check_input_type', True
+ )
+ kwargs['_check_return_type'] = kwargs.get(
+ '_check_return_type', True
+ )
+ kwargs['_host_index'] = kwargs.get('_host_index')
+ kwargs['body'] = \
+ body
+ return self.call_with_http_info(**kwargs)
+
+ self.create_users_with_array_input = _Endpoint(
+ settings={
+ 'response_type': None,
+ 'auth': [],
+ 'endpoint_path': '/user/createWithArray',
+ 'operation_id': 'create_users_with_array_input',
+ 'http_method': 'POST',
+ 'servers': None,
+ },
+ params_map={
+ 'all': [
+ 'body',
+ ],
+ 'required': [
+ 'body',
+ ],
+ 'nullable': [
+ ],
+ 'enum': [
+ ],
+ 'validation': [
+ ]
+ },
+ root_map={
+ 'validations': {
+ },
+ 'allowed_values': {
+ },
+ 'openapi_types': {
+ 'body':
+ ([User],),
+ },
+ 'attribute_map': {
+ },
+ 'location_map': {
+ 'body': 'body',
+ },
+ 'collection_format_map': {
+ }
+ },
+ headers_map={
+ 'accept': [],
+ 'content_type': [],
+ },
+ api_client=api_client,
+ callable=__create_users_with_array_input
+ )
+
+ def __create_users_with_list_input(
+ self,
+ body,
+ **kwargs
+ ):
+ """Creates list of users with given input array # noqa: E501
+
+ This method makes a synchronous HTTP request by default. To make an
+ asynchronous HTTP request, please pass async_req=True
+
+ >>> thread = api.create_users_with_list_input(body, async_req=True)
+ >>> result = thread.get()
+
+ Args:
+ body ([User]): List of user object
+
+ Keyword Args:
+ _return_http_data_only (bool): response data without head status
+ code and headers. Default is True.
+ _preload_content (bool): if False, the urllib3.HTTPResponse object
+ will be returned without reading/decoding response data.
+ Default is True.
+ _request_timeout (float/tuple): timeout setting for this request. If one
+ number provided, it will be total request timeout. It can also
+ be a pair (tuple) of (connection, read) timeouts.
+ Default is None.
+ _check_input_type (bool): specifies if type checking
+ should be done one the data sent to the server.
+ Default is True.
+ _check_return_type (bool): specifies if type checking
+ should be done one the data received from the server.
+ Default is True.
+ _host_index (int/None): specifies the index of the server
+ that we want to use.
+ Default is read from the configuration.
+ async_req (bool): execute request asynchronously
+
+ Returns:
+ None
+ If the method is called asynchronously, returns the request
+ thread.
+ """
+ kwargs['async_req'] = kwargs.get(
+ 'async_req', False
+ )
+ kwargs['_return_http_data_only'] = kwargs.get(
+ '_return_http_data_only', True
+ )
+ kwargs['_preload_content'] = kwargs.get(
+ '_preload_content', True
+ )
+ kwargs['_request_timeout'] = kwargs.get(
+ '_request_timeout', None
+ )
+ kwargs['_check_input_type'] = kwargs.get(
+ '_check_input_type', True
+ )
+ kwargs['_check_return_type'] = kwargs.get(
+ '_check_return_type', True
+ )
+ kwargs['_host_index'] = kwargs.get('_host_index')
+ kwargs['body'] = \
+ body
+ return self.call_with_http_info(**kwargs)
+
+ self.create_users_with_list_input = _Endpoint(
+ settings={
+ 'response_type': None,
+ 'auth': [],
+ 'endpoint_path': '/user/createWithList',
+ 'operation_id': 'create_users_with_list_input',
+ 'http_method': 'POST',
+ 'servers': None,
+ },
+ params_map={
+ 'all': [
+ 'body',
+ ],
+ 'required': [
+ 'body',
+ ],
+ 'nullable': [
+ ],
+ 'enum': [
+ ],
+ 'validation': [
+ ]
+ },
+ root_map={
+ 'validations': {
+ },
+ 'allowed_values': {
+ },
+ 'openapi_types': {
+ 'body':
+ ([User],),
+ },
+ 'attribute_map': {
+ },
+ 'location_map': {
+ 'body': 'body',
+ },
+ 'collection_format_map': {
+ }
+ },
+ headers_map={
+ 'accept': [],
+ 'content_type': [],
+ },
+ api_client=api_client,
+ callable=__create_users_with_list_input
+ )
+
+ def __delete_user(
+ self,
+ username,
+ **kwargs
+ ):
+ """Delete user # noqa: E501
+
+ This can only be done by the logged in user. # noqa: E501
+ This method makes a synchronous HTTP request by default. To make an
+ asynchronous HTTP request, please pass async_req=True
+
+ >>> thread = api.delete_user(username, async_req=True)
+ >>> result = thread.get()
+
+ Args:
+ username (str): The name that needs to be deleted
+
+ Keyword Args:
+ _return_http_data_only (bool): response data without head status
+ code and headers. Default is True.
+ _preload_content (bool): if False, the urllib3.HTTPResponse object
+ will be returned without reading/decoding response data.
+ Default is True.
+ _request_timeout (float/tuple): timeout setting for this request. If one
+ number provided, it will be total request timeout. It can also
+ be a pair (tuple) of (connection, read) timeouts.
+ Default is None.
+ _check_input_type (bool): specifies if type checking
+ should be done one the data sent to the server.
+ Default is True.
+ _check_return_type (bool): specifies if type checking
+ should be done one the data received from the server.
+ Default is True.
+ _host_index (int/None): specifies the index of the server
+ that we want to use.
+ Default is read from the configuration.
+ async_req (bool): execute request asynchronously
+
+ Returns:
+ None
+ If the method is called asynchronously, returns the request
+ thread.
+ """
+ kwargs['async_req'] = kwargs.get(
+ 'async_req', False
+ )
+ kwargs['_return_http_data_only'] = kwargs.get(
+ '_return_http_data_only', True
+ )
+ kwargs['_preload_content'] = kwargs.get(
+ '_preload_content', True
+ )
+ kwargs['_request_timeout'] = kwargs.get(
+ '_request_timeout', None
+ )
+ kwargs['_check_input_type'] = kwargs.get(
+ '_check_input_type', True
+ )
+ kwargs['_check_return_type'] = kwargs.get(
+ '_check_return_type', True
+ )
+ kwargs['_host_index'] = kwargs.get('_host_index')
+ kwargs['username'] = \
+ username
+ return self.call_with_http_info(**kwargs)
+
+ self.delete_user = _Endpoint(
+ settings={
+ 'response_type': None,
+ 'auth': [],
+ 'endpoint_path': '/user/{username}',
+ 'operation_id': 'delete_user',
+ 'http_method': 'DELETE',
+ 'servers': None,
+ },
+ params_map={
+ 'all': [
+ 'username',
+ ],
+ 'required': [
+ 'username',
+ ],
+ 'nullable': [
+ ],
+ 'enum': [
+ ],
+ 'validation': [
+ ]
+ },
+ root_map={
+ 'validations': {
+ },
+ 'allowed_values': {
+ },
+ 'openapi_types': {
+ 'username':
+ (str,),
+ },
+ 'attribute_map': {
+ 'username': 'username',
+ },
+ 'location_map': {
+ 'username': 'path',
+ },
+ 'collection_format_map': {
+ }
+ },
+ headers_map={
+ 'accept': [],
+ 'content_type': [],
+ },
+ api_client=api_client,
+ callable=__delete_user
+ )
+
+ def __get_user_by_name(
+ self,
+ username,
+ **kwargs
+ ):
+ """Get user by user name # noqa: E501
+
+ This method makes a synchronous HTTP request by default. To make an
+ asynchronous HTTP request, please pass async_req=True
+
+ >>> thread = api.get_user_by_name(username, async_req=True)
+ >>> result = thread.get()
+
+ Args:
+ username (str): The name that needs to be fetched. Use user1 for testing.
+
+ Keyword Args:
+ _return_http_data_only (bool): response data without head status
+ code and headers. Default is True.
+ _preload_content (bool): if False, the urllib3.HTTPResponse object
+ will be returned without reading/decoding response data.
+ Default is True.
+ _request_timeout (float/tuple): timeout setting for this request. If one
+ number provided, it will be total request timeout. It can also
+ be a pair (tuple) of (connection, read) timeouts.
+ Default is None.
+ _check_input_type (bool): specifies if type checking
+ should be done one the data sent to the server.
+ Default is True.
+ _check_return_type (bool): specifies if type checking
+ should be done one the data received from the server.
+ Default is True.
+ _host_index (int/None): specifies the index of the server
+ that we want to use.
+ Default is read from the configuration.
+ async_req (bool): execute request asynchronously
+
+ Returns:
+ User
+ If the method is called asynchronously, returns the request
+ thread.
+ """
+ kwargs['async_req'] = kwargs.get(
+ 'async_req', False
+ )
+ kwargs['_return_http_data_only'] = kwargs.get(
+ '_return_http_data_only', True
+ )
+ kwargs['_preload_content'] = kwargs.get(
+ '_preload_content', True
+ )
+ kwargs['_request_timeout'] = kwargs.get(
+ '_request_timeout', None
+ )
+ kwargs['_check_input_type'] = kwargs.get(
+ '_check_input_type', True
+ )
+ kwargs['_check_return_type'] = kwargs.get(
+ '_check_return_type', True
+ )
+ kwargs['_host_index'] = kwargs.get('_host_index')
+ kwargs['username'] = \
+ username
+ return self.call_with_http_info(**kwargs)
+
+ self.get_user_by_name = _Endpoint(
+ settings={
+ 'response_type': (User,),
+ 'auth': [],
+ 'endpoint_path': '/user/{username}',
+ 'operation_id': 'get_user_by_name',
+ 'http_method': 'GET',
+ 'servers': None,
+ },
+ params_map={
+ 'all': [
+ 'username',
+ ],
+ 'required': [
+ 'username',
+ ],
+ 'nullable': [
+ ],
+ 'enum': [
+ ],
+ 'validation': [
+ ]
+ },
+ root_map={
+ 'validations': {
+ },
+ 'allowed_values': {
+ },
+ 'openapi_types': {
+ 'username':
+ (str,),
+ },
+ 'attribute_map': {
+ 'username': 'username',
+ },
+ 'location_map': {
+ 'username': 'path',
+ },
+ 'collection_format_map': {
+ }
+ },
+ headers_map={
+ 'accept': [
+ 'application/xml',
+ 'application/json'
+ ],
+ 'content_type': [],
+ },
+ api_client=api_client,
+ callable=__get_user_by_name
+ )
+
+ def __login_user(
+ self,
+ username,
+ password,
+ **kwargs
+ ):
+ """Logs user into the system # noqa: E501
+
+ This method makes a synchronous HTTP request by default. To make an
+ asynchronous HTTP request, please pass async_req=True
+
+ >>> thread = api.login_user(username, password, async_req=True)
+ >>> result = thread.get()
+
+ Args:
+ username (str): The user name for login
+ password (str): The password for login in clear text
+
+ Keyword Args:
+ _return_http_data_only (bool): response data without head status
+ code and headers. Default is True.
+ _preload_content (bool): if False, the urllib3.HTTPResponse object
+ will be returned without reading/decoding response data.
+ Default is True.
+ _request_timeout (float/tuple): timeout setting for this request. If one
+ number provided, it will be total request timeout. It can also
+ be a pair (tuple) of (connection, read) timeouts.
+ Default is None.
+ _check_input_type (bool): specifies if type checking
+ should be done one the data sent to the server.
+ Default is True.
+ _check_return_type (bool): specifies if type checking
+ should be done one the data received from the server.
+ Default is True.
+ _host_index (int/None): specifies the index of the server
+ that we want to use.
+ Default is read from the configuration.
+ async_req (bool): execute request asynchronously
+
+ Returns:
+ str
+ If the method is called asynchronously, returns the request
+ thread.
+ """
+ kwargs['async_req'] = kwargs.get(
+ 'async_req', False
+ )
+ kwargs['_return_http_data_only'] = kwargs.get(
+ '_return_http_data_only', True
+ )
+ kwargs['_preload_content'] = kwargs.get(
+ '_preload_content', True
+ )
+ kwargs['_request_timeout'] = kwargs.get(
+ '_request_timeout', None
+ )
+ kwargs['_check_input_type'] = kwargs.get(
+ '_check_input_type', True
+ )
+ kwargs['_check_return_type'] = kwargs.get(
+ '_check_return_type', True
+ )
+ kwargs['_host_index'] = kwargs.get('_host_index')
+ kwargs['username'] = \
+ username
+ kwargs['password'] = \
+ password
+ return self.call_with_http_info(**kwargs)
+
+ self.login_user = _Endpoint(
+ settings={
+ 'response_type': (str,),
+ 'auth': [],
+ 'endpoint_path': '/user/login',
+ 'operation_id': 'login_user',
+ 'http_method': 'GET',
+ 'servers': None,
+ },
+ params_map={
+ 'all': [
+ 'username',
+ 'password',
+ ],
+ 'required': [
+ 'username',
+ 'password',
+ ],
+ 'nullable': [
+ ],
+ 'enum': [
+ ],
+ 'validation': [
+ ]
+ },
+ root_map={
+ 'validations': {
+ },
+ 'allowed_values': {
+ },
+ 'openapi_types': {
+ 'username':
+ (str,),
+ 'password':
+ (str,),
+ },
+ 'attribute_map': {
+ 'username': 'username',
+ 'password': 'password',
+ },
+ 'location_map': {
+ 'username': 'query',
+ 'password': 'query',
+ },
+ 'collection_format_map': {
+ }
+ },
+ headers_map={
+ 'accept': [
+ 'application/xml',
+ 'application/json'
+ ],
+ 'content_type': [],
+ },
+ api_client=api_client,
+ callable=__login_user
+ )
+
+ def __logout_user(
+ self,
+ **kwargs
+ ):
+ """Logs out current logged in user session # noqa: E501
+
+ This method makes a synchronous HTTP request by default. To make an
+ asynchronous HTTP request, please pass async_req=True
+
+ >>> thread = api.logout_user(async_req=True)
+ >>> result = thread.get()
+
+
+ Keyword Args:
+ _return_http_data_only (bool): response data without head status
+ code and headers. Default is True.
+ _preload_content (bool): if False, the urllib3.HTTPResponse object
+ will be returned without reading/decoding response data.
+ Default is True.
+ _request_timeout (float/tuple): timeout setting for this request. If one
+ number provided, it will be total request timeout. It can also
+ be a pair (tuple) of (connection, read) timeouts.
+ Default is None.
+ _check_input_type (bool): specifies if type checking
+ should be done one the data sent to the server.
+ Default is True.
+ _check_return_type (bool): specifies if type checking
+ should be done one the data received from the server.
+ Default is True.
+ _host_index (int/None): specifies the index of the server
+ that we want to use.
+ Default is read from the configuration.
+ async_req (bool): execute request asynchronously
+
+ Returns:
+ None
+ If the method is called asynchronously, returns the request
+ thread.
+ """
+ kwargs['async_req'] = kwargs.get(
+ 'async_req', False
+ )
+ kwargs['_return_http_data_only'] = kwargs.get(
+ '_return_http_data_only', True
+ )
+ kwargs['_preload_content'] = kwargs.get(
+ '_preload_content', True
+ )
+ kwargs['_request_timeout'] = kwargs.get(
+ '_request_timeout', None
+ )
+ kwargs['_check_input_type'] = kwargs.get(
+ '_check_input_type', True
+ )
+ kwargs['_check_return_type'] = kwargs.get(
+ '_check_return_type', True
+ )
+ kwargs['_host_index'] = kwargs.get('_host_index')
+ return self.call_with_http_info(**kwargs)
+
+ self.logout_user = _Endpoint(
+ settings={
+ 'response_type': None,
+ 'auth': [],
+ 'endpoint_path': '/user/logout',
+ 'operation_id': 'logout_user',
+ 'http_method': 'GET',
+ 'servers': None,
+ },
+ params_map={
+ 'all': [
+ ],
+ 'required': [],
+ 'nullable': [
+ ],
+ 'enum': [
+ ],
+ 'validation': [
+ ]
+ },
+ root_map={
+ 'validations': {
+ },
+ 'allowed_values': {
+ },
+ 'openapi_types': {
+ },
+ 'attribute_map': {
+ },
+ 'location_map': {
+ },
+ 'collection_format_map': {
+ }
+ },
+ headers_map={
+ 'accept': [],
+ 'content_type': [],
+ },
+ api_client=api_client,
+ callable=__logout_user
+ )
+
+ def __update_user(
+ self,
+ username,
+ body,
+ **kwargs
+ ):
+ """Updated user # noqa: E501
+
+ This can only be done by the logged in user. # noqa: E501
+ This method makes a synchronous HTTP request by default. To make an
+ asynchronous HTTP request, please pass async_req=True
+
+ >>> thread = api.update_user(username, body, async_req=True)
+ >>> result = thread.get()
+
+ Args:
+ username (str): name that need to be deleted
+ body (User): Updated user object
+
+ Keyword Args:
+ _return_http_data_only (bool): response data without head status
+ code and headers. Default is True.
+ _preload_content (bool): if False, the urllib3.HTTPResponse object
+ will be returned without reading/decoding response data.
+ Default is True.
+ _request_timeout (float/tuple): timeout setting for this request. If one
+ number provided, it will be total request timeout. It can also
+ be a pair (tuple) of (connection, read) timeouts.
+ Default is None.
+ _check_input_type (bool): specifies if type checking
+ should be done one the data sent to the server.
+ Default is True.
+ _check_return_type (bool): specifies if type checking
+ should be done one the data received from the server.
+ Default is True.
+ _host_index (int/None): specifies the index of the server
+ that we want to use.
+ Default is read from the configuration.
+ async_req (bool): execute request asynchronously
+
+ Returns:
+ None
+ If the method is called asynchronously, returns the request
+ thread.
+ """
+ kwargs['async_req'] = kwargs.get(
+ 'async_req', False
+ )
+ kwargs['_return_http_data_only'] = kwargs.get(
+ '_return_http_data_only', True
+ )
+ kwargs['_preload_content'] = kwargs.get(
+ '_preload_content', True
+ )
+ kwargs['_request_timeout'] = kwargs.get(
+ '_request_timeout', None
+ )
+ kwargs['_check_input_type'] = kwargs.get(
+ '_check_input_type', True
+ )
+ kwargs['_check_return_type'] = kwargs.get(
+ '_check_return_type', True
+ )
+ kwargs['_host_index'] = kwargs.get('_host_index')
+ kwargs['username'] = \
+ username
+ kwargs['body'] = \
+ body
+ return self.call_with_http_info(**kwargs)
+
+ self.update_user = _Endpoint(
+ settings={
+ 'response_type': None,
+ 'auth': [],
+ 'endpoint_path': '/user/{username}',
+ 'operation_id': 'update_user',
+ 'http_method': 'PUT',
+ 'servers': None,
+ },
+ params_map={
+ 'all': [
+ 'username',
+ 'body',
+ ],
+ 'required': [
+ 'username',
+ 'body',
+ ],
+ 'nullable': [
+ ],
+ 'enum': [
+ ],
+ 'validation': [
+ ]
+ },
+ root_map={
+ 'validations': {
+ },
+ 'allowed_values': {
+ },
+ 'openapi_types': {
+ 'username':
+ (str,),
+ 'body':
+ (User,),
+ },
+ 'attribute_map': {
+ 'username': 'username',
+ },
+ 'location_map': {
+ 'username': 'path',
+ 'body': 'body',
+ },
+ 'collection_format_map': {
+ }
+ },
+ headers_map={
+ 'accept': [],
+ 'content_type': [],
+ },
+ api_client=api_client,
+ callable=__update_user
+ )
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/api_client.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/api_client.py
new file mode 100644
index 000000000000..a43e4ace2427
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/api_client.py
@@ -0,0 +1,849 @@
+"""
+ 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: https://openapi-generator.tech
+"""
+
+
+import json
+import atexit
+import mimetypes
+from multiprocessing.pool import ThreadPool
+import io
+import os
+import re
+import typing
+from urllib.parse import quote
+from urllib3.fields import RequestField
+
+
+from petstore_api import rest
+from petstore_api.configuration import Configuration
+from petstore_api.exceptions import ApiTypeError, ApiValueError, ApiException
+from petstore_api.model_utils import (
+ ModelNormal,
+ ModelSimple,
+ ModelComposed,
+ check_allowed_values,
+ check_validations,
+ date,
+ datetime,
+ deserialize_file,
+ file_type,
+ model_to_dict,
+ none_type,
+ validate_and_convert_types
+)
+
+
+class ApiClient(object):
+ """Generic API client for OpenAPI client library builds.
+
+ OpenAPI generic API client. This client handles the client-
+ server communication, and is invariant across implementations. Specifics of
+ the methods and models for each application are generated from the OpenAPI
+ templates.
+
+ NOTE: This class is auto generated by OpenAPI Generator.
+ Ref: https://openapi-generator.tech
+ Do not edit the class manually.
+
+ :param configuration: .Configuration object for this client
+ :param header_name: a header to pass when making calls to the API.
+ :param header_value: a header value to pass when making calls to
+ the API.
+ :param cookie: a cookie to include in the header when making calls
+ to the API
+ :param pool_threads: The number of threads to use for async requests
+ to the API. More threads means more concurrent API requests.
+ """
+
+ _pool = None
+
+ def __init__(self, configuration=None, header_name=None, header_value=None,
+ cookie=None, pool_threads=1):
+ if configuration is None:
+ configuration = Configuration.get_default_copy()
+ self.configuration = configuration
+ self.pool_threads = pool_threads
+
+ self.rest_client = rest.RESTClientObject(configuration)
+ self.default_headers = {}
+ if header_name is not None:
+ self.default_headers[header_name] = header_value
+ self.cookie = cookie
+ # Set default User-Agent.
+ self.user_agent = 'OpenAPI-Generator/1.0.0/python'
+
+ def __enter__(self):
+ return self
+
+ def __exit__(self, exc_type, exc_value, traceback):
+ self.close()
+
+ def close(self):
+ if self._pool:
+ self._pool.close()
+ self._pool.join()
+ self._pool = None
+ if hasattr(atexit, 'unregister'):
+ atexit.unregister(self.close)
+
+ @property
+ def pool(self):
+ """Create thread pool on first request
+ avoids instantiating unused threadpool for blocking clients.
+ """
+ if self._pool is None:
+ atexit.register(self.close)
+ self._pool = ThreadPool(self.pool_threads)
+ return self._pool
+
+ @property
+ def user_agent(self):
+ """User agent for this API client"""
+ return self.default_headers['User-Agent']
+
+ @user_agent.setter
+ def user_agent(self, value):
+ self.default_headers['User-Agent'] = value
+
+ def set_default_header(self, header_name, header_value):
+ self.default_headers[header_name] = header_value
+
+ def __call_api(
+ self,
+ resource_path: str,
+ method: str,
+ path_params: typing.Optional[typing.Dict[str, typing.Any]] = None,
+ query_params: typing.Optional[typing.List[typing.Tuple[str, typing.Any]]] = None,
+ header_params: typing.Optional[typing.Dict[str, typing.Any]] = None,
+ body: typing.Optional[typing.Any] = None,
+ post_params: typing.Optional[typing.List[typing.Tuple[str, typing.Any]]] = None,
+ files: typing.Optional[typing.Dict[str, typing.List[io.IOBase]]] = None,
+ response_type: typing.Optional[typing.Tuple[typing.Any]] = None,
+ auth_settings: typing.Optional[typing.List[str]] = None,
+ _return_http_data_only: typing.Optional[bool] = None,
+ collection_formats: typing.Optional[typing.Dict[str, str]] = None,
+ _preload_content: bool = True,
+ _request_timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None,
+ _host: typing.Optional[str] = None,
+ _check_type: typing.Optional[bool] = None
+ ):
+
+ config = self.configuration
+
+ # header parameters
+ header_params = header_params or {}
+ header_params.update(self.default_headers)
+ if self.cookie:
+ header_params['Cookie'] = self.cookie
+ if header_params:
+ header_params = self.sanitize_for_serialization(header_params)
+ header_params = dict(self.parameters_to_tuples(header_params,
+ collection_formats))
+
+ # path parameters
+ if path_params:
+ path_params = self.sanitize_for_serialization(path_params)
+ path_params = self.parameters_to_tuples(path_params,
+ collection_formats)
+ for k, v in path_params:
+ # specified safe chars, encode everything
+ resource_path = resource_path.replace(
+ '{%s}' % k,
+ quote(str(v), safe=config.safe_chars_for_path_param)
+ )
+
+ # query parameters
+ if query_params:
+ query_params = self.sanitize_for_serialization(query_params)
+ query_params = self.parameters_to_tuples(query_params,
+ collection_formats)
+
+ # post parameters
+ if post_params or files:
+ post_params = post_params if post_params else []
+ post_params = self.sanitize_for_serialization(post_params)
+ post_params = self.parameters_to_tuples(post_params,
+ collection_formats)
+ post_params.extend(self.files_parameters(files))
+ if header_params['Content-Type'].startswith("multipart"):
+ post_params = self.parameters_to_multipart(post_params,
+ (dict) )
+
+ # body
+ if body:
+ body = self.sanitize_for_serialization(body)
+
+ # auth setting
+ self.update_params_for_auth(header_params, query_params,
+ auth_settings, resource_path, method, body)
+
+ # request url
+ if _host is None:
+ url = self.configuration.host + resource_path
+ else:
+ # use server/host defined in path or operation instead
+ url = _host + resource_path
+
+ try:
+ # perform request and return response
+ response_data = self.request(
+ method, url, query_params=query_params, headers=header_params,
+ post_params=post_params, body=body,
+ _preload_content=_preload_content,
+ _request_timeout=_request_timeout)
+ except ApiException as e:
+ e.body = e.body.decode('utf-8')
+ raise e
+
+ self.last_response = response_data
+
+ return_data = response_data
+
+ if not _preload_content:
+ return (return_data)
+ return return_data
+
+ # deserialize response data
+ if response_type:
+ if response_type != (file_type,):
+ encoding = "utf-8"
+ content_type = response_data.getheader('content-type')
+ if content_type is not None:
+ match = re.search(r"charset=([a-zA-Z\-\d]+)[\s\;]?", content_type)
+ if match:
+ encoding = match.group(1)
+ response_data.data = response_data.data.decode(encoding)
+
+ return_data = self.deserialize(
+ response_data,
+ response_type,
+ _check_type
+ )
+ else:
+ return_data = None
+
+ if _return_http_data_only:
+ return (return_data)
+ else:
+ return (return_data, response_data.status,
+ response_data.getheaders())
+
+ def parameters_to_multipart(self, params, collection_types):
+ """Get parameters as list of tuples, formatting as json if value is collection_types
+
+ :param params: Parameters as list of two-tuples
+ :param dict collection_types: Parameter collection types
+ :return: Parameters as list of tuple or urllib3.fields.RequestField
+ """
+ new_params = []
+ if collection_types is None:
+ collection_types = (dict)
+ for k, v in params.items() if isinstance(params, dict) else params: # noqa: E501
+ if isinstance(v, collection_types): # v is instance of collection_type, formatting as application/json
+ v = json.dumps(v, ensure_ascii=False).encode("utf-8")
+ field = RequestField(k, v)
+ field.make_multipart(content_type="application/json; charset=utf-8")
+ new_params.append(field)
+ else:
+ new_params.append((k, v))
+ return new_params
+
+ @classmethod
+ def sanitize_for_serialization(cls, obj):
+ """Prepares data for transmission before it is sent with the rest client
+ If obj is None, return None.
+ If obj is str, int, long, float, bool, return directly.
+ If obj is datetime.datetime, datetime.date
+ convert to string in iso8601 format.
+ If obj is list, sanitize each element in the list.
+ If obj is dict, return the dict.
+ If obj is OpenAPI model, return the properties dict.
+ If obj is io.IOBase, return the bytes
+ :param obj: The data to serialize.
+ :return: The serialized form of data.
+ """
+ if isinstance(obj, (ModelNormal, ModelComposed)):
+ return {
+ key: cls.sanitize_for_serialization(val) for key, val in model_to_dict(obj, serialize=True).items()
+ }
+ elif isinstance(obj, io.IOBase):
+ return cls.get_file_data_and_close_file(obj)
+ elif isinstance(obj, (str, int, float, none_type, bool)):
+ return obj
+ elif isinstance(obj, (datetime, date)):
+ return obj.isoformat()
+ elif isinstance(obj, ModelSimple):
+ return cls.sanitize_for_serialization(obj.value)
+ elif isinstance(obj, (list, tuple)):
+ return [cls.sanitize_for_serialization(item) for item in obj]
+ if isinstance(obj, dict):
+ return {key: cls.sanitize_for_serialization(val) for key, val in obj.items()}
+ raise ApiValueError('Unable to prepare type {} for serialization'.format(obj.__class__.__name__))
+
+ def deserialize(self, response, response_type, _check_type):
+ """Deserializes response into an object.
+
+ :param response: RESTResponse object to be deserialized.
+ :param response_type: For the response, a tuple containing:
+ valid classes
+ a list containing valid classes (for list schemas)
+ a dict containing a tuple of valid classes as the value
+ Example values:
+ (str,)
+ (Pet,)
+ (float, none_type)
+ ([int, none_type],)
+ ({str: (bool, str, int, float, date, datetime, str, none_type)},)
+ :param _check_type: boolean, whether to check the types of the data
+ received from the server
+ :type _check_type: bool
+
+ :return: deserialized object.
+ """
+ # handle file downloading
+ # save response body into a tmp file and return the instance
+ if response_type == (file_type,):
+ content_disposition = response.getheader("Content-Disposition")
+ return deserialize_file(response.data, self.configuration,
+ content_disposition=content_disposition)
+
+ # fetch data from response object
+ try:
+ received_data = json.loads(response.data)
+ except ValueError:
+ received_data = response.data
+
+ # store our data under the key of 'received_data' so users have some
+ # context if they are deserializing a string and the data type is wrong
+ deserialized_data = validate_and_convert_types(
+ received_data,
+ response_type,
+ ['received_data'],
+ True,
+ _check_type,
+ configuration=self.configuration
+ )
+ return deserialized_data
+
+ def call_api(
+ self,
+ resource_path: str,
+ method: str,
+ path_params: typing.Optional[typing.Dict[str, typing.Any]] = None,
+ query_params: typing.Optional[typing.List[typing.Tuple[str, typing.Any]]] = None,
+ header_params: typing.Optional[typing.Dict[str, typing.Any]] = None,
+ body: typing.Optional[typing.Any] = None,
+ post_params: typing.Optional[typing.List[typing.Tuple[str, typing.Any]]] = None,
+ files: typing.Optional[typing.Dict[str, typing.List[io.IOBase]]] = None,
+ response_type: typing.Optional[typing.Tuple[typing.Any]] = None,
+ auth_settings: typing.Optional[typing.List[str]] = None,
+ async_req: typing.Optional[bool] = None,
+ _return_http_data_only: typing.Optional[bool] = None,
+ collection_formats: typing.Optional[typing.Dict[str, str]] = None,
+ _preload_content: bool = True,
+ _request_timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None,
+ _host: typing.Optional[str] = None,
+ _check_type: typing.Optional[bool] = None
+ ):
+ """Makes the HTTP request (synchronous) and returns deserialized data.
+
+ To make an async_req request, set the async_req parameter.
+
+ :param resource_path: Path to method endpoint.
+ :param method: Method to call.
+ :param path_params: Path parameters in the url.
+ :param query_params: Query parameters in the url.
+ :param header_params: Header parameters to be
+ placed in the request header.
+ :param body: Request body.
+ :param post_params dict: Request post form parameters,
+ for `application/x-www-form-urlencoded`, `multipart/form-data`.
+ :param auth_settings list: Auth Settings names for the request.
+ :param response_type: For the response, a tuple containing:
+ valid classes
+ a list containing valid classes (for list schemas)
+ a dict containing a tuple of valid classes as the value
+ Example values:
+ (str,)
+ (Pet,)
+ (float, none_type)
+ ([int, none_type],)
+ ({str: (bool, str, int, float, date, datetime, str, none_type)},)
+ :param files: key -> field name, value -> a list of open file
+ objects for `multipart/form-data`.
+ :type files: dict
+ :param async_req bool: execute request asynchronously
+ :type async_req: bool, optional
+ :param _return_http_data_only: response data without head status code
+ and headers
+ :type _return_http_data_only: bool, optional
+ :param collection_formats: dict of collection formats for path, query,
+ header, and post parameters.
+ :type collection_formats: dict, optional
+ :param _preload_content: if False, the urllib3.HTTPResponse object will
+ be returned without reading/decoding response
+ data. Default is True.
+ :type _preload_content: bool, optional
+ :param _request_timeout: timeout setting for this request. If one
+ number provided, it will be total request
+ timeout. It can also be a pair (tuple) of
+ (connection, read) timeouts.
+ :param _check_type: boolean describing if the data back from the server
+ should have its type checked.
+ :type _check_type: bool, optional
+ :return:
+ If async_req parameter is True,
+ the request will be called asynchronously.
+ The method will return the request thread.
+ If parameter async_req is False or missing,
+ then the method will return the response directly.
+ """
+ if not async_req:
+ return self.__call_api(resource_path, method,
+ path_params, query_params, header_params,
+ body, post_params, files,
+ response_type, auth_settings,
+ _return_http_data_only, collection_formats,
+ _preload_content, _request_timeout, _host,
+ _check_type)
+
+ return self.pool.apply_async(self.__call_api, (resource_path,
+ method, path_params,
+ query_params,
+ header_params, body,
+ post_params, files,
+ response_type,
+ auth_settings,
+ _return_http_data_only,
+ collection_formats,
+ _preload_content,
+ _request_timeout,
+ _host, _check_type))
+
+ def request(self, method, url, query_params=None, headers=None,
+ post_params=None, body=None, _preload_content=True,
+ _request_timeout=None):
+ """Makes the HTTP request using RESTClient."""
+ if method == "GET":
+ return self.rest_client.GET(url,
+ query_params=query_params,
+ _preload_content=_preload_content,
+ _request_timeout=_request_timeout,
+ headers=headers)
+ elif method == "HEAD":
+ return self.rest_client.HEAD(url,
+ query_params=query_params,
+ _preload_content=_preload_content,
+ _request_timeout=_request_timeout,
+ headers=headers)
+ elif method == "OPTIONS":
+ return self.rest_client.OPTIONS(url,
+ query_params=query_params,
+ headers=headers,
+ post_params=post_params,
+ _preload_content=_preload_content,
+ _request_timeout=_request_timeout,
+ body=body)
+ elif method == "POST":
+ return self.rest_client.POST(url,
+ query_params=query_params,
+ headers=headers,
+ post_params=post_params,
+ _preload_content=_preload_content,
+ _request_timeout=_request_timeout,
+ body=body)
+ elif method == "PUT":
+ return self.rest_client.PUT(url,
+ query_params=query_params,
+ headers=headers,
+ post_params=post_params,
+ _preload_content=_preload_content,
+ _request_timeout=_request_timeout,
+ body=body)
+ elif method == "PATCH":
+ return self.rest_client.PATCH(url,
+ query_params=query_params,
+ headers=headers,
+ post_params=post_params,
+ _preload_content=_preload_content,
+ _request_timeout=_request_timeout,
+ body=body)
+ elif method == "DELETE":
+ return self.rest_client.DELETE(url,
+ query_params=query_params,
+ headers=headers,
+ _preload_content=_preload_content,
+ _request_timeout=_request_timeout,
+ body=body)
+ else:
+ raise ApiValueError(
+ "http method must be `GET`, `HEAD`, `OPTIONS`,"
+ " `POST`, `PATCH`, `PUT` or `DELETE`."
+ )
+
+ def parameters_to_tuples(self, params, collection_formats):
+ """Get parameters as list of tuples, formatting collections.
+
+ :param params: Parameters as dict or list of two-tuples
+ :param dict collection_formats: Parameter collection formats
+ :return: Parameters as list of tuples, collections formatted
+ """
+ new_params = []
+ if collection_formats is None:
+ collection_formats = {}
+ for k, v in params.items() if isinstance(params, dict) else params: # noqa: E501
+ if k in collection_formats:
+ collection_format = collection_formats[k]
+ if collection_format == 'multi':
+ new_params.extend((k, value) for value in v)
+ else:
+ if collection_format == 'ssv':
+ delimiter = ' '
+ elif collection_format == 'tsv':
+ delimiter = '\t'
+ elif collection_format == 'pipes':
+ delimiter = '|'
+ else: # csv is the default
+ delimiter = ','
+ new_params.append(
+ (k, delimiter.join(str(value) for value in v)))
+ else:
+ new_params.append((k, v))
+ return new_params
+
+ @staticmethod
+ def get_file_data_and_close_file(file_instance: io.IOBase) -> bytes:
+ file_data = file_instance.read()
+ file_instance.close()
+ return file_data
+
+ def files_parameters(self, files: typing.Optional[typing.Dict[str, typing.List[io.IOBase]]] = None):
+ """Builds form parameters.
+
+ :param files: None or a dict with key=param_name and
+ value is a list of open file objects
+ :return: List of tuples of form parameters with file data
+ """
+ if files is None:
+ return []
+
+ params = []
+ for param_name, file_instances in files.items():
+ if file_instances is None:
+ # if the file field is nullable, skip None values
+ continue
+ for file_instance in file_instances:
+ if file_instance is None:
+ # if the file field is nullable, skip None values
+ continue
+ if file_instance.closed is True:
+ raise ApiValueError(
+ "Cannot read a closed file. The passed in file_type "
+ "for %s must be open." % param_name
+ )
+ filename = os.path.basename(file_instance.name)
+ filedata = self.get_file_data_and_close_file(file_instance)
+ mimetype = (mimetypes.guess_type(filename)[0] or
+ 'application/octet-stream')
+ params.append(
+ tuple([param_name, tuple([filename, filedata, mimetype])]))
+
+ return params
+
+ def select_header_accept(self, accepts):
+ """Returns `Accept` based on an array of accepts provided.
+
+ :param accepts: List of headers.
+ :return: Accept (e.g. application/json).
+ """
+ if not accepts:
+ return
+
+ accepts = [x.lower() for x in accepts]
+
+ if 'application/json' in accepts:
+ return 'application/json'
+ else:
+ return ', '.join(accepts)
+
+ def select_header_content_type(self, content_types):
+ """Returns `Content-Type` based on an array of content_types provided.
+
+ :param content_types: List of content-types.
+ :return: Content-Type (e.g. application/json).
+ """
+ if not content_types:
+ return 'application/json'
+
+ content_types = [x.lower() for x in content_types]
+
+ if 'application/json' in content_types or '*/*' in content_types:
+ return 'application/json'
+ else:
+ return content_types[0]
+
+ def update_params_for_auth(self, headers, querys, auth_settings,
+ resource_path, method, body):
+ """Updates header and query params based on authentication setting.
+
+ :param headers: Header parameters dict to be updated.
+ :param querys: Query parameters tuple list to be updated.
+ :param auth_settings: Authentication setting identifiers list.
+ :param resource_path: A string representation of the HTTP request resource path.
+ :param method: A string representation of the HTTP request method.
+ :param body: A object representing the body of the HTTP request.
+ The object type is the return value of _encoder.default().
+ """
+ if not auth_settings:
+ return
+
+ for auth in auth_settings:
+ auth_setting = self.configuration.auth_settings().get(auth)
+ if auth_setting:
+ if auth_setting['in'] == 'cookie':
+ headers['Cookie'] = auth_setting['value']
+ elif auth_setting['in'] == 'header':
+ if auth_setting['type'] != 'http-signature':
+ headers[auth_setting['key']] = auth_setting['value']
+ elif auth_setting['in'] == 'query':
+ querys.append((auth_setting['key'], auth_setting['value']))
+ else:
+ raise ApiValueError(
+ 'Authentication token must be in `query` or `header`'
+ )
+
+
+class Endpoint(object):
+ def __init__(self, settings=None, params_map=None, root_map=None,
+ headers_map=None, api_client=None, callable=None):
+ """Creates an endpoint
+
+ Args:
+ settings (dict): see below key value pairs
+ 'response_type' (tuple/None): response type
+ 'auth' (list): a list of auth type keys
+ 'endpoint_path' (str): the endpoint path
+ 'operation_id' (str): endpoint string identifier
+ 'http_method' (str): POST/PUT/PATCH/GET etc
+ 'servers' (list): list of str servers that this endpoint is at
+ params_map (dict): see below key value pairs
+ 'all' (list): list of str endpoint parameter names
+ 'required' (list): list of required parameter names
+ 'nullable' (list): list of nullable parameter names
+ 'enum' (list): list of parameters with enum values
+ 'validation' (list): list of parameters with validations
+ root_map
+ 'validations' (dict): the dict mapping endpoint parameter tuple
+ paths to their validation dictionaries
+ 'allowed_values' (dict): the dict mapping endpoint parameter
+ tuple paths to their allowed_values (enum) dictionaries
+ 'openapi_types' (dict): param_name to openapi type
+ 'attribute_map' (dict): param_name to camelCase name
+ 'location_map' (dict): param_name to 'body', 'file', 'form',
+ 'header', 'path', 'query'
+ collection_format_map (dict): param_name to `csv` etc.
+ headers_map (dict): see below key value pairs
+ 'accept' (list): list of Accept header strings
+ 'content_type' (list): list of Content-Type header strings
+ api_client (ApiClient) api client instance
+ callable (function): the function which is invoked when the
+ Endpoint is called
+ """
+ self.settings = settings
+ self.params_map = params_map
+ self.params_map['all'].extend([
+ 'async_req',
+ '_host_index',
+ '_preload_content',
+ '_request_timeout',
+ '_return_http_data_only',
+ '_check_input_type',
+ '_check_return_type'
+ ])
+ self.params_map['nullable'].extend(['_request_timeout'])
+ self.validations = root_map['validations']
+ self.allowed_values = root_map['allowed_values']
+ self.openapi_types = root_map['openapi_types']
+ extra_types = {
+ 'async_req': (bool,),
+ '_host_index': (none_type, int),
+ '_preload_content': (bool,),
+ '_request_timeout': (none_type, int, (int,), [int]),
+ '_return_http_data_only': (bool,),
+ '_check_input_type': (bool,),
+ '_check_return_type': (bool,)
+ }
+ self.openapi_types.update(extra_types)
+ self.attribute_map = root_map['attribute_map']
+ self.location_map = root_map['location_map']
+ self.collection_format_map = root_map['collection_format_map']
+ self.headers_map = headers_map
+ self.api_client = api_client
+ self.callable = callable
+
+ def __validate_inputs(self, kwargs):
+ for param in self.params_map['enum']:
+ if param in kwargs:
+ check_allowed_values(
+ self.allowed_values,
+ (param,),
+ kwargs[param]
+ )
+
+ for param in self.params_map['validation']:
+ if param in kwargs:
+ check_validations(
+ self.validations,
+ (param,),
+ kwargs[param],
+ configuration=self.api_client.configuration
+ )
+
+ if kwargs['_check_input_type'] is False:
+ return
+
+ for key, value in kwargs.items():
+ fixed_val = validate_and_convert_types(
+ value,
+ self.openapi_types[key],
+ [key],
+ False,
+ kwargs['_check_input_type'],
+ configuration=self.api_client.configuration
+ )
+ kwargs[key] = fixed_val
+
+ def __gather_params(self, kwargs):
+ params = {
+ 'body': None,
+ 'collection_format': {},
+ 'file': {},
+ 'form': [],
+ 'header': {},
+ 'path': {},
+ 'query': []
+ }
+
+ for param_name, param_value in kwargs.items():
+ param_location = self.location_map.get(param_name)
+ if param_location is None:
+ continue
+ if param_location:
+ if param_location == 'body':
+ params['body'] = param_value
+ continue
+ base_name = self.attribute_map[param_name]
+ if (param_location == 'form' and
+ self.openapi_types[param_name] == (file_type,)):
+ params['file'][param_name] = [param_value]
+ elif (param_location == 'form' and
+ self.openapi_types[param_name] == ([file_type],)):
+ # param_value is already a list
+ params['file'][param_name] = param_value
+ elif param_location in {'form', 'query'}:
+ param_value_full = (base_name, param_value)
+ params[param_location].append(param_value_full)
+ if param_location not in {'form', 'query'}:
+ params[param_location][base_name] = param_value
+ collection_format = self.collection_format_map.get(param_name)
+ if collection_format:
+ params['collection_format'][base_name] = collection_format
+
+ return params
+
+ def __call__(self, *args, **kwargs):
+ """ This method is invoked when endpoints are called
+ Example:
+
+ api_instance = AnotherFakeApi()
+ api_instance.call_123_test_special_tags # this is an instance of the class Endpoint
+ api_instance.call_123_test_special_tags() # this invokes api_instance.call_123_test_special_tags.__call__()
+ which then invokes the callable functions stored in that endpoint at
+ api_instance.call_123_test_special_tags.callable or self.callable in this class
+
+ """
+ return self.callable(self, *args, **kwargs)
+
+ def call_with_http_info(self, **kwargs):
+
+ try:
+ index = self.api_client.configuration.server_operation_index.get(
+ self.settings['operation_id'], self.api_client.configuration.server_index
+ ) if kwargs['_host_index'] is None else kwargs['_host_index']
+ server_variables = self.api_client.configuration.server_operation_variables.get(
+ self.settings['operation_id'], self.api_client.configuration.server_variables
+ )
+ _host = self.api_client.configuration.get_host_from_settings(
+ index, variables=server_variables, servers=self.settings['servers']
+ )
+ except IndexError:
+ if self.settings['servers']:
+ raise ApiValueError(
+ "Invalid host index. Must be 0 <= index < %s" %
+ len(self.settings['servers'])
+ )
+ _host = None
+
+ for key, value in kwargs.items():
+ if key not in self.params_map['all']:
+ raise ApiTypeError(
+ "Got an unexpected parameter '%s'"
+ " to method `%s`" %
+ (key, self.settings['operation_id'])
+ )
+ # only throw this nullable ApiValueError if _check_input_type
+ # is False, if _check_input_type==True we catch this case
+ # in self.__validate_inputs
+ if (key not in self.params_map['nullable'] and value is None
+ and kwargs['_check_input_type'] is False):
+ raise ApiValueError(
+ "Value may not be None for non-nullable parameter `%s`"
+ " when calling `%s`" %
+ (key, self.settings['operation_id'])
+ )
+
+ for key in self.params_map['required']:
+ if key not in kwargs.keys():
+ raise ApiValueError(
+ "Missing the required parameter `%s` when calling "
+ "`%s`" % (key, self.settings['operation_id'])
+ )
+
+ self.__validate_inputs(kwargs)
+
+ params = self.__gather_params(kwargs)
+
+ accept_headers_list = self.headers_map['accept']
+ if accept_headers_list:
+ params['header']['Accept'] = self.api_client.select_header_accept(
+ accept_headers_list)
+
+ content_type_headers_list = self.headers_map['content_type']
+ if content_type_headers_list:
+ header_list = self.api_client.select_header_content_type(
+ content_type_headers_list)
+ params['header']['Content-Type'] = header_list
+
+ return self.api_client.call_api(
+ self.settings['endpoint_path'], self.settings['http_method'],
+ params['path'],
+ params['query'],
+ params['header'],
+ body=params['body'],
+ post_params=params['form'],
+ files=params['file'],
+ response_type=self.settings['response_type'],
+ auth_settings=self.settings['auth'],
+ async_req=kwargs['async_req'],
+ _check_type=kwargs['_check_return_type'],
+ _return_http_data_only=kwargs['_return_http_data_only'],
+ _preload_content=kwargs['_preload_content'],
+ _request_timeout=kwargs['_request_timeout'],
+ _host=_host,
+ collection_formats=params['collection_format'])
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/apis/__init__.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/apis/__init__.py
new file mode 100644
index 000000000000..e4c52458a0c2
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/apis/__init__.py
@@ -0,0 +1,22 @@
+
+# flake8: noqa
+
+# Import all APIs into this package.
+# If you have many APIs here with many many models used in each API this may
+# raise a `RecursionError`.
+# In order to avoid this, import only the API that you directly need like:
+#
+# from .api.another_fake_api import AnotherFakeApi
+#
+# or import this package, but before doing it, use:
+#
+# import sys
+# sys.setrecursionlimit(n)
+
+# Import APIs into API package:
+from petstore_api.api.another_fake_api import AnotherFakeApi
+from petstore_api.api.fake_api import FakeApi
+from petstore_api.api.fake_classname_tags_123_api import FakeClassnameTags123Api
+from petstore_api.api.pet_api import PetApi
+from petstore_api.api.store_api import StoreApi
+from petstore_api.api.user_api import UserApi
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/configuration.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/configuration.py
new file mode 100644
index 000000000000..ccd984b7f5f8
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/configuration.py
@@ -0,0 +1,511 @@
+"""
+ 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: https://openapi-generator.tech
+"""
+
+
+import copy
+import logging
+import multiprocessing
+import sys
+import urllib3
+
+from http import client as http_client
+from petstore_api.exceptions import ApiValueError
+
+
+JSON_SCHEMA_VALIDATION_KEYWORDS = {
+ 'multipleOf', 'maximum', 'exclusiveMaximum',
+ 'minimum', 'exclusiveMinimum', 'maxLength',
+ 'minLength', 'pattern', 'maxItems', 'minItems'
+}
+
+class Configuration(object):
+ """NOTE: This class is auto generated by OpenAPI Generator
+
+ Ref: https://openapi-generator.tech
+ Do not edit the class manually.
+
+ :param host: Base url
+ :param api_key: Dict to store API key(s).
+ Each entry in the dict specifies an API key.
+ The dict key is the name of the security scheme in the OAS specification.
+ The dict value is the API key secret.
+ :param api_key_prefix: Dict to store API prefix (e.g. Bearer)
+ The dict key is the name of the security scheme in the OAS specification.
+ The dict value is an API key prefix when generating the auth data.
+ :param username: Username for HTTP basic authentication
+ :param password: Password for HTTP basic authentication
+ :param discard_unknown_keys: Boolean value indicating whether to discard
+ unknown properties. A server may send a response that includes additional
+ properties that are not known by the client in the following scenarios:
+ 1. The OpenAPI document is incomplete, i.e. it does not match the server
+ implementation.
+ 2. The client was generated using an older version of the OpenAPI document
+ and the server has been upgraded since then.
+ If a schema in the OpenAPI document defines the additionalProperties attribute,
+ then all undeclared properties received by the server are injected into the
+ additional properties map. In that case, there are undeclared properties, and
+ nothing to discard.
+ :param disabled_client_side_validations (string): Comma-separated list of
+ JSON schema validation keywords to disable JSON schema structural validation
+ rules. The following keywords may be specified: multipleOf, maximum,
+ exclusiveMaximum, minimum, exclusiveMinimum, maxLength, minLength, pattern,
+ maxItems, minItems.
+ By default, the validation is performed for data generated locally by the client
+ and data received from the server, independent of any validation performed by
+ the server side. If the input data does not satisfy the JSON schema validation
+ rules specified in the OpenAPI document, an exception is raised.
+ If disabled_client_side_validations is set, structural validation is
+ disabled. This can be useful to troubleshoot data validation problem, such as
+ when the OpenAPI document validation rules do not match the actual API data
+ received by the server.
+ :param server_index: Index to servers configuration.
+ :param server_variables: Mapping with string values to replace variables in
+ templated server configuration. The validation of enums is performed for
+ variables with defined enum values before.
+ :param server_operation_index: Mapping from operation ID to an index to server
+ configuration.
+ :param server_operation_variables: Mapping from operation ID to a mapping with
+ string values to replace variables in templated server configuration.
+ The validation of enums is performed for variables with defined enum values before.
+ :param ssl_ca_cert: str - the path to a file of concatenated CA certificates
+ in PEM format
+
+ :Example:
+
+ API Key Authentication Example.
+ Given the following security scheme in the OpenAPI specification:
+ components:
+ securitySchemes:
+ cookieAuth: # name for the security scheme
+ type: apiKey
+ in: cookie
+ name: JSESSIONID # cookie name
+
+ You can programmatically set the cookie:
+
+conf = petstore_api.Configuration(
+ api_key={'cookieAuth': 'abc123'}
+ api_key_prefix={'cookieAuth': 'JSESSIONID'}
+)
+
+ The following cookie will be added to the HTTP request:
+ Cookie: JSESSIONID abc123
+
+ HTTP Basic Authentication Example.
+ Given the following security scheme in the OpenAPI specification:
+ components:
+ securitySchemes:
+ http_basic_auth:
+ type: http
+ scheme: basic
+
+ Configure API client with HTTP basic authentication:
+
+conf = petstore_api.Configuration(
+ username='the-user',
+ password='the-password',
+)
+
+ """
+
+ _default = None
+
+ def __init__(self, host=None,
+ api_key=None, api_key_prefix=None,
+ access_token=None,
+ username=None, password=None,
+ discard_unknown_keys=False,
+ disabled_client_side_validations="",
+ server_index=None, server_variables=None,
+ server_operation_index=None, server_operation_variables=None,
+ ssl_ca_cert=None,
+ ):
+ """Constructor
+ """
+ self._base_path = "http://petstore.swagger.io:80/v2" if host is None else host
+ """Default Base url
+ """
+ self.server_index = 0 if server_index is None and host is None else server_index
+ self.server_operation_index = server_operation_index or {}
+ """Default server index
+ """
+ self.server_variables = server_variables or {}
+ self.server_operation_variables = server_operation_variables or {}
+ """Default server variables
+ """
+ self.temp_folder_path = None
+ """Temp file folder for downloading files
+ """
+ # Authentication Settings
+ self.access_token = access_token
+ self.api_key = {}
+ if api_key:
+ self.api_key = api_key
+ """dict to store API key(s)
+ """
+ self.api_key_prefix = {}
+ if api_key_prefix:
+ self.api_key_prefix = api_key_prefix
+ """dict to store API prefix (e.g. Bearer)
+ """
+ self.refresh_api_key_hook = None
+ """function hook to refresh API key if expired
+ """
+ self.username = username
+ """Username for HTTP basic authentication
+ """
+ self.password = password
+ """Password for HTTP basic authentication
+ """
+ self.discard_unknown_keys = discard_unknown_keys
+ self.disabled_client_side_validations = disabled_client_side_validations
+ self.logger = {}
+ """Logging Settings
+ """
+ self.logger["package_logger"] = logging.getLogger("petstore_api")
+ self.logger["urllib3_logger"] = logging.getLogger("urllib3")
+ self.logger_format = '%(asctime)s %(levelname)s %(message)s'
+ """Log format
+ """
+ self.logger_stream_handler = None
+ """Log stream handler
+ """
+ self.logger_file_handler = None
+ """Log file handler
+ """
+ self.logger_file = None
+ """Debug file location
+ """
+ self.debug = False
+ """Debug switch
+ """
+
+ self.verify_ssl = True
+ """SSL/TLS verification
+ Set this to false to skip verifying SSL certificate when calling API
+ from https server.
+ """
+ self.ssl_ca_cert = ssl_ca_cert
+ """Set this to customize the certificate file to verify the peer.
+ """
+ self.cert_file = None
+ """client certificate file
+ """
+ self.key_file = None
+ """client key file
+ """
+ self.assert_hostname = None
+ """Set this to True/False to enable/disable SSL hostname verification.
+ """
+
+ self.connection_pool_maxsize = multiprocessing.cpu_count() * 5
+ """urllib3 connection pool's maximum number of connections saved
+ per pool. urllib3 uses 1 connection as default value, but this is
+ not the best value when you are making a lot of possibly parallel
+ requests to the same host, which is often the case here.
+ cpu_count * 5 is used as default value to increase performance.
+ """
+
+ self.proxy = None
+ """Proxy URL
+ """
+ self.proxy_headers = None
+ """Proxy headers
+ """
+ self.safe_chars_for_path_param = ''
+ """Safe chars for path_param
+ """
+ self.retries = None
+ """Adding retries to override urllib3 default value 3
+ """
+ # Enable client side validation
+ self.client_side_validation = True
+
+ # Options to pass down to the underlying urllib3 socket
+ self.socket_options = None
+
+ def __deepcopy__(self, memo):
+ cls = self.__class__
+ result = cls.__new__(cls)
+ memo[id(self)] = result
+ for k, v in self.__dict__.items():
+ if k not in ('logger', 'logger_file_handler'):
+ setattr(result, k, copy.deepcopy(v, memo))
+ # shallow copy of loggers
+ result.logger = copy.copy(self.logger)
+ # use setters to configure loggers
+ result.logger_file = self.logger_file
+ result.debug = self.debug
+ return result
+
+ def __setattr__(self, name, value):
+ object.__setattr__(self, name, value)
+ if name == 'disabled_client_side_validations':
+ s = set(filter(None, value.split(',')))
+ for v in s:
+ if v not in JSON_SCHEMA_VALIDATION_KEYWORDS:
+ raise ApiValueError(
+ "Invalid keyword: '{0}''".format(v))
+ self._disabled_client_side_validations = s
+
+ @classmethod
+ def set_default(cls, default):
+ """Set default instance of configuration.
+
+ It stores default configuration, which can be
+ returned by get_default_copy method.
+
+ :param default: object of Configuration
+ """
+ cls._default = copy.deepcopy(default)
+
+ @classmethod
+ def get_default_copy(cls):
+ """Return new instance of configuration.
+
+ This method returns newly created, based on default constructor,
+ object of Configuration class or returns a copy of default
+ configuration passed by the set_default method.
+
+ :return: The configuration object.
+ """
+ if cls._default is not None:
+ return copy.deepcopy(cls._default)
+ return Configuration()
+
+ @property
+ def logger_file(self):
+ """The logger file.
+
+ If the logger_file is None, then add stream handler and remove file
+ handler. Otherwise, add file handler and remove stream handler.
+
+ :param value: The logger_file path.
+ :type: str
+ """
+ return self.__logger_file
+
+ @logger_file.setter
+ def logger_file(self, value):
+ """The logger file.
+
+ If the logger_file is None, then add stream handler and remove file
+ handler. Otherwise, add file handler and remove stream handler.
+
+ :param value: The logger_file path.
+ :type: str
+ """
+ self.__logger_file = value
+ if self.__logger_file:
+ # If set logging file,
+ # then add file handler and remove stream handler.
+ self.logger_file_handler = logging.FileHandler(self.__logger_file)
+ self.logger_file_handler.setFormatter(self.logger_formatter)
+ for _, logger in self.logger.items():
+ logger.addHandler(self.logger_file_handler)
+
+ @property
+ def debug(self):
+ """Debug status
+
+ :param value: The debug status, True or False.
+ :type: bool
+ """
+ return self.__debug
+
+ @debug.setter
+ def debug(self, value):
+ """Debug status
+
+ :param value: The debug status, True or False.
+ :type: bool
+ """
+ self.__debug = value
+ if self.__debug:
+ # if debug status is True, turn on debug logging
+ for _, logger in self.logger.items():
+ logger.setLevel(logging.DEBUG)
+ # turn on http_client debug
+ http_client.HTTPConnection.debuglevel = 1
+ else:
+ # if debug status is False, turn off debug logging,
+ # setting log level to default `logging.WARNING`
+ for _, logger in self.logger.items():
+ logger.setLevel(logging.WARNING)
+ # turn off http_client debug
+ http_client.HTTPConnection.debuglevel = 0
+
+ @property
+ def logger_format(self):
+ """The logger format.
+
+ The logger_formatter will be updated when sets logger_format.
+
+ :param value: The format string.
+ :type: str
+ """
+ return self.__logger_format
+
+ @logger_format.setter
+ def logger_format(self, value):
+ """The logger format.
+
+ The logger_formatter will be updated when sets logger_format.
+
+ :param value: The format string.
+ :type: str
+ """
+ self.__logger_format = value
+ self.logger_formatter = logging.Formatter(self.__logger_format)
+
+ def get_api_key_with_prefix(self, identifier, alias=None):
+ """Gets API key (with prefix if set).
+
+ :param identifier: The identifier of apiKey.
+ :param alias: The alternative identifier of apiKey.
+ :return: The token for api key authentication.
+ """
+ if self.refresh_api_key_hook is not None:
+ self.refresh_api_key_hook(self)
+ key = self.api_key.get(identifier, self.api_key.get(alias) if alias is not None else None)
+ if key:
+ prefix = self.api_key_prefix.get(identifier)
+ if prefix:
+ return "%s %s" % (prefix, key)
+ else:
+ return key
+
+ def get_basic_auth_token(self):
+ """Gets HTTP basic authentication header (string).
+
+ :return: The token for basic HTTP authentication.
+ """
+ username = ""
+ if self.username is not None:
+ username = self.username
+ password = ""
+ if self.password is not None:
+ password = self.password
+ return urllib3.util.make_headers(
+ basic_auth=username + ':' + password
+ ).get('authorization')
+
+ def auth_settings(self):
+ """Gets Auth Settings dict for api client.
+
+ :return: The Auth Settings information dict.
+ """
+ auth = {}
+ if 'api_key' in self.api_key:
+ auth['api_key'] = {
+ 'type': 'api_key',
+ 'in': 'header',
+ 'key': 'api_key',
+ 'value': self.get_api_key_with_prefix(
+ 'api_key',
+ ),
+ }
+ if 'api_key_query' in self.api_key:
+ auth['api_key_query'] = {
+ 'type': 'api_key',
+ 'in': 'query',
+ 'key': 'api_key_query',
+ 'value': self.get_api_key_with_prefix(
+ 'api_key_query',
+ ),
+ }
+ if self.username is not None and self.password is not None:
+ auth['http_basic_test'] = {
+ 'type': 'basic',
+ 'in': 'header',
+ 'key': 'Authorization',
+ 'value': self.get_basic_auth_token()
+ }
+ if self.access_token is not None:
+ auth['petstore_auth'] = {
+ 'type': 'oauth2',
+ 'in': 'header',
+ 'key': 'Authorization',
+ 'value': 'Bearer ' + self.access_token
+ }
+ return auth
+
+ def to_debug_report(self):
+ """Gets the essential information for debugging.
+
+ :return: The report for debugging.
+ """
+ return "Python SDK Debug Report:\n"\
+ "OS: {env}\n"\
+ "Python Version: {pyversion}\n"\
+ "Version of the API: 1.0.0\n"\
+ "SDK Package Version: 1.0.0".\
+ format(env=sys.platform, pyversion=sys.version)
+
+ def get_host_settings(self):
+ """Gets an array of host settings
+
+ :return: An array of host settings
+ """
+ return [
+ {
+ 'url': "http://petstore.swagger.io:80/v2",
+ 'description': "No description provided",
+ }
+ ]
+
+ def get_host_from_settings(self, index, variables=None, servers=None):
+ """Gets host URL based on the index and variables
+ :param index: array index of the host settings
+ :param variables: hash of variable and the corresponding value
+ :param servers: an array of host settings or None
+ :return: URL based on host settings
+ """
+ if index is None:
+ return self._base_path
+
+ variables = {} if variables is None else variables
+ servers = self.get_host_settings() if servers is None else servers
+
+ try:
+ server = servers[index]
+ except IndexError:
+ raise ValueError(
+ "Invalid index {0} when selecting the host settings. "
+ "Must be less than {1}".format(index, len(servers)))
+
+ url = server['url']
+
+ # go through variables and replace placeholders
+ for variable_name, variable in server.get('variables', {}).items():
+ used_value = variables.get(
+ variable_name, variable['default_value'])
+
+ if 'enum_values' in variable \
+ and used_value not in variable['enum_values']:
+ raise ValueError(
+ "The variable `{0}` in the host URL has invalid value "
+ "{1}. Must be {2}.".format(
+ variable_name, variables[variable_name],
+ variable['enum_values']))
+
+ url = url.replace("{" + variable_name + "}", used_value)
+
+ return url
+
+ @property
+ def host(self):
+ """Return generated host."""
+ return self.get_host_from_settings(self.server_index, variables=self.server_variables)
+
+ @host.setter
+ def host(self, value):
+ """Fix base path."""
+ self._base_path = value
+ self.server_index = None
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/exceptions.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/exceptions.py
new file mode 100644
index 000000000000..51527f606112
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/exceptions.py
@@ -0,0 +1,159 @@
+"""
+ 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: https://openapi-generator.tech
+"""
+
+
+
+class OpenApiException(Exception):
+ """The base exception class for all OpenAPIExceptions"""
+
+
+class ApiTypeError(OpenApiException, TypeError):
+ def __init__(self, msg, path_to_item=None, valid_classes=None,
+ key_type=None):
+ """ Raises an exception for TypeErrors
+
+ Args:
+ msg (str): the exception message
+
+ Keyword Args:
+ path_to_item (list): a list of keys an indices to get to the
+ current_item
+ None if unset
+ valid_classes (tuple): the primitive classes that current item
+ should be an instance of
+ None if unset
+ key_type (bool): False if our value is a value in a dict
+ True if it is a key in a dict
+ False if our item is an item in a list
+ None if unset
+ """
+ self.path_to_item = path_to_item
+ self.valid_classes = valid_classes
+ self.key_type = key_type
+ full_msg = msg
+ if path_to_item:
+ full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
+ super(ApiTypeError, self).__init__(full_msg)
+
+
+class ApiValueError(OpenApiException, ValueError):
+ def __init__(self, msg, path_to_item=None):
+ """
+ Args:
+ msg (str): the exception message
+
+ Keyword Args:
+ path_to_item (list) the path to the exception in the
+ received_data dict. None if unset
+ """
+
+ self.path_to_item = path_to_item
+ full_msg = msg
+ if path_to_item:
+ full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
+ super(ApiValueError, self).__init__(full_msg)
+
+
+class ApiAttributeError(OpenApiException, AttributeError):
+ def __init__(self, msg, path_to_item=None):
+ """
+ Raised when an attribute reference or assignment fails.
+
+ Args:
+ msg (str): the exception message
+
+ Keyword Args:
+ path_to_item (None/list) the path to the exception in the
+ received_data dict
+ """
+ self.path_to_item = path_to_item
+ full_msg = msg
+ if path_to_item:
+ full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
+ super(ApiAttributeError, self).__init__(full_msg)
+
+
+class ApiKeyError(OpenApiException, KeyError):
+ def __init__(self, msg, path_to_item=None):
+ """
+ Args:
+ msg (str): the exception message
+
+ Keyword Args:
+ path_to_item (None/list) the path to the exception in the
+ received_data dict
+ """
+ self.path_to_item = path_to_item
+ full_msg = msg
+ if path_to_item:
+ full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
+ super(ApiKeyError, self).__init__(full_msg)
+
+
+class ApiException(OpenApiException):
+
+ def __init__(self, status=None, reason=None, http_resp=None):
+ if http_resp:
+ self.status = http_resp.status
+ self.reason = http_resp.reason
+ self.body = http_resp.data
+ self.headers = http_resp.getheaders()
+ else:
+ self.status = status
+ self.reason = reason
+ self.body = None
+ self.headers = None
+
+ def __str__(self):
+ """Custom error messages for exception"""
+ error_message = "({0})\n"\
+ "Reason: {1}\n".format(self.status, self.reason)
+ if self.headers:
+ error_message += "HTTP response headers: {0}\n".format(
+ self.headers)
+
+ if self.body:
+ error_message += "HTTP response body: {0}\n".format(self.body)
+
+ return error_message
+
+
+class NotFoundException(ApiException):
+
+ def __init__(self, status=None, reason=None, http_resp=None):
+ super(NotFoundException, self).__init__(status, reason, http_resp)
+
+
+class UnauthorizedException(ApiException):
+
+ def __init__(self, status=None, reason=None, http_resp=None):
+ super(UnauthorizedException, self).__init__(status, reason, http_resp)
+
+
+class ForbiddenException(ApiException):
+
+ def __init__(self, status=None, reason=None, http_resp=None):
+ super(ForbiddenException, self).__init__(status, reason, http_resp)
+
+
+class ServiceException(ApiException):
+
+ def __init__(self, status=None, reason=None, http_resp=None):
+ super(ServiceException, self).__init__(status, reason, http_resp)
+
+
+def render_path(path_to_item):
+ """Returns a string representation of a path"""
+ result = ""
+ for pth in path_to_item:
+ if isinstance(pth, int):
+ result += "[{0}]".format(pth)
+ else:
+ result += "['{0}']".format(pth)
+ return result
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/__init__.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/__init__.py
new file mode 100644
index 000000000000..cfe32b784926
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/__init__.py
@@ -0,0 +1,5 @@
+# we can not import model classes here because that would create a circular
+# reference which would not work in python2
+# do not import all models into this module because that uses a lot of memory and stack frames
+# if you need the ability to import all models from one package, import them with
+# from {{packageName}.models import ModelA, ModelB
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/additional_properties_any_type.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/additional_properties_any_type.py
new file mode 100644
index 000000000000..7239795cf4af
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/additional_properties_any_type.py
@@ -0,0 +1,172 @@
+"""
+ 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: https://openapi-generator.tech
+"""
+
+
+import re # noqa: F401
+import sys # noqa: F401
+
+from petstore_api.model_utils import ( # noqa: F401
+ ApiTypeError,
+ ModelComposed,
+ ModelNormal,
+ ModelSimple,
+ cached_property,
+ change_keys_js_to_python,
+ convert_js_args_to_python_args,
+ date,
+ datetime,
+ file_type,
+ none_type,
+ validate_get_composed_info,
+)
+
+
+class AdditionalPropertiesAnyType(ModelNormal):
+ """NOTE: This class is auto generated by OpenAPI Generator.
+ Ref: https://openapi-generator.tech
+
+ Do not edit the class manually.
+
+ Attributes:
+ allowed_values (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ with a capitalized key describing the allowed value and an allowed
+ value. These dicts store the allowed enum values.
+ attribute_map (dict): The key is attribute name
+ and the value is json key in definition.
+ discriminator_value_class_map (dict): A dict to go from the discriminator
+ variable value to the discriminator class name.
+ validations (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ that stores validations for max_length, min_length, max_items,
+ min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
+ inclusive_minimum, and regex.
+ additional_properties_type (tuple): A tuple of classes accepted
+ as additional properties values.
+ """
+
+ allowed_values = {
+ }
+
+ validations = {
+ }
+
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
+
+ _nullable = False
+
+ @cached_property
+ def openapi_types():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+
+ Returns
+ openapi_types (dict): The key is attribute name
+ and the value is attribute type.
+ """
+ return {
+ 'name': (str,), # noqa: E501
+ }
+
+ @cached_property
+ def discriminator():
+ return None
+
+
+ attribute_map = {
+ 'name': 'name', # noqa: E501
+ }
+
+ _composed_schemas = {}
+
+ required_properties = set([
+ '_data_store',
+ '_check_type',
+ '_spec_property_naming',
+ '_path_to_item',
+ '_configuration',
+ '_visited_composed_classes',
+ ])
+
+ @convert_js_args_to_python_args
+ def __init__(self, *args, **kwargs): # noqa: E501
+ """AdditionalPropertiesAnyType - a model defined in OpenAPI
+
+ Keyword Args:
+ _check_type (bool): if True, values for parameters in openapi_types
+ will be type checked and a TypeError will be
+ raised if the wrong type is input.
+ Defaults to True
+ _path_to_item (tuple/list): This is a list of keys or values to
+ drill down to the model in received_data
+ when deserializing a response
+ _spec_property_naming (bool): True if the variable names in the input data
+ are serialized names, as specified in the OpenAPI document.
+ False if the variable names in the input data
+ are pythonic names, e.g. snake case (default)
+ _configuration (Configuration): the instance to use when
+ deserializing a file_type parameter.
+ If passed, type conversion is attempted
+ If omitted no type conversion is done.
+ _visited_composed_classes (tuple): This stores a tuple of
+ classes that we have traveled through so that
+ if we see that class again we will not use its
+ discriminator again.
+ When traveling through a discriminator, the
+ composed schema that is
+ is traveled through is added to this set.
+ For example if Animal has a discriminator
+ petType and we pass in "Dog", and the class Dog
+ allOf includes Animal, we move through Animal
+ once using the discriminator, and pick Dog.
+ Then in Dog, we will make an instance of the
+ Animal class but this time we won't travel
+ through its discriminator because we passed in
+ _visited_composed_classes = (Animal,)
+ name (str): [optional] # noqa: E501
+ """
+
+ _check_type = kwargs.pop('_check_type', True)
+ _spec_property_naming = kwargs.pop('_spec_property_naming', False)
+ _path_to_item = kwargs.pop('_path_to_item', ())
+ _configuration = kwargs.pop('_configuration', None)
+ _visited_composed_classes = kwargs.pop('_visited_composed_classes', ())
+
+ if args:
+ raise ApiTypeError(
+ "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % (
+ args,
+ self.__class__.__name__,
+ ),
+ path_to_item=_path_to_item,
+ valid_classes=(self.__class__,),
+ )
+
+ self._data_store = {}
+ self._check_type = _check_type
+ self._spec_property_naming = _spec_property_naming
+ self._path_to_item = _path_to_item
+ self._configuration = _configuration
+ self._visited_composed_classes = _visited_composed_classes + (self.__class__,)
+
+ for var_name, var_value in kwargs.items():
+ if var_name not in self.attribute_map and \
+ self._configuration is not None and \
+ self._configuration.discard_unknown_keys and \
+ self.additional_properties_type is None:
+ # discard variable.
+ continue
+ setattr(self, var_name, var_value)
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/additional_properties_array.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/additional_properties_array.py
new file mode 100644
index 000000000000..7d9403758a0d
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/additional_properties_array.py
@@ -0,0 +1,172 @@
+"""
+ 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: https://openapi-generator.tech
+"""
+
+
+import re # noqa: F401
+import sys # noqa: F401
+
+from petstore_api.model_utils import ( # noqa: F401
+ ApiTypeError,
+ ModelComposed,
+ ModelNormal,
+ ModelSimple,
+ cached_property,
+ change_keys_js_to_python,
+ convert_js_args_to_python_args,
+ date,
+ datetime,
+ file_type,
+ none_type,
+ validate_get_composed_info,
+)
+
+
+class AdditionalPropertiesArray(ModelNormal):
+ """NOTE: This class is auto generated by OpenAPI Generator.
+ Ref: https://openapi-generator.tech
+
+ Do not edit the class manually.
+
+ Attributes:
+ allowed_values (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ with a capitalized key describing the allowed value and an allowed
+ value. These dicts store the allowed enum values.
+ attribute_map (dict): The key is attribute name
+ and the value is json key in definition.
+ discriminator_value_class_map (dict): A dict to go from the discriminator
+ variable value to the discriminator class name.
+ validations (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ that stores validations for max_length, min_length, max_items,
+ min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
+ inclusive_minimum, and regex.
+ additional_properties_type (tuple): A tuple of classes accepted
+ as additional properties values.
+ """
+
+ allowed_values = {
+ }
+
+ validations = {
+ }
+
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ return ([bool, date, datetime, dict, float, int, list, str, none_type],) # noqa: E501
+
+ _nullable = False
+
+ @cached_property
+ def openapi_types():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+
+ Returns
+ openapi_types (dict): The key is attribute name
+ and the value is attribute type.
+ """
+ return {
+ 'name': (str,), # noqa: E501
+ }
+
+ @cached_property
+ def discriminator():
+ return None
+
+
+ attribute_map = {
+ 'name': 'name', # noqa: E501
+ }
+
+ _composed_schemas = {}
+
+ required_properties = set([
+ '_data_store',
+ '_check_type',
+ '_spec_property_naming',
+ '_path_to_item',
+ '_configuration',
+ '_visited_composed_classes',
+ ])
+
+ @convert_js_args_to_python_args
+ def __init__(self, *args, **kwargs): # noqa: E501
+ """AdditionalPropertiesArray - a model defined in OpenAPI
+
+ Keyword Args:
+ _check_type (bool): if True, values for parameters in openapi_types
+ will be type checked and a TypeError will be
+ raised if the wrong type is input.
+ Defaults to True
+ _path_to_item (tuple/list): This is a list of keys or values to
+ drill down to the model in received_data
+ when deserializing a response
+ _spec_property_naming (bool): True if the variable names in the input data
+ are serialized names, as specified in the OpenAPI document.
+ False if the variable names in the input data
+ are pythonic names, e.g. snake case (default)
+ _configuration (Configuration): the instance to use when
+ deserializing a file_type parameter.
+ If passed, type conversion is attempted
+ If omitted no type conversion is done.
+ _visited_composed_classes (tuple): This stores a tuple of
+ classes that we have traveled through so that
+ if we see that class again we will not use its
+ discriminator again.
+ When traveling through a discriminator, the
+ composed schema that is
+ is traveled through is added to this set.
+ For example if Animal has a discriminator
+ petType and we pass in "Dog", and the class Dog
+ allOf includes Animal, we move through Animal
+ once using the discriminator, and pick Dog.
+ Then in Dog, we will make an instance of the
+ Animal class but this time we won't travel
+ through its discriminator because we passed in
+ _visited_composed_classes = (Animal,)
+ name (str): [optional] # noqa: E501
+ """
+
+ _check_type = kwargs.pop('_check_type', True)
+ _spec_property_naming = kwargs.pop('_spec_property_naming', False)
+ _path_to_item = kwargs.pop('_path_to_item', ())
+ _configuration = kwargs.pop('_configuration', None)
+ _visited_composed_classes = kwargs.pop('_visited_composed_classes', ())
+
+ if args:
+ raise ApiTypeError(
+ "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % (
+ args,
+ self.__class__.__name__,
+ ),
+ path_to_item=_path_to_item,
+ valid_classes=(self.__class__,),
+ )
+
+ self._data_store = {}
+ self._check_type = _check_type
+ self._spec_property_naming = _spec_property_naming
+ self._path_to_item = _path_to_item
+ self._configuration = _configuration
+ self._visited_composed_classes = _visited_composed_classes + (self.__class__,)
+
+ for var_name, var_value in kwargs.items():
+ if var_name not in self.attribute_map and \
+ self._configuration is not None and \
+ self._configuration.discard_unknown_keys and \
+ self.additional_properties_type is None:
+ # discard variable.
+ continue
+ setattr(self, var_name, var_value)
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/additional_properties_boolean.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/additional_properties_boolean.py
new file mode 100644
index 000000000000..ca129b766ec5
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/additional_properties_boolean.py
@@ -0,0 +1,172 @@
+"""
+ 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: https://openapi-generator.tech
+"""
+
+
+import re # noqa: F401
+import sys # noqa: F401
+
+from petstore_api.model_utils import ( # noqa: F401
+ ApiTypeError,
+ ModelComposed,
+ ModelNormal,
+ ModelSimple,
+ cached_property,
+ change_keys_js_to_python,
+ convert_js_args_to_python_args,
+ date,
+ datetime,
+ file_type,
+ none_type,
+ validate_get_composed_info,
+)
+
+
+class AdditionalPropertiesBoolean(ModelNormal):
+ """NOTE: This class is auto generated by OpenAPI Generator.
+ Ref: https://openapi-generator.tech
+
+ Do not edit the class manually.
+
+ Attributes:
+ allowed_values (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ with a capitalized key describing the allowed value and an allowed
+ value. These dicts store the allowed enum values.
+ attribute_map (dict): The key is attribute name
+ and the value is json key in definition.
+ discriminator_value_class_map (dict): A dict to go from the discriminator
+ variable value to the discriminator class name.
+ validations (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ that stores validations for max_length, min_length, max_items,
+ min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
+ inclusive_minimum, and regex.
+ additional_properties_type (tuple): A tuple of classes accepted
+ as additional properties values.
+ """
+
+ allowed_values = {
+ }
+
+ validations = {
+ }
+
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ return (bool,) # noqa: E501
+
+ _nullable = False
+
+ @cached_property
+ def openapi_types():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+
+ Returns
+ openapi_types (dict): The key is attribute name
+ and the value is attribute type.
+ """
+ return {
+ 'name': (str,), # noqa: E501
+ }
+
+ @cached_property
+ def discriminator():
+ return None
+
+
+ attribute_map = {
+ 'name': 'name', # noqa: E501
+ }
+
+ _composed_schemas = {}
+
+ required_properties = set([
+ '_data_store',
+ '_check_type',
+ '_spec_property_naming',
+ '_path_to_item',
+ '_configuration',
+ '_visited_composed_classes',
+ ])
+
+ @convert_js_args_to_python_args
+ def __init__(self, *args, **kwargs): # noqa: E501
+ """AdditionalPropertiesBoolean - a model defined in OpenAPI
+
+ Keyword Args:
+ _check_type (bool): if True, values for parameters in openapi_types
+ will be type checked and a TypeError will be
+ raised if the wrong type is input.
+ Defaults to True
+ _path_to_item (tuple/list): This is a list of keys or values to
+ drill down to the model in received_data
+ when deserializing a response
+ _spec_property_naming (bool): True if the variable names in the input data
+ are serialized names, as specified in the OpenAPI document.
+ False if the variable names in the input data
+ are pythonic names, e.g. snake case (default)
+ _configuration (Configuration): the instance to use when
+ deserializing a file_type parameter.
+ If passed, type conversion is attempted
+ If omitted no type conversion is done.
+ _visited_composed_classes (tuple): This stores a tuple of
+ classes that we have traveled through so that
+ if we see that class again we will not use its
+ discriminator again.
+ When traveling through a discriminator, the
+ composed schema that is
+ is traveled through is added to this set.
+ For example if Animal has a discriminator
+ petType and we pass in "Dog", and the class Dog
+ allOf includes Animal, we move through Animal
+ once using the discriminator, and pick Dog.
+ Then in Dog, we will make an instance of the
+ Animal class but this time we won't travel
+ through its discriminator because we passed in
+ _visited_composed_classes = (Animal,)
+ name (str): [optional] # noqa: E501
+ """
+
+ _check_type = kwargs.pop('_check_type', True)
+ _spec_property_naming = kwargs.pop('_spec_property_naming', False)
+ _path_to_item = kwargs.pop('_path_to_item', ())
+ _configuration = kwargs.pop('_configuration', None)
+ _visited_composed_classes = kwargs.pop('_visited_composed_classes', ())
+
+ if args:
+ raise ApiTypeError(
+ "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % (
+ args,
+ self.__class__.__name__,
+ ),
+ path_to_item=_path_to_item,
+ valid_classes=(self.__class__,),
+ )
+
+ self._data_store = {}
+ self._check_type = _check_type
+ self._spec_property_naming = _spec_property_naming
+ self._path_to_item = _path_to_item
+ self._configuration = _configuration
+ self._visited_composed_classes = _visited_composed_classes + (self.__class__,)
+
+ for var_name, var_value in kwargs.items():
+ if var_name not in self.attribute_map and \
+ self._configuration is not None and \
+ self._configuration.discard_unknown_keys and \
+ self.additional_properties_type is None:
+ # discard variable.
+ continue
+ setattr(self, var_name, var_value)
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/additional_properties_class.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/additional_properties_class.py
new file mode 100644
index 000000000000..292f467aaa8a
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/additional_properties_class.py
@@ -0,0 +1,196 @@
+"""
+ 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: https://openapi-generator.tech
+"""
+
+
+import re # noqa: F401
+import sys # noqa: F401
+
+from petstore_api.model_utils import ( # noqa: F401
+ ApiTypeError,
+ ModelComposed,
+ ModelNormal,
+ ModelSimple,
+ cached_property,
+ change_keys_js_to_python,
+ convert_js_args_to_python_args,
+ date,
+ datetime,
+ file_type,
+ none_type,
+ validate_get_composed_info,
+)
+
+
+class AdditionalPropertiesClass(ModelNormal):
+ """NOTE: This class is auto generated by OpenAPI Generator.
+ Ref: https://openapi-generator.tech
+
+ Do not edit the class manually.
+
+ Attributes:
+ allowed_values (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ with a capitalized key describing the allowed value and an allowed
+ value. These dicts store the allowed enum values.
+ attribute_map (dict): The key is attribute name
+ and the value is json key in definition.
+ discriminator_value_class_map (dict): A dict to go from the discriminator
+ variable value to the discriminator class name.
+ validations (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ that stores validations for max_length, min_length, max_items,
+ min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
+ inclusive_minimum, and regex.
+ additional_properties_type (tuple): A tuple of classes accepted
+ as additional properties values.
+ """
+
+ allowed_values = {
+ }
+
+ validations = {
+ }
+
+ additional_properties_type = None
+
+ _nullable = False
+
+ @cached_property
+ def openapi_types():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+
+ Returns
+ openapi_types (dict): The key is attribute name
+ and the value is attribute type.
+ """
+ return {
+ 'map_string': ({str: (str,)},), # noqa: E501
+ 'map_number': ({str: (float,)},), # noqa: E501
+ 'map_integer': ({str: (int,)},), # noqa: E501
+ 'map_boolean': ({str: (bool,)},), # noqa: E501
+ 'map_array_integer': ({str: ([int],)},), # noqa: E501
+ 'map_array_anytype': ({str: ([bool, date, datetime, dict, float, int, list, str, none_type],)},), # noqa: E501
+ 'map_map_string': ({str: ({str: (str,)},)},), # noqa: E501
+ 'map_map_anytype': ({str: ({str: (bool, date, datetime, dict, float, int, list, str, none_type,)},)},), # noqa: E501
+ 'anytype_1': (bool, date, datetime, dict, float, int, list, str, none_type,), # noqa: E501
+ 'anytype_2': (bool, date, datetime, dict, float, int, list, str, none_type,), # noqa: E501
+ 'anytype_3': (bool, date, datetime, dict, float, int, list, str, none_type,), # noqa: E501
+ }
+
+ @cached_property
+ def discriminator():
+ return None
+
+
+ attribute_map = {
+ 'map_string': 'map_string', # noqa: E501
+ 'map_number': 'map_number', # noqa: E501
+ 'map_integer': 'map_integer', # noqa: E501
+ 'map_boolean': 'map_boolean', # noqa: E501
+ 'map_array_integer': 'map_array_integer', # noqa: E501
+ 'map_array_anytype': 'map_array_anytype', # noqa: E501
+ 'map_map_string': 'map_map_string', # noqa: E501
+ 'map_map_anytype': 'map_map_anytype', # noqa: E501
+ 'anytype_1': 'anytype_1', # noqa: E501
+ 'anytype_2': 'anytype_2', # noqa: E501
+ 'anytype_3': 'anytype_3', # noqa: E501
+ }
+
+ _composed_schemas = {}
+
+ required_properties = set([
+ '_data_store',
+ '_check_type',
+ '_spec_property_naming',
+ '_path_to_item',
+ '_configuration',
+ '_visited_composed_classes',
+ ])
+
+ @convert_js_args_to_python_args
+ def __init__(self, *args, **kwargs): # noqa: E501
+ """AdditionalPropertiesClass - a model defined in OpenAPI
+
+ Keyword Args:
+ _check_type (bool): if True, values for parameters in openapi_types
+ will be type checked and a TypeError will be
+ raised if the wrong type is input.
+ Defaults to True
+ _path_to_item (tuple/list): This is a list of keys or values to
+ drill down to the model in received_data
+ when deserializing a response
+ _spec_property_naming (bool): True if the variable names in the input data
+ are serialized names, as specified in the OpenAPI document.
+ False if the variable names in the input data
+ are pythonic names, e.g. snake case (default)
+ _configuration (Configuration): the instance to use when
+ deserializing a file_type parameter.
+ If passed, type conversion is attempted
+ If omitted no type conversion is done.
+ _visited_composed_classes (tuple): This stores a tuple of
+ classes that we have traveled through so that
+ if we see that class again we will not use its
+ discriminator again.
+ When traveling through a discriminator, the
+ composed schema that is
+ is traveled through is added to this set.
+ For example if Animal has a discriminator
+ petType and we pass in "Dog", and the class Dog
+ allOf includes Animal, we move through Animal
+ once using the discriminator, and pick Dog.
+ Then in Dog, we will make an instance of the
+ Animal class but this time we won't travel
+ through its discriminator because we passed in
+ _visited_composed_classes = (Animal,)
+ map_string ({str: (str,)}): [optional] # noqa: E501
+ map_number ({str: (float,)}): [optional] # noqa: E501
+ map_integer ({str: (int,)}): [optional] # noqa: E501
+ map_boolean ({str: (bool,)}): [optional] # noqa: E501
+ map_array_integer ({str: ([int],)}): [optional] # noqa: E501
+ map_array_anytype ({str: ([bool, date, datetime, dict, float, int, list, str, none_type],)}): [optional] # noqa: E501
+ map_map_string ({str: ({str: (str,)},)}): [optional] # noqa: E501
+ map_map_anytype ({str: ({str: (bool, date, datetime, dict, float, int, list, str, none_type,)},)}): [optional] # noqa: E501
+ anytype_1 (bool, date, datetime, dict, float, int, list, str, none_type): [optional] # noqa: E501
+ anytype_2 (bool, date, datetime, dict, float, int, list, str, none_type): no type is set for this. [optional] # noqa: E501
+ anytype_3 (bool, date, datetime, dict, float, int, list, str, none_type): because of a bug in swagger-parser, this should have values {str: (str, int, float...)} but instead we get any type. See https://github.com/swagger-api/swagger-parser/issues/1378. [optional] # noqa: E501
+ """
+
+ _check_type = kwargs.pop('_check_type', True)
+ _spec_property_naming = kwargs.pop('_spec_property_naming', False)
+ _path_to_item = kwargs.pop('_path_to_item', ())
+ _configuration = kwargs.pop('_configuration', None)
+ _visited_composed_classes = kwargs.pop('_visited_composed_classes', ())
+
+ if args:
+ raise ApiTypeError(
+ "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % (
+ args,
+ self.__class__.__name__,
+ ),
+ path_to_item=_path_to_item,
+ valid_classes=(self.__class__,),
+ )
+
+ self._data_store = {}
+ self._check_type = _check_type
+ self._spec_property_naming = _spec_property_naming
+ self._path_to_item = _path_to_item
+ self._configuration = _configuration
+ self._visited_composed_classes = _visited_composed_classes + (self.__class__,)
+
+ for var_name, var_value in kwargs.items():
+ if var_name not in self.attribute_map and \
+ self._configuration is not None and \
+ self._configuration.discard_unknown_keys and \
+ self.additional_properties_type is None:
+ # discard variable.
+ continue
+ setattr(self, var_name, var_value)
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/additional_properties_integer.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/additional_properties_integer.py
new file mode 100644
index 000000000000..87d78bf36005
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/additional_properties_integer.py
@@ -0,0 +1,172 @@
+"""
+ 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: https://openapi-generator.tech
+"""
+
+
+import re # noqa: F401
+import sys # noqa: F401
+
+from petstore_api.model_utils import ( # noqa: F401
+ ApiTypeError,
+ ModelComposed,
+ ModelNormal,
+ ModelSimple,
+ cached_property,
+ change_keys_js_to_python,
+ convert_js_args_to_python_args,
+ date,
+ datetime,
+ file_type,
+ none_type,
+ validate_get_composed_info,
+)
+
+
+class AdditionalPropertiesInteger(ModelNormal):
+ """NOTE: This class is auto generated by OpenAPI Generator.
+ Ref: https://openapi-generator.tech
+
+ Do not edit the class manually.
+
+ Attributes:
+ allowed_values (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ with a capitalized key describing the allowed value and an allowed
+ value. These dicts store the allowed enum values.
+ attribute_map (dict): The key is attribute name
+ and the value is json key in definition.
+ discriminator_value_class_map (dict): A dict to go from the discriminator
+ variable value to the discriminator class name.
+ validations (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ that stores validations for max_length, min_length, max_items,
+ min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
+ inclusive_minimum, and regex.
+ additional_properties_type (tuple): A tuple of classes accepted
+ as additional properties values.
+ """
+
+ allowed_values = {
+ }
+
+ validations = {
+ }
+
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ return (int,) # noqa: E501
+
+ _nullable = False
+
+ @cached_property
+ def openapi_types():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+
+ Returns
+ openapi_types (dict): The key is attribute name
+ and the value is attribute type.
+ """
+ return {
+ 'name': (str,), # noqa: E501
+ }
+
+ @cached_property
+ def discriminator():
+ return None
+
+
+ attribute_map = {
+ 'name': 'name', # noqa: E501
+ }
+
+ _composed_schemas = {}
+
+ required_properties = set([
+ '_data_store',
+ '_check_type',
+ '_spec_property_naming',
+ '_path_to_item',
+ '_configuration',
+ '_visited_composed_classes',
+ ])
+
+ @convert_js_args_to_python_args
+ def __init__(self, *args, **kwargs): # noqa: E501
+ """AdditionalPropertiesInteger - a model defined in OpenAPI
+
+ Keyword Args:
+ _check_type (bool): if True, values for parameters in openapi_types
+ will be type checked and a TypeError will be
+ raised if the wrong type is input.
+ Defaults to True
+ _path_to_item (tuple/list): This is a list of keys or values to
+ drill down to the model in received_data
+ when deserializing a response
+ _spec_property_naming (bool): True if the variable names in the input data
+ are serialized names, as specified in the OpenAPI document.
+ False if the variable names in the input data
+ are pythonic names, e.g. snake case (default)
+ _configuration (Configuration): the instance to use when
+ deserializing a file_type parameter.
+ If passed, type conversion is attempted
+ If omitted no type conversion is done.
+ _visited_composed_classes (tuple): This stores a tuple of
+ classes that we have traveled through so that
+ if we see that class again we will not use its
+ discriminator again.
+ When traveling through a discriminator, the
+ composed schema that is
+ is traveled through is added to this set.
+ For example if Animal has a discriminator
+ petType and we pass in "Dog", and the class Dog
+ allOf includes Animal, we move through Animal
+ once using the discriminator, and pick Dog.
+ Then in Dog, we will make an instance of the
+ Animal class but this time we won't travel
+ through its discriminator because we passed in
+ _visited_composed_classes = (Animal,)
+ name (str): [optional] # noqa: E501
+ """
+
+ _check_type = kwargs.pop('_check_type', True)
+ _spec_property_naming = kwargs.pop('_spec_property_naming', False)
+ _path_to_item = kwargs.pop('_path_to_item', ())
+ _configuration = kwargs.pop('_configuration', None)
+ _visited_composed_classes = kwargs.pop('_visited_composed_classes', ())
+
+ if args:
+ raise ApiTypeError(
+ "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % (
+ args,
+ self.__class__.__name__,
+ ),
+ path_to_item=_path_to_item,
+ valid_classes=(self.__class__,),
+ )
+
+ self._data_store = {}
+ self._check_type = _check_type
+ self._spec_property_naming = _spec_property_naming
+ self._path_to_item = _path_to_item
+ self._configuration = _configuration
+ self._visited_composed_classes = _visited_composed_classes + (self.__class__,)
+
+ for var_name, var_value in kwargs.items():
+ if var_name not in self.attribute_map and \
+ self._configuration is not None and \
+ self._configuration.discard_unknown_keys and \
+ self.additional_properties_type is None:
+ # discard variable.
+ continue
+ setattr(self, var_name, var_value)
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/additional_properties_number.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/additional_properties_number.py
new file mode 100644
index 000000000000..b10bd036ff3f
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/additional_properties_number.py
@@ -0,0 +1,172 @@
+"""
+ 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: https://openapi-generator.tech
+"""
+
+
+import re # noqa: F401
+import sys # noqa: F401
+
+from petstore_api.model_utils import ( # noqa: F401
+ ApiTypeError,
+ ModelComposed,
+ ModelNormal,
+ ModelSimple,
+ cached_property,
+ change_keys_js_to_python,
+ convert_js_args_to_python_args,
+ date,
+ datetime,
+ file_type,
+ none_type,
+ validate_get_composed_info,
+)
+
+
+class AdditionalPropertiesNumber(ModelNormal):
+ """NOTE: This class is auto generated by OpenAPI Generator.
+ Ref: https://openapi-generator.tech
+
+ Do not edit the class manually.
+
+ Attributes:
+ allowed_values (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ with a capitalized key describing the allowed value and an allowed
+ value. These dicts store the allowed enum values.
+ attribute_map (dict): The key is attribute name
+ and the value is json key in definition.
+ discriminator_value_class_map (dict): A dict to go from the discriminator
+ variable value to the discriminator class name.
+ validations (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ that stores validations for max_length, min_length, max_items,
+ min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
+ inclusive_minimum, and regex.
+ additional_properties_type (tuple): A tuple of classes accepted
+ as additional properties values.
+ """
+
+ allowed_values = {
+ }
+
+ validations = {
+ }
+
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ return (float,) # noqa: E501
+
+ _nullable = False
+
+ @cached_property
+ def openapi_types():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+
+ Returns
+ openapi_types (dict): The key is attribute name
+ and the value is attribute type.
+ """
+ return {
+ 'name': (str,), # noqa: E501
+ }
+
+ @cached_property
+ def discriminator():
+ return None
+
+
+ attribute_map = {
+ 'name': 'name', # noqa: E501
+ }
+
+ _composed_schemas = {}
+
+ required_properties = set([
+ '_data_store',
+ '_check_type',
+ '_spec_property_naming',
+ '_path_to_item',
+ '_configuration',
+ '_visited_composed_classes',
+ ])
+
+ @convert_js_args_to_python_args
+ def __init__(self, *args, **kwargs): # noqa: E501
+ """AdditionalPropertiesNumber - a model defined in OpenAPI
+
+ Keyword Args:
+ _check_type (bool): if True, values for parameters in openapi_types
+ will be type checked and a TypeError will be
+ raised if the wrong type is input.
+ Defaults to True
+ _path_to_item (tuple/list): This is a list of keys or values to
+ drill down to the model in received_data
+ when deserializing a response
+ _spec_property_naming (bool): True if the variable names in the input data
+ are serialized names, as specified in the OpenAPI document.
+ False if the variable names in the input data
+ are pythonic names, e.g. snake case (default)
+ _configuration (Configuration): the instance to use when
+ deserializing a file_type parameter.
+ If passed, type conversion is attempted
+ If omitted no type conversion is done.
+ _visited_composed_classes (tuple): This stores a tuple of
+ classes that we have traveled through so that
+ if we see that class again we will not use its
+ discriminator again.
+ When traveling through a discriminator, the
+ composed schema that is
+ is traveled through is added to this set.
+ For example if Animal has a discriminator
+ petType and we pass in "Dog", and the class Dog
+ allOf includes Animal, we move through Animal
+ once using the discriminator, and pick Dog.
+ Then in Dog, we will make an instance of the
+ Animal class but this time we won't travel
+ through its discriminator because we passed in
+ _visited_composed_classes = (Animal,)
+ name (str): [optional] # noqa: E501
+ """
+
+ _check_type = kwargs.pop('_check_type', True)
+ _spec_property_naming = kwargs.pop('_spec_property_naming', False)
+ _path_to_item = kwargs.pop('_path_to_item', ())
+ _configuration = kwargs.pop('_configuration', None)
+ _visited_composed_classes = kwargs.pop('_visited_composed_classes', ())
+
+ if args:
+ raise ApiTypeError(
+ "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % (
+ args,
+ self.__class__.__name__,
+ ),
+ path_to_item=_path_to_item,
+ valid_classes=(self.__class__,),
+ )
+
+ self._data_store = {}
+ self._check_type = _check_type
+ self._spec_property_naming = _spec_property_naming
+ self._path_to_item = _path_to_item
+ self._configuration = _configuration
+ self._visited_composed_classes = _visited_composed_classes + (self.__class__,)
+
+ for var_name, var_value in kwargs.items():
+ if var_name not in self.attribute_map and \
+ self._configuration is not None and \
+ self._configuration.discard_unknown_keys and \
+ self.additional_properties_type is None:
+ # discard variable.
+ continue
+ setattr(self, var_name, var_value)
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/additional_properties_object.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/additional_properties_object.py
new file mode 100644
index 000000000000..000653f13a73
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/additional_properties_object.py
@@ -0,0 +1,172 @@
+"""
+ 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: https://openapi-generator.tech
+"""
+
+
+import re # noqa: F401
+import sys # noqa: F401
+
+from petstore_api.model_utils import ( # noqa: F401
+ ApiTypeError,
+ ModelComposed,
+ ModelNormal,
+ ModelSimple,
+ cached_property,
+ change_keys_js_to_python,
+ convert_js_args_to_python_args,
+ date,
+ datetime,
+ file_type,
+ none_type,
+ validate_get_composed_info,
+)
+
+
+class AdditionalPropertiesObject(ModelNormal):
+ """NOTE: This class is auto generated by OpenAPI Generator.
+ Ref: https://openapi-generator.tech
+
+ Do not edit the class manually.
+
+ Attributes:
+ allowed_values (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ with a capitalized key describing the allowed value and an allowed
+ value. These dicts store the allowed enum values.
+ attribute_map (dict): The key is attribute name
+ and the value is json key in definition.
+ discriminator_value_class_map (dict): A dict to go from the discriminator
+ variable value to the discriminator class name.
+ validations (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ that stores validations for max_length, min_length, max_items,
+ min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
+ inclusive_minimum, and regex.
+ additional_properties_type (tuple): A tuple of classes accepted
+ as additional properties values.
+ """
+
+ allowed_values = {
+ }
+
+ validations = {
+ }
+
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ return ({str: (bool, date, datetime, dict, float, int, list, str, none_type,)},) # noqa: E501
+
+ _nullable = False
+
+ @cached_property
+ def openapi_types():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+
+ Returns
+ openapi_types (dict): The key is attribute name
+ and the value is attribute type.
+ """
+ return {
+ 'name': (str,), # noqa: E501
+ }
+
+ @cached_property
+ def discriminator():
+ return None
+
+
+ attribute_map = {
+ 'name': 'name', # noqa: E501
+ }
+
+ _composed_schemas = {}
+
+ required_properties = set([
+ '_data_store',
+ '_check_type',
+ '_spec_property_naming',
+ '_path_to_item',
+ '_configuration',
+ '_visited_composed_classes',
+ ])
+
+ @convert_js_args_to_python_args
+ def __init__(self, *args, **kwargs): # noqa: E501
+ """AdditionalPropertiesObject - a model defined in OpenAPI
+
+ Keyword Args:
+ _check_type (bool): if True, values for parameters in openapi_types
+ will be type checked and a TypeError will be
+ raised if the wrong type is input.
+ Defaults to True
+ _path_to_item (tuple/list): This is a list of keys or values to
+ drill down to the model in received_data
+ when deserializing a response
+ _spec_property_naming (bool): True if the variable names in the input data
+ are serialized names, as specified in the OpenAPI document.
+ False if the variable names in the input data
+ are pythonic names, e.g. snake case (default)
+ _configuration (Configuration): the instance to use when
+ deserializing a file_type parameter.
+ If passed, type conversion is attempted
+ If omitted no type conversion is done.
+ _visited_composed_classes (tuple): This stores a tuple of
+ classes that we have traveled through so that
+ if we see that class again we will not use its
+ discriminator again.
+ When traveling through a discriminator, the
+ composed schema that is
+ is traveled through is added to this set.
+ For example if Animal has a discriminator
+ petType and we pass in "Dog", and the class Dog
+ allOf includes Animal, we move through Animal
+ once using the discriminator, and pick Dog.
+ Then in Dog, we will make an instance of the
+ Animal class but this time we won't travel
+ through its discriminator because we passed in
+ _visited_composed_classes = (Animal,)
+ name (str): [optional] # noqa: E501
+ """
+
+ _check_type = kwargs.pop('_check_type', True)
+ _spec_property_naming = kwargs.pop('_spec_property_naming', False)
+ _path_to_item = kwargs.pop('_path_to_item', ())
+ _configuration = kwargs.pop('_configuration', None)
+ _visited_composed_classes = kwargs.pop('_visited_composed_classes', ())
+
+ if args:
+ raise ApiTypeError(
+ "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % (
+ args,
+ self.__class__.__name__,
+ ),
+ path_to_item=_path_to_item,
+ valid_classes=(self.__class__,),
+ )
+
+ self._data_store = {}
+ self._check_type = _check_type
+ self._spec_property_naming = _spec_property_naming
+ self._path_to_item = _path_to_item
+ self._configuration = _configuration
+ self._visited_composed_classes = _visited_composed_classes + (self.__class__,)
+
+ for var_name, var_value in kwargs.items():
+ if var_name not in self.attribute_map and \
+ self._configuration is not None and \
+ self._configuration.discard_unknown_keys and \
+ self.additional_properties_type is None:
+ # discard variable.
+ continue
+ setattr(self, var_name, var_value)
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/additional_properties_string.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/additional_properties_string.py
new file mode 100644
index 000000000000..7f1f94aa6b6b
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/additional_properties_string.py
@@ -0,0 +1,172 @@
+"""
+ 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: https://openapi-generator.tech
+"""
+
+
+import re # noqa: F401
+import sys # noqa: F401
+
+from petstore_api.model_utils import ( # noqa: F401
+ ApiTypeError,
+ ModelComposed,
+ ModelNormal,
+ ModelSimple,
+ cached_property,
+ change_keys_js_to_python,
+ convert_js_args_to_python_args,
+ date,
+ datetime,
+ file_type,
+ none_type,
+ validate_get_composed_info,
+)
+
+
+class AdditionalPropertiesString(ModelNormal):
+ """NOTE: This class is auto generated by OpenAPI Generator.
+ Ref: https://openapi-generator.tech
+
+ Do not edit the class manually.
+
+ Attributes:
+ allowed_values (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ with a capitalized key describing the allowed value and an allowed
+ value. These dicts store the allowed enum values.
+ attribute_map (dict): The key is attribute name
+ and the value is json key in definition.
+ discriminator_value_class_map (dict): A dict to go from the discriminator
+ variable value to the discriminator class name.
+ validations (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ that stores validations for max_length, min_length, max_items,
+ min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
+ inclusive_minimum, and regex.
+ additional_properties_type (tuple): A tuple of classes accepted
+ as additional properties values.
+ """
+
+ allowed_values = {
+ }
+
+ validations = {
+ }
+
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ return (str,) # noqa: E501
+
+ _nullable = False
+
+ @cached_property
+ def openapi_types():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+
+ Returns
+ openapi_types (dict): The key is attribute name
+ and the value is attribute type.
+ """
+ return {
+ 'name': (str,), # noqa: E501
+ }
+
+ @cached_property
+ def discriminator():
+ return None
+
+
+ attribute_map = {
+ 'name': 'name', # noqa: E501
+ }
+
+ _composed_schemas = {}
+
+ required_properties = set([
+ '_data_store',
+ '_check_type',
+ '_spec_property_naming',
+ '_path_to_item',
+ '_configuration',
+ '_visited_composed_classes',
+ ])
+
+ @convert_js_args_to_python_args
+ def __init__(self, *args, **kwargs): # noqa: E501
+ """AdditionalPropertiesString - a model defined in OpenAPI
+
+ Keyword Args:
+ _check_type (bool): if True, values for parameters in openapi_types
+ will be type checked and a TypeError will be
+ raised if the wrong type is input.
+ Defaults to True
+ _path_to_item (tuple/list): This is a list of keys or values to
+ drill down to the model in received_data
+ when deserializing a response
+ _spec_property_naming (bool): True if the variable names in the input data
+ are serialized names, as specified in the OpenAPI document.
+ False if the variable names in the input data
+ are pythonic names, e.g. snake case (default)
+ _configuration (Configuration): the instance to use when
+ deserializing a file_type parameter.
+ If passed, type conversion is attempted
+ If omitted no type conversion is done.
+ _visited_composed_classes (tuple): This stores a tuple of
+ classes that we have traveled through so that
+ if we see that class again we will not use its
+ discriminator again.
+ When traveling through a discriminator, the
+ composed schema that is
+ is traveled through is added to this set.
+ For example if Animal has a discriminator
+ petType and we pass in "Dog", and the class Dog
+ allOf includes Animal, we move through Animal
+ once using the discriminator, and pick Dog.
+ Then in Dog, we will make an instance of the
+ Animal class but this time we won't travel
+ through its discriminator because we passed in
+ _visited_composed_classes = (Animal,)
+ name (str): [optional] # noqa: E501
+ """
+
+ _check_type = kwargs.pop('_check_type', True)
+ _spec_property_naming = kwargs.pop('_spec_property_naming', False)
+ _path_to_item = kwargs.pop('_path_to_item', ())
+ _configuration = kwargs.pop('_configuration', None)
+ _visited_composed_classes = kwargs.pop('_visited_composed_classes', ())
+
+ if args:
+ raise ApiTypeError(
+ "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % (
+ args,
+ self.__class__.__name__,
+ ),
+ path_to_item=_path_to_item,
+ valid_classes=(self.__class__,),
+ )
+
+ self._data_store = {}
+ self._check_type = _check_type
+ self._spec_property_naming = _spec_property_naming
+ self._path_to_item = _path_to_item
+ self._configuration = _configuration
+ self._visited_composed_classes = _visited_composed_classes + (self.__class__,)
+
+ for var_name, var_value in kwargs.items():
+ if var_name not in self.attribute_map and \
+ self._configuration is not None and \
+ self._configuration.discard_unknown_keys and \
+ self.additional_properties_type is None:
+ # discard variable.
+ continue
+ setattr(self, var_name, var_value)
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/animal.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/animal.py
new file mode 100644
index 000000000000..a3d48b6ea975
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/animal.py
@@ -0,0 +1,185 @@
+"""
+ 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: https://openapi-generator.tech
+"""
+
+
+import re # noqa: F401
+import sys # noqa: F401
+
+from petstore_api.model_utils import ( # noqa: F401
+ ApiTypeError,
+ ModelComposed,
+ ModelNormal,
+ ModelSimple,
+ cached_property,
+ change_keys_js_to_python,
+ convert_js_args_to_python_args,
+ date,
+ datetime,
+ file_type,
+ none_type,
+ validate_get_composed_info,
+)
+
+def lazy_import():
+ from petstore_api.model.cat import Cat
+ from petstore_api.model.dog import Dog
+ globals()['Cat'] = Cat
+ globals()['Dog'] = Dog
+
+
+class Animal(ModelNormal):
+ """NOTE: This class is auto generated by OpenAPI Generator.
+ Ref: https://openapi-generator.tech
+
+ Do not edit the class manually.
+
+ Attributes:
+ allowed_values (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ with a capitalized key describing the allowed value and an allowed
+ value. These dicts store the allowed enum values.
+ attribute_map (dict): The key is attribute name
+ and the value is json key in definition.
+ discriminator_value_class_map (dict): A dict to go from the discriminator
+ variable value to the discriminator class name.
+ validations (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ that stores validations for max_length, min_length, max_items,
+ min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
+ inclusive_minimum, and regex.
+ additional_properties_type (tuple): A tuple of classes accepted
+ as additional properties values.
+ """
+
+ allowed_values = {
+ }
+
+ validations = {
+ }
+
+ additional_properties_type = None
+
+ _nullable = False
+
+ @cached_property
+ def openapi_types():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+
+ Returns
+ openapi_types (dict): The key is attribute name
+ and the value is attribute type.
+ """
+ lazy_import()
+ return {
+ 'class_name': (str,), # noqa: E501
+ 'color': (str,), # noqa: E501
+ }
+
+ @cached_property
+ def discriminator():
+ lazy_import()
+ val = {
+ 'Cat': Cat,
+ 'Dog': Dog,
+ }
+ if not val:
+ return None
+ return {'class_name': val}
+
+ attribute_map = {
+ 'class_name': 'className', # noqa: E501
+ 'color': 'color', # noqa: E501
+ }
+
+ _composed_schemas = {}
+
+ required_properties = set([
+ '_data_store',
+ '_check_type',
+ '_spec_property_naming',
+ '_path_to_item',
+ '_configuration',
+ '_visited_composed_classes',
+ ])
+
+ @convert_js_args_to_python_args
+ def __init__(self, class_name, *args, **kwargs): # noqa: E501
+ """Animal - a model defined in OpenAPI
+
+ Args:
+ class_name (str):
+
+ Keyword Args:
+ _check_type (bool): if True, values for parameters in openapi_types
+ will be type checked and a TypeError will be
+ raised if the wrong type is input.
+ Defaults to True
+ _path_to_item (tuple/list): This is a list of keys or values to
+ drill down to the model in received_data
+ when deserializing a response
+ _spec_property_naming (bool): True if the variable names in the input data
+ are serialized names, as specified in the OpenAPI document.
+ False if the variable names in the input data
+ are pythonic names, e.g. snake case (default)
+ _configuration (Configuration): the instance to use when
+ deserializing a file_type parameter.
+ If passed, type conversion is attempted
+ If omitted no type conversion is done.
+ _visited_composed_classes (tuple): This stores a tuple of
+ classes that we have traveled through so that
+ if we see that class again we will not use its
+ discriminator again.
+ When traveling through a discriminator, the
+ composed schema that is
+ is traveled through is added to this set.
+ For example if Animal has a discriminator
+ petType and we pass in "Dog", and the class Dog
+ allOf includes Animal, we move through Animal
+ once using the discriminator, and pick Dog.
+ Then in Dog, we will make an instance of the
+ Animal class but this time we won't travel
+ through its discriminator because we passed in
+ _visited_composed_classes = (Animal,)
+ color (str): [optional] if omitted the server will use the default value of "red" # noqa: E501
+ """
+
+ _check_type = kwargs.pop('_check_type', True)
+ _spec_property_naming = kwargs.pop('_spec_property_naming', False)
+ _path_to_item = kwargs.pop('_path_to_item', ())
+ _configuration = kwargs.pop('_configuration', None)
+ _visited_composed_classes = kwargs.pop('_visited_composed_classes', ())
+
+ if args:
+ raise ApiTypeError(
+ "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % (
+ args,
+ self.__class__.__name__,
+ ),
+ path_to_item=_path_to_item,
+ valid_classes=(self.__class__,),
+ )
+
+ self._data_store = {}
+ self._check_type = _check_type
+ self._spec_property_naming = _spec_property_naming
+ self._path_to_item = _path_to_item
+ self._configuration = _configuration
+ self._visited_composed_classes = _visited_composed_classes + (self.__class__,)
+
+ self.class_name = class_name
+ for var_name, var_value in kwargs.items():
+ if var_name not in self.attribute_map and \
+ self._configuration is not None and \
+ self._configuration.discard_unknown_keys and \
+ self.additional_properties_type is None:
+ # discard variable.
+ continue
+ setattr(self, var_name, var_value)
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/animal_farm.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/animal_farm.py
new file mode 100644
index 000000000000..838b18a12970
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/animal_farm.py
@@ -0,0 +1,184 @@
+"""
+ 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: https://openapi-generator.tech
+"""
+
+
+import re # noqa: F401
+import sys # noqa: F401
+
+from petstore_api.model_utils import ( # noqa: F401
+ ApiTypeError,
+ ModelComposed,
+ ModelNormal,
+ ModelSimple,
+ cached_property,
+ change_keys_js_to_python,
+ convert_js_args_to_python_args,
+ date,
+ datetime,
+ file_type,
+ none_type,
+ validate_get_composed_info,
+)
+
+def lazy_import():
+ from petstore_api.model.animal import Animal
+ globals()['Animal'] = Animal
+
+
+class AnimalFarm(ModelSimple):
+ """NOTE: This class is auto generated by OpenAPI Generator.
+ Ref: https://openapi-generator.tech
+
+ Do not edit the class manually.
+
+ Attributes:
+ allowed_values (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ with a capitalized key describing the allowed value and an allowed
+ value. These dicts store the allowed enum values.
+ validations (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ that stores validations for max_length, min_length, max_items,
+ min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
+ inclusive_minimum, and regex.
+ additional_properties_type (tuple): A tuple of classes accepted
+ as additional properties values.
+ """
+
+ allowed_values = {
+ }
+
+ validations = {
+ }
+
+ additional_properties_type = None
+
+ _nullable = False
+
+ @cached_property
+ def openapi_types():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+
+ Returns
+ openapi_types (dict): The key is attribute name
+ and the value is attribute type.
+ """
+ lazy_import()
+ return {
+ 'value': ([Animal],),
+ }
+
+ @cached_property
+ def discriminator():
+ return None
+
+
+ attribute_map = {}
+
+ _composed_schemas = None
+
+ required_properties = set([
+ '_data_store',
+ '_check_type',
+ '_spec_property_naming',
+ '_path_to_item',
+ '_configuration',
+ '_visited_composed_classes',
+ ])
+
+ @convert_js_args_to_python_args
+ def __init__(self, *args, **kwargs):
+ """AnimalFarm - a model defined in OpenAPI
+
+ Note that value can be passed either in args or in kwargs, but not in both.
+
+ Args:
+ args[0] ([Animal]): # noqa: E501
+
+ Keyword Args:
+ value ([Animal]): # noqa: E501
+ _check_type (bool): if True, values for parameters in openapi_types
+ will be type checked and a TypeError will be
+ raised if the wrong type is input.
+ Defaults to True
+ _path_to_item (tuple/list): This is a list of keys or values to
+ drill down to the model in received_data
+ when deserializing a response
+ _spec_property_naming (bool): True if the variable names in the input data
+ are serialized names, as specified in the OpenAPI document.
+ False if the variable names in the input data
+ are pythonic names, e.g. snake case (default)
+ _configuration (Configuration): the instance to use when
+ deserializing a file_type parameter.
+ If passed, type conversion is attempted
+ If omitted no type conversion is done.
+ _visited_composed_classes (tuple): This stores a tuple of
+ classes that we have traveled through so that
+ if we see that class again we will not use its
+ discriminator again.
+ When traveling through a discriminator, the
+ composed schema that is
+ is traveled through is added to this set.
+ For example if Animal has a discriminator
+ petType and we pass in "Dog", and the class Dog
+ allOf includes Animal, we move through Animal
+ once using the discriminator, and pick Dog.
+ Then in Dog, we will make an instance of the
+ Animal class but this time we won't travel
+ through its discriminator because we passed in
+ _visited_composed_classes = (Animal,)
+ """
+ # required up here when default value is not given
+ _path_to_item = kwargs.pop('_path_to_item', ())
+
+ if 'value' in kwargs:
+ value = kwargs.pop('value')
+ elif args:
+ args = list(args)
+ value = args.pop(0)
+ else:
+ raise ApiTypeError(
+ "value is required, but not passed in args or kwargs and doesn't have default",
+ path_to_item=_path_to_item,
+ valid_classes=(self.__class__,),
+ )
+
+ _check_type = kwargs.pop('_check_type', True)
+ _spec_property_naming = kwargs.pop('_spec_property_naming', False)
+ _configuration = kwargs.pop('_configuration', None)
+ _visited_composed_classes = kwargs.pop('_visited_composed_classes', ())
+
+ if args:
+ raise ApiTypeError(
+ "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % (
+ args,
+ self.__class__.__name__,
+ ),
+ path_to_item=_path_to_item,
+ valid_classes=(self.__class__,),
+ )
+
+ self._data_store = {}
+ self._check_type = _check_type
+ self._spec_property_naming = _spec_property_naming
+ self._path_to_item = _path_to_item
+ self._configuration = _configuration
+ self._visited_composed_classes = _visited_composed_classes + (self.__class__,)
+ self.value = value
+ if kwargs:
+ raise ApiTypeError(
+ "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % (
+ kwargs,
+ self.__class__.__name__,
+ ),
+ path_to_item=_path_to_item,
+ valid_classes=(self.__class__,),
+ )
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/api_response.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/api_response.py
new file mode 100644
index 000000000000..01e2175b8004
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/api_response.py
@@ -0,0 +1,172 @@
+"""
+ 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: https://openapi-generator.tech
+"""
+
+
+import re # noqa: F401
+import sys # noqa: F401
+
+from petstore_api.model_utils import ( # noqa: F401
+ ApiTypeError,
+ ModelComposed,
+ ModelNormal,
+ ModelSimple,
+ cached_property,
+ change_keys_js_to_python,
+ convert_js_args_to_python_args,
+ date,
+ datetime,
+ file_type,
+ none_type,
+ validate_get_composed_info,
+)
+
+
+class ApiResponse(ModelNormal):
+ """NOTE: This class is auto generated by OpenAPI Generator.
+ Ref: https://openapi-generator.tech
+
+ Do not edit the class manually.
+
+ Attributes:
+ allowed_values (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ with a capitalized key describing the allowed value and an allowed
+ value. These dicts store the allowed enum values.
+ attribute_map (dict): The key is attribute name
+ and the value is json key in definition.
+ discriminator_value_class_map (dict): A dict to go from the discriminator
+ variable value to the discriminator class name.
+ validations (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ that stores validations for max_length, min_length, max_items,
+ min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
+ inclusive_minimum, and regex.
+ additional_properties_type (tuple): A tuple of classes accepted
+ as additional properties values.
+ """
+
+ allowed_values = {
+ }
+
+ validations = {
+ }
+
+ additional_properties_type = None
+
+ _nullable = False
+
+ @cached_property
+ def openapi_types():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+
+ Returns
+ openapi_types (dict): The key is attribute name
+ and the value is attribute type.
+ """
+ return {
+ 'code': (int,), # noqa: E501
+ 'type': (str,), # noqa: E501
+ 'message': (str,), # noqa: E501
+ }
+
+ @cached_property
+ def discriminator():
+ return None
+
+
+ attribute_map = {
+ 'code': 'code', # noqa: E501
+ 'type': 'type', # noqa: E501
+ 'message': 'message', # noqa: E501
+ }
+
+ _composed_schemas = {}
+
+ required_properties = set([
+ '_data_store',
+ '_check_type',
+ '_spec_property_naming',
+ '_path_to_item',
+ '_configuration',
+ '_visited_composed_classes',
+ ])
+
+ @convert_js_args_to_python_args
+ def __init__(self, *args, **kwargs): # noqa: E501
+ """ApiResponse - a model defined in OpenAPI
+
+ Keyword Args:
+ _check_type (bool): if True, values for parameters in openapi_types
+ will be type checked and a TypeError will be
+ raised if the wrong type is input.
+ Defaults to True
+ _path_to_item (tuple/list): This is a list of keys or values to
+ drill down to the model in received_data
+ when deserializing a response
+ _spec_property_naming (bool): True if the variable names in the input data
+ are serialized names, as specified in the OpenAPI document.
+ False if the variable names in the input data
+ are pythonic names, e.g. snake case (default)
+ _configuration (Configuration): the instance to use when
+ deserializing a file_type parameter.
+ If passed, type conversion is attempted
+ If omitted no type conversion is done.
+ _visited_composed_classes (tuple): This stores a tuple of
+ classes that we have traveled through so that
+ if we see that class again we will not use its
+ discriminator again.
+ When traveling through a discriminator, the
+ composed schema that is
+ is traveled through is added to this set.
+ For example if Animal has a discriminator
+ petType and we pass in "Dog", and the class Dog
+ allOf includes Animal, we move through Animal
+ once using the discriminator, and pick Dog.
+ Then in Dog, we will make an instance of the
+ Animal class but this time we won't travel
+ through its discriminator because we passed in
+ _visited_composed_classes = (Animal,)
+ code (int): [optional] # noqa: E501
+ type (str): [optional] # noqa: E501
+ message (str): [optional] # noqa: E501
+ """
+
+ _check_type = kwargs.pop('_check_type', True)
+ _spec_property_naming = kwargs.pop('_spec_property_naming', False)
+ _path_to_item = kwargs.pop('_path_to_item', ())
+ _configuration = kwargs.pop('_configuration', None)
+ _visited_composed_classes = kwargs.pop('_visited_composed_classes', ())
+
+ if args:
+ raise ApiTypeError(
+ "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % (
+ args,
+ self.__class__.__name__,
+ ),
+ path_to_item=_path_to_item,
+ valid_classes=(self.__class__,),
+ )
+
+ self._data_store = {}
+ self._check_type = _check_type
+ self._spec_property_naming = _spec_property_naming
+ self._path_to_item = _path_to_item
+ self._configuration = _configuration
+ self._visited_composed_classes = _visited_composed_classes + (self.__class__,)
+
+ for var_name, var_value in kwargs.items():
+ if var_name not in self.attribute_map and \
+ self._configuration is not None and \
+ self._configuration.discard_unknown_keys and \
+ self.additional_properties_type is None:
+ # discard variable.
+ continue
+ setattr(self, var_name, var_value)
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/array_of_array_of_number_only.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/array_of_array_of_number_only.py
new file mode 100644
index 000000000000..008b74dd42a3
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/array_of_array_of_number_only.py
@@ -0,0 +1,166 @@
+"""
+ 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: https://openapi-generator.tech
+"""
+
+
+import re # noqa: F401
+import sys # noqa: F401
+
+from petstore_api.model_utils import ( # noqa: F401
+ ApiTypeError,
+ ModelComposed,
+ ModelNormal,
+ ModelSimple,
+ cached_property,
+ change_keys_js_to_python,
+ convert_js_args_to_python_args,
+ date,
+ datetime,
+ file_type,
+ none_type,
+ validate_get_composed_info,
+)
+
+
+class ArrayOfArrayOfNumberOnly(ModelNormal):
+ """NOTE: This class is auto generated by OpenAPI Generator.
+ Ref: https://openapi-generator.tech
+
+ Do not edit the class manually.
+
+ Attributes:
+ allowed_values (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ with a capitalized key describing the allowed value and an allowed
+ value. These dicts store the allowed enum values.
+ attribute_map (dict): The key is attribute name
+ and the value is json key in definition.
+ discriminator_value_class_map (dict): A dict to go from the discriminator
+ variable value to the discriminator class name.
+ validations (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ that stores validations for max_length, min_length, max_items,
+ min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
+ inclusive_minimum, and regex.
+ additional_properties_type (tuple): A tuple of classes accepted
+ as additional properties values.
+ """
+
+ allowed_values = {
+ }
+
+ validations = {
+ }
+
+ additional_properties_type = None
+
+ _nullable = False
+
+ @cached_property
+ def openapi_types():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+
+ Returns
+ openapi_types (dict): The key is attribute name
+ and the value is attribute type.
+ """
+ return {
+ 'array_array_number': ([[float]],), # noqa: E501
+ }
+
+ @cached_property
+ def discriminator():
+ return None
+
+
+ attribute_map = {
+ 'array_array_number': 'ArrayArrayNumber', # noqa: E501
+ }
+
+ _composed_schemas = {}
+
+ required_properties = set([
+ '_data_store',
+ '_check_type',
+ '_spec_property_naming',
+ '_path_to_item',
+ '_configuration',
+ '_visited_composed_classes',
+ ])
+
+ @convert_js_args_to_python_args
+ def __init__(self, *args, **kwargs): # noqa: E501
+ """ArrayOfArrayOfNumberOnly - a model defined in OpenAPI
+
+ Keyword Args:
+ _check_type (bool): if True, values for parameters in openapi_types
+ will be type checked and a TypeError will be
+ raised if the wrong type is input.
+ Defaults to True
+ _path_to_item (tuple/list): This is a list of keys or values to
+ drill down to the model in received_data
+ when deserializing a response
+ _spec_property_naming (bool): True if the variable names in the input data
+ are serialized names, as specified in the OpenAPI document.
+ False if the variable names in the input data
+ are pythonic names, e.g. snake case (default)
+ _configuration (Configuration): the instance to use when
+ deserializing a file_type parameter.
+ If passed, type conversion is attempted
+ If omitted no type conversion is done.
+ _visited_composed_classes (tuple): This stores a tuple of
+ classes that we have traveled through so that
+ if we see that class again we will not use its
+ discriminator again.
+ When traveling through a discriminator, the
+ composed schema that is
+ is traveled through is added to this set.
+ For example if Animal has a discriminator
+ petType and we pass in "Dog", and the class Dog
+ allOf includes Animal, we move through Animal
+ once using the discriminator, and pick Dog.
+ Then in Dog, we will make an instance of the
+ Animal class but this time we won't travel
+ through its discriminator because we passed in
+ _visited_composed_classes = (Animal,)
+ array_array_number ([[float]]): [optional] # noqa: E501
+ """
+
+ _check_type = kwargs.pop('_check_type', True)
+ _spec_property_naming = kwargs.pop('_spec_property_naming', False)
+ _path_to_item = kwargs.pop('_path_to_item', ())
+ _configuration = kwargs.pop('_configuration', None)
+ _visited_composed_classes = kwargs.pop('_visited_composed_classes', ())
+
+ if args:
+ raise ApiTypeError(
+ "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % (
+ args,
+ self.__class__.__name__,
+ ),
+ path_to_item=_path_to_item,
+ valid_classes=(self.__class__,),
+ )
+
+ self._data_store = {}
+ self._check_type = _check_type
+ self._spec_property_naming = _spec_property_naming
+ self._path_to_item = _path_to_item
+ self._configuration = _configuration
+ self._visited_composed_classes = _visited_composed_classes + (self.__class__,)
+
+ for var_name, var_value in kwargs.items():
+ if var_name not in self.attribute_map and \
+ self._configuration is not None and \
+ self._configuration.discard_unknown_keys and \
+ self.additional_properties_type is None:
+ # discard variable.
+ continue
+ setattr(self, var_name, var_value)
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/array_of_number_only.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/array_of_number_only.py
new file mode 100644
index 000000000000..f2e080bc258e
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/array_of_number_only.py
@@ -0,0 +1,166 @@
+"""
+ 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: https://openapi-generator.tech
+"""
+
+
+import re # noqa: F401
+import sys # noqa: F401
+
+from petstore_api.model_utils import ( # noqa: F401
+ ApiTypeError,
+ ModelComposed,
+ ModelNormal,
+ ModelSimple,
+ cached_property,
+ change_keys_js_to_python,
+ convert_js_args_to_python_args,
+ date,
+ datetime,
+ file_type,
+ none_type,
+ validate_get_composed_info,
+)
+
+
+class ArrayOfNumberOnly(ModelNormal):
+ """NOTE: This class is auto generated by OpenAPI Generator.
+ Ref: https://openapi-generator.tech
+
+ Do not edit the class manually.
+
+ Attributes:
+ allowed_values (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ with a capitalized key describing the allowed value and an allowed
+ value. These dicts store the allowed enum values.
+ attribute_map (dict): The key is attribute name
+ and the value is json key in definition.
+ discriminator_value_class_map (dict): A dict to go from the discriminator
+ variable value to the discriminator class name.
+ validations (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ that stores validations for max_length, min_length, max_items,
+ min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
+ inclusive_minimum, and regex.
+ additional_properties_type (tuple): A tuple of classes accepted
+ as additional properties values.
+ """
+
+ allowed_values = {
+ }
+
+ validations = {
+ }
+
+ additional_properties_type = None
+
+ _nullable = False
+
+ @cached_property
+ def openapi_types():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+
+ Returns
+ openapi_types (dict): The key is attribute name
+ and the value is attribute type.
+ """
+ return {
+ 'array_number': ([float],), # noqa: E501
+ }
+
+ @cached_property
+ def discriminator():
+ return None
+
+
+ attribute_map = {
+ 'array_number': 'ArrayNumber', # noqa: E501
+ }
+
+ _composed_schemas = {}
+
+ required_properties = set([
+ '_data_store',
+ '_check_type',
+ '_spec_property_naming',
+ '_path_to_item',
+ '_configuration',
+ '_visited_composed_classes',
+ ])
+
+ @convert_js_args_to_python_args
+ def __init__(self, *args, **kwargs): # noqa: E501
+ """ArrayOfNumberOnly - a model defined in OpenAPI
+
+ Keyword Args:
+ _check_type (bool): if True, values for parameters in openapi_types
+ will be type checked and a TypeError will be
+ raised if the wrong type is input.
+ Defaults to True
+ _path_to_item (tuple/list): This is a list of keys or values to
+ drill down to the model in received_data
+ when deserializing a response
+ _spec_property_naming (bool): True if the variable names in the input data
+ are serialized names, as specified in the OpenAPI document.
+ False if the variable names in the input data
+ are pythonic names, e.g. snake case (default)
+ _configuration (Configuration): the instance to use when
+ deserializing a file_type parameter.
+ If passed, type conversion is attempted
+ If omitted no type conversion is done.
+ _visited_composed_classes (tuple): This stores a tuple of
+ classes that we have traveled through so that
+ if we see that class again we will not use its
+ discriminator again.
+ When traveling through a discriminator, the
+ composed schema that is
+ is traveled through is added to this set.
+ For example if Animal has a discriminator
+ petType and we pass in "Dog", and the class Dog
+ allOf includes Animal, we move through Animal
+ once using the discriminator, and pick Dog.
+ Then in Dog, we will make an instance of the
+ Animal class but this time we won't travel
+ through its discriminator because we passed in
+ _visited_composed_classes = (Animal,)
+ array_number ([float]): [optional] # noqa: E501
+ """
+
+ _check_type = kwargs.pop('_check_type', True)
+ _spec_property_naming = kwargs.pop('_spec_property_naming', False)
+ _path_to_item = kwargs.pop('_path_to_item', ())
+ _configuration = kwargs.pop('_configuration', None)
+ _visited_composed_classes = kwargs.pop('_visited_composed_classes', ())
+
+ if args:
+ raise ApiTypeError(
+ "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % (
+ args,
+ self.__class__.__name__,
+ ),
+ path_to_item=_path_to_item,
+ valid_classes=(self.__class__,),
+ )
+
+ self._data_store = {}
+ self._check_type = _check_type
+ self._spec_property_naming = _spec_property_naming
+ self._path_to_item = _path_to_item
+ self._configuration = _configuration
+ self._visited_composed_classes = _visited_composed_classes + (self.__class__,)
+
+ for var_name, var_value in kwargs.items():
+ if var_name not in self.attribute_map and \
+ self._configuration is not None and \
+ self._configuration.discard_unknown_keys and \
+ self.additional_properties_type is None:
+ # discard variable.
+ continue
+ setattr(self, var_name, var_value)
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/array_test.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/array_test.py
new file mode 100644
index 000000000000..ac42b07b93c9
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/array_test.py
@@ -0,0 +1,177 @@
+"""
+ 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: https://openapi-generator.tech
+"""
+
+
+import re # noqa: F401
+import sys # noqa: F401
+
+from petstore_api.model_utils import ( # noqa: F401
+ ApiTypeError,
+ ModelComposed,
+ ModelNormal,
+ ModelSimple,
+ cached_property,
+ change_keys_js_to_python,
+ convert_js_args_to_python_args,
+ date,
+ datetime,
+ file_type,
+ none_type,
+ validate_get_composed_info,
+)
+
+def lazy_import():
+ from petstore_api.model.read_only_first import ReadOnlyFirst
+ globals()['ReadOnlyFirst'] = ReadOnlyFirst
+
+
+class ArrayTest(ModelNormal):
+ """NOTE: This class is auto generated by OpenAPI Generator.
+ Ref: https://openapi-generator.tech
+
+ Do not edit the class manually.
+
+ Attributes:
+ allowed_values (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ with a capitalized key describing the allowed value and an allowed
+ value. These dicts store the allowed enum values.
+ attribute_map (dict): The key is attribute name
+ and the value is json key in definition.
+ discriminator_value_class_map (dict): A dict to go from the discriminator
+ variable value to the discriminator class name.
+ validations (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ that stores validations for max_length, min_length, max_items,
+ min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
+ inclusive_minimum, and regex.
+ additional_properties_type (tuple): A tuple of classes accepted
+ as additional properties values.
+ """
+
+ allowed_values = {
+ }
+
+ validations = {
+ }
+
+ additional_properties_type = None
+
+ _nullable = False
+
+ @cached_property
+ def openapi_types():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+
+ Returns
+ openapi_types (dict): The key is attribute name
+ and the value is attribute type.
+ """
+ lazy_import()
+ return {
+ 'array_of_string': ([str],), # noqa: E501
+ 'array_array_of_integer': ([[int]],), # noqa: E501
+ 'array_array_of_model': ([[ReadOnlyFirst]],), # noqa: E501
+ }
+
+ @cached_property
+ def discriminator():
+ return None
+
+
+ attribute_map = {
+ 'array_of_string': 'array_of_string', # noqa: E501
+ 'array_array_of_integer': 'array_array_of_integer', # noqa: E501
+ 'array_array_of_model': 'array_array_of_model', # noqa: E501
+ }
+
+ _composed_schemas = {}
+
+ required_properties = set([
+ '_data_store',
+ '_check_type',
+ '_spec_property_naming',
+ '_path_to_item',
+ '_configuration',
+ '_visited_composed_classes',
+ ])
+
+ @convert_js_args_to_python_args
+ def __init__(self, *args, **kwargs): # noqa: E501
+ """ArrayTest - a model defined in OpenAPI
+
+ Keyword Args:
+ _check_type (bool): if True, values for parameters in openapi_types
+ will be type checked and a TypeError will be
+ raised if the wrong type is input.
+ Defaults to True
+ _path_to_item (tuple/list): This is a list of keys or values to
+ drill down to the model in received_data
+ when deserializing a response
+ _spec_property_naming (bool): True if the variable names in the input data
+ are serialized names, as specified in the OpenAPI document.
+ False if the variable names in the input data
+ are pythonic names, e.g. snake case (default)
+ _configuration (Configuration): the instance to use when
+ deserializing a file_type parameter.
+ If passed, type conversion is attempted
+ If omitted no type conversion is done.
+ _visited_composed_classes (tuple): This stores a tuple of
+ classes that we have traveled through so that
+ if we see that class again we will not use its
+ discriminator again.
+ When traveling through a discriminator, the
+ composed schema that is
+ is traveled through is added to this set.
+ For example if Animal has a discriminator
+ petType and we pass in "Dog", and the class Dog
+ allOf includes Animal, we move through Animal
+ once using the discriminator, and pick Dog.
+ Then in Dog, we will make an instance of the
+ Animal class but this time we won't travel
+ through its discriminator because we passed in
+ _visited_composed_classes = (Animal,)
+ array_of_string ([str]): [optional] # noqa: E501
+ array_array_of_integer ([[int]]): [optional] # noqa: E501
+ array_array_of_model ([[ReadOnlyFirst]]): [optional] # noqa: E501
+ """
+
+ _check_type = kwargs.pop('_check_type', True)
+ _spec_property_naming = kwargs.pop('_spec_property_naming', False)
+ _path_to_item = kwargs.pop('_path_to_item', ())
+ _configuration = kwargs.pop('_configuration', None)
+ _visited_composed_classes = kwargs.pop('_visited_composed_classes', ())
+
+ if args:
+ raise ApiTypeError(
+ "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % (
+ args,
+ self.__class__.__name__,
+ ),
+ path_to_item=_path_to_item,
+ valid_classes=(self.__class__,),
+ )
+
+ self._data_store = {}
+ self._check_type = _check_type
+ self._spec_property_naming = _spec_property_naming
+ self._path_to_item = _path_to_item
+ self._configuration = _configuration
+ self._visited_composed_classes = _visited_composed_classes + (self.__class__,)
+
+ for var_name, var_value in kwargs.items():
+ if var_name not in self.attribute_map and \
+ self._configuration is not None and \
+ self._configuration.discard_unknown_keys and \
+ self.additional_properties_type is None:
+ # discard variable.
+ continue
+ setattr(self, var_name, var_value)
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/capitalization.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/capitalization.py
new file mode 100644
index 000000000000..710c17e51a56
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/capitalization.py
@@ -0,0 +1,181 @@
+"""
+ 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: https://openapi-generator.tech
+"""
+
+
+import re # noqa: F401
+import sys # noqa: F401
+
+from petstore_api.model_utils import ( # noqa: F401
+ ApiTypeError,
+ ModelComposed,
+ ModelNormal,
+ ModelSimple,
+ cached_property,
+ change_keys_js_to_python,
+ convert_js_args_to_python_args,
+ date,
+ datetime,
+ file_type,
+ none_type,
+ validate_get_composed_info,
+)
+
+
+class Capitalization(ModelNormal):
+ """NOTE: This class is auto generated by OpenAPI Generator.
+ Ref: https://openapi-generator.tech
+
+ Do not edit the class manually.
+
+ Attributes:
+ allowed_values (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ with a capitalized key describing the allowed value and an allowed
+ value. These dicts store the allowed enum values.
+ attribute_map (dict): The key is attribute name
+ and the value is json key in definition.
+ discriminator_value_class_map (dict): A dict to go from the discriminator
+ variable value to the discriminator class name.
+ validations (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ that stores validations for max_length, min_length, max_items,
+ min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
+ inclusive_minimum, and regex.
+ additional_properties_type (tuple): A tuple of classes accepted
+ as additional properties values.
+ """
+
+ allowed_values = {
+ }
+
+ validations = {
+ }
+
+ additional_properties_type = None
+
+ _nullable = False
+
+ @cached_property
+ def openapi_types():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+
+ Returns
+ openapi_types (dict): The key is attribute name
+ and the value is attribute type.
+ """
+ return {
+ 'small_camel': (str,), # noqa: E501
+ 'capital_camel': (str,), # noqa: E501
+ 'small_snake': (str,), # noqa: E501
+ 'capital_snake': (str,), # noqa: E501
+ 'sca_eth_flow_points': (str,), # noqa: E501
+ 'att_name': (str,), # noqa: E501
+ }
+
+ @cached_property
+ def discriminator():
+ return None
+
+
+ attribute_map = {
+ 'small_camel': 'smallCamel', # noqa: E501
+ 'capital_camel': 'CapitalCamel', # noqa: E501
+ 'small_snake': 'small_Snake', # noqa: E501
+ 'capital_snake': 'Capital_Snake', # noqa: E501
+ 'sca_eth_flow_points': 'SCA_ETH_Flow_Points', # noqa: E501
+ 'att_name': 'ATT_NAME', # noqa: E501
+ }
+
+ _composed_schemas = {}
+
+ required_properties = set([
+ '_data_store',
+ '_check_type',
+ '_spec_property_naming',
+ '_path_to_item',
+ '_configuration',
+ '_visited_composed_classes',
+ ])
+
+ @convert_js_args_to_python_args
+ def __init__(self, *args, **kwargs): # noqa: E501
+ """Capitalization - a model defined in OpenAPI
+
+ Keyword Args:
+ _check_type (bool): if True, values for parameters in openapi_types
+ will be type checked and a TypeError will be
+ raised if the wrong type is input.
+ Defaults to True
+ _path_to_item (tuple/list): This is a list of keys or values to
+ drill down to the model in received_data
+ when deserializing a response
+ _spec_property_naming (bool): True if the variable names in the input data
+ are serialized names, as specified in the OpenAPI document.
+ False if the variable names in the input data
+ are pythonic names, e.g. snake case (default)
+ _configuration (Configuration): the instance to use when
+ deserializing a file_type parameter.
+ If passed, type conversion is attempted
+ If omitted no type conversion is done.
+ _visited_composed_classes (tuple): This stores a tuple of
+ classes that we have traveled through so that
+ if we see that class again we will not use its
+ discriminator again.
+ When traveling through a discriminator, the
+ composed schema that is
+ is traveled through is added to this set.
+ For example if Animal has a discriminator
+ petType and we pass in "Dog", and the class Dog
+ allOf includes Animal, we move through Animal
+ once using the discriminator, and pick Dog.
+ Then in Dog, we will make an instance of the
+ Animal class but this time we won't travel
+ through its discriminator because we passed in
+ _visited_composed_classes = (Animal,)
+ small_camel (str): [optional] # noqa: E501
+ capital_camel (str): [optional] # noqa: E501
+ small_snake (str): [optional] # noqa: E501
+ capital_snake (str): [optional] # noqa: E501
+ sca_eth_flow_points (str): [optional] # noqa: E501
+ att_name (str): Name of the pet . [optional] # noqa: E501
+ """
+
+ _check_type = kwargs.pop('_check_type', True)
+ _spec_property_naming = kwargs.pop('_spec_property_naming', False)
+ _path_to_item = kwargs.pop('_path_to_item', ())
+ _configuration = kwargs.pop('_configuration', None)
+ _visited_composed_classes = kwargs.pop('_visited_composed_classes', ())
+
+ if args:
+ raise ApiTypeError(
+ "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % (
+ args,
+ self.__class__.__name__,
+ ),
+ path_to_item=_path_to_item,
+ valid_classes=(self.__class__,),
+ )
+
+ self._data_store = {}
+ self._check_type = _check_type
+ self._spec_property_naming = _spec_property_naming
+ self._path_to_item = _path_to_item
+ self._configuration = _configuration
+ self._visited_composed_classes = _visited_composed_classes + (self.__class__,)
+
+ for var_name, var_value in kwargs.items():
+ if var_name not in self.attribute_map and \
+ self._configuration is not None and \
+ self._configuration.discard_unknown_keys and \
+ self.additional_properties_type is None:
+ # discard variable.
+ continue
+ setattr(self, var_name, var_value)
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/cat.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/cat.py
new file mode 100644
index 000000000000..fd8d4bc7179c
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/cat.py
@@ -0,0 +1,218 @@
+"""
+ 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: https://openapi-generator.tech
+"""
+
+
+import re # noqa: F401
+import sys # noqa: F401
+
+from petstore_api.model_utils import ( # noqa: F401
+ ApiTypeError,
+ ModelComposed,
+ ModelNormal,
+ ModelSimple,
+ cached_property,
+ change_keys_js_to_python,
+ convert_js_args_to_python_args,
+ date,
+ datetime,
+ file_type,
+ none_type,
+ validate_get_composed_info,
+)
+
+def lazy_import():
+ from petstore_api.model.animal import Animal
+ from petstore_api.model.cat_all_of import CatAllOf
+ globals()['Animal'] = Animal
+ globals()['CatAllOf'] = CatAllOf
+
+
+class Cat(ModelComposed):
+ """NOTE: This class is auto generated by OpenAPI Generator.
+ Ref: https://openapi-generator.tech
+
+ Do not edit the class manually.
+
+ Attributes:
+ allowed_values (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ with a capitalized key describing the allowed value and an allowed
+ value. These dicts store the allowed enum values.
+ attribute_map (dict): The key is attribute name
+ and the value is json key in definition.
+ discriminator_value_class_map (dict): A dict to go from the discriminator
+ variable value to the discriminator class name.
+ validations (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ that stores validations for max_length, min_length, max_items,
+ min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
+ inclusive_minimum, and regex.
+ additional_properties_type (tuple): A tuple of classes accepted
+ as additional properties values.
+ """
+
+ allowed_values = {
+ }
+
+ validations = {
+ }
+
+ additional_properties_type = None
+
+ _nullable = False
+
+ @cached_property
+ def openapi_types():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+
+ Returns
+ openapi_types (dict): The key is attribute name
+ and the value is attribute type.
+ """
+ lazy_import()
+ return {
+ 'class_name': (str,), # noqa: E501
+ 'declawed': (bool,), # noqa: E501
+ 'color': (str,), # noqa: E501
+ }
+
+ @cached_property
+ def discriminator():
+ val = {
+ }
+ if not val:
+ return None
+ return {'class_name': val}
+
+ attribute_map = {
+ 'class_name': 'className', # noqa: E501
+ 'declawed': 'declawed', # noqa: E501
+ 'color': 'color', # noqa: E501
+ }
+
+ required_properties = set([
+ '_data_store',
+ '_check_type',
+ '_spec_property_naming',
+ '_path_to_item',
+ '_configuration',
+ '_visited_composed_classes',
+ '_composed_instances',
+ '_var_name_to_model_instances',
+ '_additional_properties_model_instances',
+ ])
+
+ @convert_js_args_to_python_args
+ def __init__(self, *args, **kwargs): # noqa: E501
+ """Cat - a model defined in OpenAPI
+
+ Keyword Args:
+ class_name (str):
+ _check_type (bool): if True, values for parameters in openapi_types
+ will be type checked and a TypeError will be
+ raised if the wrong type is input.
+ Defaults to True
+ _path_to_item (tuple/list): This is a list of keys or values to
+ drill down to the model in received_data
+ when deserializing a response
+ _spec_property_naming (bool): True if the variable names in the input data
+ are serialized names, as specified in the OpenAPI document.
+ False if the variable names in the input data
+ are pythonic names, e.g. snake case (default)
+ _configuration (Configuration): the instance to use when
+ deserializing a file_type parameter.
+ If passed, type conversion is attempted
+ If omitted no type conversion is done.
+ _visited_composed_classes (tuple): This stores a tuple of
+ classes that we have traveled through so that
+ if we see that class again we will not use its
+ discriminator again.
+ When traveling through a discriminator, the
+ composed schema that is
+ is traveled through is added to this set.
+ For example if Animal has a discriminator
+ petType and we pass in "Dog", and the class Dog
+ allOf includes Animal, we move through Animal
+ once using the discriminator, and pick Dog.
+ Then in Dog, we will make an instance of the
+ Animal class but this time we won't travel
+ through its discriminator because we passed in
+ _visited_composed_classes = (Animal,)
+ declawed (bool): [optional] # noqa: E501
+ color (str): [optional] if omitted the server will use the default value of "red" # noqa: E501
+ """
+
+ _check_type = kwargs.pop('_check_type', True)
+ _spec_property_naming = kwargs.pop('_spec_property_naming', False)
+ _path_to_item = kwargs.pop('_path_to_item', ())
+ _configuration = kwargs.pop('_configuration', None)
+ _visited_composed_classes = kwargs.pop('_visited_composed_classes', ())
+
+ if args:
+ raise ApiTypeError(
+ "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % (
+ args,
+ self.__class__.__name__,
+ ),
+ path_to_item=_path_to_item,
+ valid_classes=(self.__class__,),
+ )
+
+ self._data_store = {}
+ self._check_type = _check_type
+ self._spec_property_naming = _spec_property_naming
+ self._path_to_item = _path_to_item
+ self._configuration = _configuration
+ self._visited_composed_classes = _visited_composed_classes + (self.__class__,)
+
+ constant_args = {
+ '_check_type': _check_type,
+ '_path_to_item': _path_to_item,
+ '_spec_property_naming': _spec_property_naming,
+ '_configuration': _configuration,
+ '_visited_composed_classes': self._visited_composed_classes,
+ }
+ composed_info = validate_get_composed_info(
+ constant_args, kwargs, self)
+ self._composed_instances = composed_info[0]
+ self._var_name_to_model_instances = composed_info[1]
+ self._additional_properties_model_instances = composed_info[2]
+ discarded_args = composed_info[3]
+
+ for var_name, var_value in kwargs.items():
+ if var_name in discarded_args and \
+ self._configuration is not None and \
+ self._configuration.discard_unknown_keys and \
+ self._additional_properties_model_instances:
+ # discard variable.
+ continue
+ setattr(self, var_name, var_value)
+
+ @cached_property
+ def _composed_schemas():
+ # we need this here to make our import statements work
+ # we must store _composed_schemas in here so the code is only run
+ # when we invoke this method. If we kept this at the class
+ # level we would get an error beause the class level
+ # code would be run when this module is imported, and these composed
+ # classes don't exist yet because their module has not finished
+ # loading
+ lazy_import()
+ return {
+ 'anyOf': [
+ ],
+ 'allOf': [
+ Animal,
+ CatAllOf,
+ ],
+ 'oneOf': [
+ ],
+ }
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/cat_all_of.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/cat_all_of.py
new file mode 100644
index 000000000000..50b046510dfa
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/cat_all_of.py
@@ -0,0 +1,166 @@
+"""
+ 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: https://openapi-generator.tech
+"""
+
+
+import re # noqa: F401
+import sys # noqa: F401
+
+from petstore_api.model_utils import ( # noqa: F401
+ ApiTypeError,
+ ModelComposed,
+ ModelNormal,
+ ModelSimple,
+ cached_property,
+ change_keys_js_to_python,
+ convert_js_args_to_python_args,
+ date,
+ datetime,
+ file_type,
+ none_type,
+ validate_get_composed_info,
+)
+
+
+class CatAllOf(ModelNormal):
+ """NOTE: This class is auto generated by OpenAPI Generator.
+ Ref: https://openapi-generator.tech
+
+ Do not edit the class manually.
+
+ Attributes:
+ allowed_values (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ with a capitalized key describing the allowed value and an allowed
+ value. These dicts store the allowed enum values.
+ attribute_map (dict): The key is attribute name
+ and the value is json key in definition.
+ discriminator_value_class_map (dict): A dict to go from the discriminator
+ variable value to the discriminator class name.
+ validations (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ that stores validations for max_length, min_length, max_items,
+ min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
+ inclusive_minimum, and regex.
+ additional_properties_type (tuple): A tuple of classes accepted
+ as additional properties values.
+ """
+
+ allowed_values = {
+ }
+
+ validations = {
+ }
+
+ additional_properties_type = None
+
+ _nullable = False
+
+ @cached_property
+ def openapi_types():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+
+ Returns
+ openapi_types (dict): The key is attribute name
+ and the value is attribute type.
+ """
+ return {
+ 'declawed': (bool,), # noqa: E501
+ }
+
+ @cached_property
+ def discriminator():
+ return None
+
+
+ attribute_map = {
+ 'declawed': 'declawed', # noqa: E501
+ }
+
+ _composed_schemas = {}
+
+ required_properties = set([
+ '_data_store',
+ '_check_type',
+ '_spec_property_naming',
+ '_path_to_item',
+ '_configuration',
+ '_visited_composed_classes',
+ ])
+
+ @convert_js_args_to_python_args
+ def __init__(self, *args, **kwargs): # noqa: E501
+ """CatAllOf - a model defined in OpenAPI
+
+ Keyword Args:
+ _check_type (bool): if True, values for parameters in openapi_types
+ will be type checked and a TypeError will be
+ raised if the wrong type is input.
+ Defaults to True
+ _path_to_item (tuple/list): This is a list of keys or values to
+ drill down to the model in received_data
+ when deserializing a response
+ _spec_property_naming (bool): True if the variable names in the input data
+ are serialized names, as specified in the OpenAPI document.
+ False if the variable names in the input data
+ are pythonic names, e.g. snake case (default)
+ _configuration (Configuration): the instance to use when
+ deserializing a file_type parameter.
+ If passed, type conversion is attempted
+ If omitted no type conversion is done.
+ _visited_composed_classes (tuple): This stores a tuple of
+ classes that we have traveled through so that
+ if we see that class again we will not use its
+ discriminator again.
+ When traveling through a discriminator, the
+ composed schema that is
+ is traveled through is added to this set.
+ For example if Animal has a discriminator
+ petType and we pass in "Dog", and the class Dog
+ allOf includes Animal, we move through Animal
+ once using the discriminator, and pick Dog.
+ Then in Dog, we will make an instance of the
+ Animal class but this time we won't travel
+ through its discriminator because we passed in
+ _visited_composed_classes = (Animal,)
+ declawed (bool): [optional] # noqa: E501
+ """
+
+ _check_type = kwargs.pop('_check_type', True)
+ _spec_property_naming = kwargs.pop('_spec_property_naming', False)
+ _path_to_item = kwargs.pop('_path_to_item', ())
+ _configuration = kwargs.pop('_configuration', None)
+ _visited_composed_classes = kwargs.pop('_visited_composed_classes', ())
+
+ if args:
+ raise ApiTypeError(
+ "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % (
+ args,
+ self.__class__.__name__,
+ ),
+ path_to_item=_path_to_item,
+ valid_classes=(self.__class__,),
+ )
+
+ self._data_store = {}
+ self._check_type = _check_type
+ self._spec_property_naming = _spec_property_naming
+ self._path_to_item = _path_to_item
+ self._configuration = _configuration
+ self._visited_composed_classes = _visited_composed_classes + (self.__class__,)
+
+ for var_name, var_value in kwargs.items():
+ if var_name not in self.attribute_map and \
+ self._configuration is not None and \
+ self._configuration.discard_unknown_keys and \
+ self.additional_properties_type is None:
+ # discard variable.
+ continue
+ setattr(self, var_name, var_value)
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/category.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/category.py
new file mode 100644
index 000000000000..ed167471d356
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/category.py
@@ -0,0 +1,173 @@
+"""
+ 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: https://openapi-generator.tech
+"""
+
+
+import re # noqa: F401
+import sys # noqa: F401
+
+from petstore_api.model_utils import ( # noqa: F401
+ ApiTypeError,
+ ModelComposed,
+ ModelNormal,
+ ModelSimple,
+ cached_property,
+ change_keys_js_to_python,
+ convert_js_args_to_python_args,
+ date,
+ datetime,
+ file_type,
+ none_type,
+ validate_get_composed_info,
+)
+
+
+class Category(ModelNormal):
+ """NOTE: This class is auto generated by OpenAPI Generator.
+ Ref: https://openapi-generator.tech
+
+ Do not edit the class manually.
+
+ Attributes:
+ allowed_values (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ with a capitalized key describing the allowed value and an allowed
+ value. These dicts store the allowed enum values.
+ attribute_map (dict): The key is attribute name
+ and the value is json key in definition.
+ discriminator_value_class_map (dict): A dict to go from the discriminator
+ variable value to the discriminator class name.
+ validations (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ that stores validations for max_length, min_length, max_items,
+ min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
+ inclusive_minimum, and regex.
+ additional_properties_type (tuple): A tuple of classes accepted
+ as additional properties values.
+ """
+
+ allowed_values = {
+ }
+
+ validations = {
+ }
+
+ additional_properties_type = None
+
+ _nullable = False
+
+ @cached_property
+ def openapi_types():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+
+ Returns
+ openapi_types (dict): The key is attribute name
+ and the value is attribute type.
+ """
+ return {
+ 'name': (str,), # noqa: E501
+ 'id': (int,), # noqa: E501
+ }
+
+ @cached_property
+ def discriminator():
+ return None
+
+
+ attribute_map = {
+ 'name': 'name', # noqa: E501
+ 'id': 'id', # noqa: E501
+ }
+
+ _composed_schemas = {}
+
+ required_properties = set([
+ '_data_store',
+ '_check_type',
+ '_spec_property_naming',
+ '_path_to_item',
+ '_configuration',
+ '_visited_composed_classes',
+ ])
+
+ @convert_js_args_to_python_args
+ def __init__(self, *args, **kwargs): # noqa: E501
+ """Category - a model defined in OpenAPI
+
+ Args:
+
+ Keyword Args:
+ name (str): defaults to "default-name" # noqa: E501
+ _check_type (bool): if True, values for parameters in openapi_types
+ will be type checked and a TypeError will be
+ raised if the wrong type is input.
+ Defaults to True
+ _path_to_item (tuple/list): This is a list of keys or values to
+ drill down to the model in received_data
+ when deserializing a response
+ _spec_property_naming (bool): True if the variable names in the input data
+ are serialized names, as specified in the OpenAPI document.
+ False if the variable names in the input data
+ are pythonic names, e.g. snake case (default)
+ _configuration (Configuration): the instance to use when
+ deserializing a file_type parameter.
+ If passed, type conversion is attempted
+ If omitted no type conversion is done.
+ _visited_composed_classes (tuple): This stores a tuple of
+ classes that we have traveled through so that
+ if we see that class again we will not use its
+ discriminator again.
+ When traveling through a discriminator, the
+ composed schema that is
+ is traveled through is added to this set.
+ For example if Animal has a discriminator
+ petType and we pass in "Dog", and the class Dog
+ allOf includes Animal, we move through Animal
+ once using the discriminator, and pick Dog.
+ Then in Dog, we will make an instance of the
+ Animal class but this time we won't travel
+ through its discriminator because we passed in
+ _visited_composed_classes = (Animal,)
+ id (int): [optional] # noqa: E501
+ """
+
+ name = kwargs.get('name', "default-name")
+ _check_type = kwargs.pop('_check_type', True)
+ _spec_property_naming = kwargs.pop('_spec_property_naming', False)
+ _path_to_item = kwargs.pop('_path_to_item', ())
+ _configuration = kwargs.pop('_configuration', None)
+ _visited_composed_classes = kwargs.pop('_visited_composed_classes', ())
+
+ if args:
+ raise ApiTypeError(
+ "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % (
+ args,
+ self.__class__.__name__,
+ ),
+ path_to_item=_path_to_item,
+ valid_classes=(self.__class__,),
+ )
+
+ self._data_store = {}
+ self._check_type = _check_type
+ self._spec_property_naming = _spec_property_naming
+ self._path_to_item = _path_to_item
+ self._configuration = _configuration
+ self._visited_composed_classes = _visited_composed_classes + (self.__class__,)
+
+ self.name = name
+ for var_name, var_value in kwargs.items():
+ if var_name not in self.attribute_map and \
+ self._configuration is not None and \
+ self._configuration.discard_unknown_keys and \
+ self.additional_properties_type is None:
+ # discard variable.
+ continue
+ setattr(self, var_name, var_value)
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/child.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/child.py
new file mode 100644
index 000000000000..d36723dd6250
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/child.py
@@ -0,0 +1,215 @@
+"""
+ 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: https://openapi-generator.tech
+"""
+
+
+import re # noqa: F401
+import sys # noqa: F401
+
+from petstore_api.model_utils import ( # noqa: F401
+ ApiTypeError,
+ ModelComposed,
+ ModelNormal,
+ ModelSimple,
+ cached_property,
+ change_keys_js_to_python,
+ convert_js_args_to_python_args,
+ date,
+ datetime,
+ file_type,
+ none_type,
+ validate_get_composed_info,
+)
+
+def lazy_import():
+ from petstore_api.model.child_all_of import ChildAllOf
+ from petstore_api.model.parent import Parent
+ globals()['ChildAllOf'] = ChildAllOf
+ globals()['Parent'] = Parent
+
+
+class Child(ModelComposed):
+ """NOTE: This class is auto generated by OpenAPI Generator.
+ Ref: https://openapi-generator.tech
+
+ Do not edit the class manually.
+
+ Attributes:
+ allowed_values (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ with a capitalized key describing the allowed value and an allowed
+ value. These dicts store the allowed enum values.
+ attribute_map (dict): The key is attribute name
+ and the value is json key in definition.
+ discriminator_value_class_map (dict): A dict to go from the discriminator
+ variable value to the discriminator class name.
+ validations (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ that stores validations for max_length, min_length, max_items,
+ min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
+ inclusive_minimum, and regex.
+ additional_properties_type (tuple): A tuple of classes accepted
+ as additional properties values.
+ """
+
+ allowed_values = {
+ }
+
+ validations = {
+ }
+
+ additional_properties_type = None
+
+ _nullable = False
+
+ @cached_property
+ def openapi_types():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+
+ Returns
+ openapi_types (dict): The key is attribute name
+ and the value is attribute type.
+ """
+ lazy_import()
+ return {
+ 'radio_waves': (bool,), # noqa: E501
+ 'tele_vision': (bool,), # noqa: E501
+ 'inter_net': (bool,), # noqa: E501
+ }
+
+ @cached_property
+ def discriminator():
+ return None
+
+
+ attribute_map = {
+ 'radio_waves': 'radioWaves', # noqa: E501
+ 'tele_vision': 'teleVision', # noqa: E501
+ 'inter_net': 'interNet', # noqa: E501
+ }
+
+ required_properties = set([
+ '_data_store',
+ '_check_type',
+ '_spec_property_naming',
+ '_path_to_item',
+ '_configuration',
+ '_visited_composed_classes',
+ '_composed_instances',
+ '_var_name_to_model_instances',
+ '_additional_properties_model_instances',
+ ])
+
+ @convert_js_args_to_python_args
+ def __init__(self, *args, **kwargs): # noqa: E501
+ """Child - a model defined in OpenAPI
+
+ Keyword Args:
+ _check_type (bool): if True, values for parameters in openapi_types
+ will be type checked and a TypeError will be
+ raised if the wrong type is input.
+ Defaults to True
+ _path_to_item (tuple/list): This is a list of keys or values to
+ drill down to the model in received_data
+ when deserializing a response
+ _spec_property_naming (bool): True if the variable names in the input data
+ are serialized names, as specified in the OpenAPI document.
+ False if the variable names in the input data
+ are pythonic names, e.g. snake case (default)
+ _configuration (Configuration): the instance to use when
+ deserializing a file_type parameter.
+ If passed, type conversion is attempted
+ If omitted no type conversion is done.
+ _visited_composed_classes (tuple): This stores a tuple of
+ classes that we have traveled through so that
+ if we see that class again we will not use its
+ discriminator again.
+ When traveling through a discriminator, the
+ composed schema that is
+ is traveled through is added to this set.
+ For example if Animal has a discriminator
+ petType and we pass in "Dog", and the class Dog
+ allOf includes Animal, we move through Animal
+ once using the discriminator, and pick Dog.
+ Then in Dog, we will make an instance of the
+ Animal class but this time we won't travel
+ through its discriminator because we passed in
+ _visited_composed_classes = (Animal,)
+ radio_waves (bool): [optional] # noqa: E501
+ tele_vision (bool): [optional] # noqa: E501
+ inter_net (bool): [optional] # noqa: E501
+ """
+
+ _check_type = kwargs.pop('_check_type', True)
+ _spec_property_naming = kwargs.pop('_spec_property_naming', False)
+ _path_to_item = kwargs.pop('_path_to_item', ())
+ _configuration = kwargs.pop('_configuration', None)
+ _visited_composed_classes = kwargs.pop('_visited_composed_classes', ())
+
+ if args:
+ raise ApiTypeError(
+ "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % (
+ args,
+ self.__class__.__name__,
+ ),
+ path_to_item=_path_to_item,
+ valid_classes=(self.__class__,),
+ )
+
+ self._data_store = {}
+ self._check_type = _check_type
+ self._spec_property_naming = _spec_property_naming
+ self._path_to_item = _path_to_item
+ self._configuration = _configuration
+ self._visited_composed_classes = _visited_composed_classes + (self.__class__,)
+
+ constant_args = {
+ '_check_type': _check_type,
+ '_path_to_item': _path_to_item,
+ '_spec_property_naming': _spec_property_naming,
+ '_configuration': _configuration,
+ '_visited_composed_classes': self._visited_composed_classes,
+ }
+ composed_info = validate_get_composed_info(
+ constant_args, kwargs, self)
+ self._composed_instances = composed_info[0]
+ self._var_name_to_model_instances = composed_info[1]
+ self._additional_properties_model_instances = composed_info[2]
+ discarded_args = composed_info[3]
+
+ for var_name, var_value in kwargs.items():
+ if var_name in discarded_args and \
+ self._configuration is not None and \
+ self._configuration.discard_unknown_keys and \
+ self._additional_properties_model_instances:
+ # discard variable.
+ continue
+ setattr(self, var_name, var_value)
+
+ @cached_property
+ def _composed_schemas():
+ # we need this here to make our import statements work
+ # we must store _composed_schemas in here so the code is only run
+ # when we invoke this method. If we kept this at the class
+ # level we would get an error beause the class level
+ # code would be run when this module is imported, and these composed
+ # classes don't exist yet because their module has not finished
+ # loading
+ lazy_import()
+ return {
+ 'anyOf': [
+ ],
+ 'allOf': [
+ ChildAllOf,
+ Parent,
+ ],
+ 'oneOf': [
+ ],
+ }
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/child_all_of.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/child_all_of.py
new file mode 100644
index 000000000000..2339e520bd65
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/child_all_of.py
@@ -0,0 +1,166 @@
+"""
+ 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: https://openapi-generator.tech
+"""
+
+
+import re # noqa: F401
+import sys # noqa: F401
+
+from petstore_api.model_utils import ( # noqa: F401
+ ApiTypeError,
+ ModelComposed,
+ ModelNormal,
+ ModelSimple,
+ cached_property,
+ change_keys_js_to_python,
+ convert_js_args_to_python_args,
+ date,
+ datetime,
+ file_type,
+ none_type,
+ validate_get_composed_info,
+)
+
+
+class ChildAllOf(ModelNormal):
+ """NOTE: This class is auto generated by OpenAPI Generator.
+ Ref: https://openapi-generator.tech
+
+ Do not edit the class manually.
+
+ Attributes:
+ allowed_values (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ with a capitalized key describing the allowed value and an allowed
+ value. These dicts store the allowed enum values.
+ attribute_map (dict): The key is attribute name
+ and the value is json key in definition.
+ discriminator_value_class_map (dict): A dict to go from the discriminator
+ variable value to the discriminator class name.
+ validations (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ that stores validations for max_length, min_length, max_items,
+ min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
+ inclusive_minimum, and regex.
+ additional_properties_type (tuple): A tuple of classes accepted
+ as additional properties values.
+ """
+
+ allowed_values = {
+ }
+
+ validations = {
+ }
+
+ additional_properties_type = None
+
+ _nullable = False
+
+ @cached_property
+ def openapi_types():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+
+ Returns
+ openapi_types (dict): The key is attribute name
+ and the value is attribute type.
+ """
+ return {
+ 'inter_net': (bool,), # noqa: E501
+ }
+
+ @cached_property
+ def discriminator():
+ return None
+
+
+ attribute_map = {
+ 'inter_net': 'interNet', # noqa: E501
+ }
+
+ _composed_schemas = {}
+
+ required_properties = set([
+ '_data_store',
+ '_check_type',
+ '_spec_property_naming',
+ '_path_to_item',
+ '_configuration',
+ '_visited_composed_classes',
+ ])
+
+ @convert_js_args_to_python_args
+ def __init__(self, *args, **kwargs): # noqa: E501
+ """ChildAllOf - a model defined in OpenAPI
+
+ Keyword Args:
+ _check_type (bool): if True, values for parameters in openapi_types
+ will be type checked and a TypeError will be
+ raised if the wrong type is input.
+ Defaults to True
+ _path_to_item (tuple/list): This is a list of keys or values to
+ drill down to the model in received_data
+ when deserializing a response
+ _spec_property_naming (bool): True if the variable names in the input data
+ are serialized names, as specified in the OpenAPI document.
+ False if the variable names in the input data
+ are pythonic names, e.g. snake case (default)
+ _configuration (Configuration): the instance to use when
+ deserializing a file_type parameter.
+ If passed, type conversion is attempted
+ If omitted no type conversion is done.
+ _visited_composed_classes (tuple): This stores a tuple of
+ classes that we have traveled through so that
+ if we see that class again we will not use its
+ discriminator again.
+ When traveling through a discriminator, the
+ composed schema that is
+ is traveled through is added to this set.
+ For example if Animal has a discriminator
+ petType and we pass in "Dog", and the class Dog
+ allOf includes Animal, we move through Animal
+ once using the discriminator, and pick Dog.
+ Then in Dog, we will make an instance of the
+ Animal class but this time we won't travel
+ through its discriminator because we passed in
+ _visited_composed_classes = (Animal,)
+ inter_net (bool): [optional] # noqa: E501
+ """
+
+ _check_type = kwargs.pop('_check_type', True)
+ _spec_property_naming = kwargs.pop('_spec_property_naming', False)
+ _path_to_item = kwargs.pop('_path_to_item', ())
+ _configuration = kwargs.pop('_configuration', None)
+ _visited_composed_classes = kwargs.pop('_visited_composed_classes', ())
+
+ if args:
+ raise ApiTypeError(
+ "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % (
+ args,
+ self.__class__.__name__,
+ ),
+ path_to_item=_path_to_item,
+ valid_classes=(self.__class__,),
+ )
+
+ self._data_store = {}
+ self._check_type = _check_type
+ self._spec_property_naming = _spec_property_naming
+ self._path_to_item = _path_to_item
+ self._configuration = _configuration
+ self._visited_composed_classes = _visited_composed_classes + (self.__class__,)
+
+ for var_name, var_value in kwargs.items():
+ if var_name not in self.attribute_map and \
+ self._configuration is not None and \
+ self._configuration.discard_unknown_keys and \
+ self.additional_properties_type is None:
+ # discard variable.
+ continue
+ setattr(self, var_name, var_value)
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/child_cat.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/child_cat.py
new file mode 100644
index 000000000000..70438f3441ff
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/child_cat.py
@@ -0,0 +1,215 @@
+"""
+ 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: https://openapi-generator.tech
+"""
+
+
+import re # noqa: F401
+import sys # noqa: F401
+
+from petstore_api.model_utils import ( # noqa: F401
+ ApiTypeError,
+ ModelComposed,
+ ModelNormal,
+ ModelSimple,
+ cached_property,
+ change_keys_js_to_python,
+ convert_js_args_to_python_args,
+ date,
+ datetime,
+ file_type,
+ none_type,
+ validate_get_composed_info,
+)
+
+def lazy_import():
+ from petstore_api.model.child_cat_all_of import ChildCatAllOf
+ from petstore_api.model.parent_pet import ParentPet
+ globals()['ChildCatAllOf'] = ChildCatAllOf
+ globals()['ParentPet'] = ParentPet
+
+
+class ChildCat(ModelComposed):
+ """NOTE: This class is auto generated by OpenAPI Generator.
+ Ref: https://openapi-generator.tech
+
+ Do not edit the class manually.
+
+ Attributes:
+ allowed_values (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ with a capitalized key describing the allowed value and an allowed
+ value. These dicts store the allowed enum values.
+ attribute_map (dict): The key is attribute name
+ and the value is json key in definition.
+ discriminator_value_class_map (dict): A dict to go from the discriminator
+ variable value to the discriminator class name.
+ validations (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ that stores validations for max_length, min_length, max_items,
+ min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
+ inclusive_minimum, and regex.
+ additional_properties_type (tuple): A tuple of classes accepted
+ as additional properties values.
+ """
+
+ allowed_values = {
+ }
+
+ validations = {
+ }
+
+ additional_properties_type = None
+
+ _nullable = False
+
+ @cached_property
+ def openapi_types():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+
+ Returns
+ openapi_types (dict): The key is attribute name
+ and the value is attribute type.
+ """
+ lazy_import()
+ return {
+ 'pet_type': (str,), # noqa: E501
+ 'name': (str,), # noqa: E501
+ }
+
+ @cached_property
+ def discriminator():
+ val = {
+ }
+ if not val:
+ return None
+ return {'pet_type': val}
+
+ attribute_map = {
+ 'pet_type': 'pet_type', # noqa: E501
+ 'name': 'name', # noqa: E501
+ }
+
+ required_properties = set([
+ '_data_store',
+ '_check_type',
+ '_spec_property_naming',
+ '_path_to_item',
+ '_configuration',
+ '_visited_composed_classes',
+ '_composed_instances',
+ '_var_name_to_model_instances',
+ '_additional_properties_model_instances',
+ ])
+
+ @convert_js_args_to_python_args
+ def __init__(self, *args, **kwargs): # noqa: E501
+ """ChildCat - a model defined in OpenAPI
+
+ Keyword Args:
+ pet_type (str):
+ _check_type (bool): if True, values for parameters in openapi_types
+ will be type checked and a TypeError will be
+ raised if the wrong type is input.
+ Defaults to True
+ _path_to_item (tuple/list): This is a list of keys or values to
+ drill down to the model in received_data
+ when deserializing a response
+ _spec_property_naming (bool): True if the variable names in the input data
+ are serialized names, as specified in the OpenAPI document.
+ False if the variable names in the input data
+ are pythonic names, e.g. snake case (default)
+ _configuration (Configuration): the instance to use when
+ deserializing a file_type parameter.
+ If passed, type conversion is attempted
+ If omitted no type conversion is done.
+ _visited_composed_classes (tuple): This stores a tuple of
+ classes that we have traveled through so that
+ if we see that class again we will not use its
+ discriminator again.
+ When traveling through a discriminator, the
+ composed schema that is
+ is traveled through is added to this set.
+ For example if Animal has a discriminator
+ petType and we pass in "Dog", and the class Dog
+ allOf includes Animal, we move through Animal
+ once using the discriminator, and pick Dog.
+ Then in Dog, we will make an instance of the
+ Animal class but this time we won't travel
+ through its discriminator because we passed in
+ _visited_composed_classes = (Animal,)
+ name (str): [optional] # noqa: E501
+ """
+
+ _check_type = kwargs.pop('_check_type', True)
+ _spec_property_naming = kwargs.pop('_spec_property_naming', False)
+ _path_to_item = kwargs.pop('_path_to_item', ())
+ _configuration = kwargs.pop('_configuration', None)
+ _visited_composed_classes = kwargs.pop('_visited_composed_classes', ())
+
+ if args:
+ raise ApiTypeError(
+ "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % (
+ args,
+ self.__class__.__name__,
+ ),
+ path_to_item=_path_to_item,
+ valid_classes=(self.__class__,),
+ )
+
+ self._data_store = {}
+ self._check_type = _check_type
+ self._spec_property_naming = _spec_property_naming
+ self._path_to_item = _path_to_item
+ self._configuration = _configuration
+ self._visited_composed_classes = _visited_composed_classes + (self.__class__,)
+
+ constant_args = {
+ '_check_type': _check_type,
+ '_path_to_item': _path_to_item,
+ '_spec_property_naming': _spec_property_naming,
+ '_configuration': _configuration,
+ '_visited_composed_classes': self._visited_composed_classes,
+ }
+ composed_info = validate_get_composed_info(
+ constant_args, kwargs, self)
+ self._composed_instances = composed_info[0]
+ self._var_name_to_model_instances = composed_info[1]
+ self._additional_properties_model_instances = composed_info[2]
+ discarded_args = composed_info[3]
+
+ for var_name, var_value in kwargs.items():
+ if var_name in discarded_args and \
+ self._configuration is not None and \
+ self._configuration.discard_unknown_keys and \
+ self._additional_properties_model_instances:
+ # discard variable.
+ continue
+ setattr(self, var_name, var_value)
+
+ @cached_property
+ def _composed_schemas():
+ # we need this here to make our import statements work
+ # we must store _composed_schemas in here so the code is only run
+ # when we invoke this method. If we kept this at the class
+ # level we would get an error beause the class level
+ # code would be run when this module is imported, and these composed
+ # classes don't exist yet because their module has not finished
+ # loading
+ lazy_import()
+ return {
+ 'anyOf': [
+ ],
+ 'allOf': [
+ ChildCatAllOf,
+ ParentPet,
+ ],
+ 'oneOf': [
+ ],
+ }
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/child_cat_all_of.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/child_cat_all_of.py
new file mode 100644
index 000000000000..f0f1a1ae6bd4
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/child_cat_all_of.py
@@ -0,0 +1,166 @@
+"""
+ 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: https://openapi-generator.tech
+"""
+
+
+import re # noqa: F401
+import sys # noqa: F401
+
+from petstore_api.model_utils import ( # noqa: F401
+ ApiTypeError,
+ ModelComposed,
+ ModelNormal,
+ ModelSimple,
+ cached_property,
+ change_keys_js_to_python,
+ convert_js_args_to_python_args,
+ date,
+ datetime,
+ file_type,
+ none_type,
+ validate_get_composed_info,
+)
+
+
+class ChildCatAllOf(ModelNormal):
+ """NOTE: This class is auto generated by OpenAPI Generator.
+ Ref: https://openapi-generator.tech
+
+ Do not edit the class manually.
+
+ Attributes:
+ allowed_values (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ with a capitalized key describing the allowed value and an allowed
+ value. These dicts store the allowed enum values.
+ attribute_map (dict): The key is attribute name
+ and the value is json key in definition.
+ discriminator_value_class_map (dict): A dict to go from the discriminator
+ variable value to the discriminator class name.
+ validations (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ that stores validations for max_length, min_length, max_items,
+ min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
+ inclusive_minimum, and regex.
+ additional_properties_type (tuple): A tuple of classes accepted
+ as additional properties values.
+ """
+
+ allowed_values = {
+ }
+
+ validations = {
+ }
+
+ additional_properties_type = None
+
+ _nullable = False
+
+ @cached_property
+ def openapi_types():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+
+ Returns
+ openapi_types (dict): The key is attribute name
+ and the value is attribute type.
+ """
+ return {
+ 'name': (str,), # noqa: E501
+ }
+
+ @cached_property
+ def discriminator():
+ return None
+
+
+ attribute_map = {
+ 'name': 'name', # noqa: E501
+ }
+
+ _composed_schemas = {}
+
+ required_properties = set([
+ '_data_store',
+ '_check_type',
+ '_spec_property_naming',
+ '_path_to_item',
+ '_configuration',
+ '_visited_composed_classes',
+ ])
+
+ @convert_js_args_to_python_args
+ def __init__(self, *args, **kwargs): # noqa: E501
+ """ChildCatAllOf - a model defined in OpenAPI
+
+ Keyword Args:
+ _check_type (bool): if True, values for parameters in openapi_types
+ will be type checked and a TypeError will be
+ raised if the wrong type is input.
+ Defaults to True
+ _path_to_item (tuple/list): This is a list of keys or values to
+ drill down to the model in received_data
+ when deserializing a response
+ _spec_property_naming (bool): True if the variable names in the input data
+ are serialized names, as specified in the OpenAPI document.
+ False if the variable names in the input data
+ are pythonic names, e.g. snake case (default)
+ _configuration (Configuration): the instance to use when
+ deserializing a file_type parameter.
+ If passed, type conversion is attempted
+ If omitted no type conversion is done.
+ _visited_composed_classes (tuple): This stores a tuple of
+ classes that we have traveled through so that
+ if we see that class again we will not use its
+ discriminator again.
+ When traveling through a discriminator, the
+ composed schema that is
+ is traveled through is added to this set.
+ For example if Animal has a discriminator
+ petType and we pass in "Dog", and the class Dog
+ allOf includes Animal, we move through Animal
+ once using the discriminator, and pick Dog.
+ Then in Dog, we will make an instance of the
+ Animal class but this time we won't travel
+ through its discriminator because we passed in
+ _visited_composed_classes = (Animal,)
+ name (str): [optional] # noqa: E501
+ """
+
+ _check_type = kwargs.pop('_check_type', True)
+ _spec_property_naming = kwargs.pop('_spec_property_naming', False)
+ _path_to_item = kwargs.pop('_path_to_item', ())
+ _configuration = kwargs.pop('_configuration', None)
+ _visited_composed_classes = kwargs.pop('_visited_composed_classes', ())
+
+ if args:
+ raise ApiTypeError(
+ "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % (
+ args,
+ self.__class__.__name__,
+ ),
+ path_to_item=_path_to_item,
+ valid_classes=(self.__class__,),
+ )
+
+ self._data_store = {}
+ self._check_type = _check_type
+ self._spec_property_naming = _spec_property_naming
+ self._path_to_item = _path_to_item
+ self._configuration = _configuration
+ self._visited_composed_classes = _visited_composed_classes + (self.__class__,)
+
+ for var_name, var_value in kwargs.items():
+ if var_name not in self.attribute_map and \
+ self._configuration is not None and \
+ self._configuration.discard_unknown_keys and \
+ self.additional_properties_type is None:
+ # discard variable.
+ continue
+ setattr(self, var_name, var_value)
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/child_dog.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/child_dog.py
new file mode 100644
index 000000000000..df4956266ae6
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/child_dog.py
@@ -0,0 +1,215 @@
+"""
+ 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: https://openapi-generator.tech
+"""
+
+
+import re # noqa: F401
+import sys # noqa: F401
+
+from petstore_api.model_utils import ( # noqa: F401
+ ApiTypeError,
+ ModelComposed,
+ ModelNormal,
+ ModelSimple,
+ cached_property,
+ change_keys_js_to_python,
+ convert_js_args_to_python_args,
+ date,
+ datetime,
+ file_type,
+ none_type,
+ validate_get_composed_info,
+)
+
+def lazy_import():
+ from petstore_api.model.child_dog_all_of import ChildDogAllOf
+ from petstore_api.model.parent_pet import ParentPet
+ globals()['ChildDogAllOf'] = ChildDogAllOf
+ globals()['ParentPet'] = ParentPet
+
+
+class ChildDog(ModelComposed):
+ """NOTE: This class is auto generated by OpenAPI Generator.
+ Ref: https://openapi-generator.tech
+
+ Do not edit the class manually.
+
+ Attributes:
+ allowed_values (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ with a capitalized key describing the allowed value and an allowed
+ value. These dicts store the allowed enum values.
+ attribute_map (dict): The key is attribute name
+ and the value is json key in definition.
+ discriminator_value_class_map (dict): A dict to go from the discriminator
+ variable value to the discriminator class name.
+ validations (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ that stores validations for max_length, min_length, max_items,
+ min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
+ inclusive_minimum, and regex.
+ additional_properties_type (tuple): A tuple of classes accepted
+ as additional properties values.
+ """
+
+ allowed_values = {
+ }
+
+ validations = {
+ }
+
+ additional_properties_type = None
+
+ _nullable = False
+
+ @cached_property
+ def openapi_types():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+
+ Returns
+ openapi_types (dict): The key is attribute name
+ and the value is attribute type.
+ """
+ lazy_import()
+ return {
+ 'pet_type': (str,), # noqa: E501
+ 'bark': (str,), # noqa: E501
+ }
+
+ @cached_property
+ def discriminator():
+ val = {
+ }
+ if not val:
+ return None
+ return {'pet_type': val}
+
+ attribute_map = {
+ 'pet_type': 'pet_type', # noqa: E501
+ 'bark': 'bark', # noqa: E501
+ }
+
+ required_properties = set([
+ '_data_store',
+ '_check_type',
+ '_spec_property_naming',
+ '_path_to_item',
+ '_configuration',
+ '_visited_composed_classes',
+ '_composed_instances',
+ '_var_name_to_model_instances',
+ '_additional_properties_model_instances',
+ ])
+
+ @convert_js_args_to_python_args
+ def __init__(self, *args, **kwargs): # noqa: E501
+ """ChildDog - a model defined in OpenAPI
+
+ Keyword Args:
+ pet_type (str):
+ _check_type (bool): if True, values for parameters in openapi_types
+ will be type checked and a TypeError will be
+ raised if the wrong type is input.
+ Defaults to True
+ _path_to_item (tuple/list): This is a list of keys or values to
+ drill down to the model in received_data
+ when deserializing a response
+ _spec_property_naming (bool): True if the variable names in the input data
+ are serialized names, as specified in the OpenAPI document.
+ False if the variable names in the input data
+ are pythonic names, e.g. snake case (default)
+ _configuration (Configuration): the instance to use when
+ deserializing a file_type parameter.
+ If passed, type conversion is attempted
+ If omitted no type conversion is done.
+ _visited_composed_classes (tuple): This stores a tuple of
+ classes that we have traveled through so that
+ if we see that class again we will not use its
+ discriminator again.
+ When traveling through a discriminator, the
+ composed schema that is
+ is traveled through is added to this set.
+ For example if Animal has a discriminator
+ petType and we pass in "Dog", and the class Dog
+ allOf includes Animal, we move through Animal
+ once using the discriminator, and pick Dog.
+ Then in Dog, we will make an instance of the
+ Animal class but this time we won't travel
+ through its discriminator because we passed in
+ _visited_composed_classes = (Animal,)
+ bark (str): [optional] # noqa: E501
+ """
+
+ _check_type = kwargs.pop('_check_type', True)
+ _spec_property_naming = kwargs.pop('_spec_property_naming', False)
+ _path_to_item = kwargs.pop('_path_to_item', ())
+ _configuration = kwargs.pop('_configuration', None)
+ _visited_composed_classes = kwargs.pop('_visited_composed_classes', ())
+
+ if args:
+ raise ApiTypeError(
+ "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % (
+ args,
+ self.__class__.__name__,
+ ),
+ path_to_item=_path_to_item,
+ valid_classes=(self.__class__,),
+ )
+
+ self._data_store = {}
+ self._check_type = _check_type
+ self._spec_property_naming = _spec_property_naming
+ self._path_to_item = _path_to_item
+ self._configuration = _configuration
+ self._visited_composed_classes = _visited_composed_classes + (self.__class__,)
+
+ constant_args = {
+ '_check_type': _check_type,
+ '_path_to_item': _path_to_item,
+ '_spec_property_naming': _spec_property_naming,
+ '_configuration': _configuration,
+ '_visited_composed_classes': self._visited_composed_classes,
+ }
+ composed_info = validate_get_composed_info(
+ constant_args, kwargs, self)
+ self._composed_instances = composed_info[0]
+ self._var_name_to_model_instances = composed_info[1]
+ self._additional_properties_model_instances = composed_info[2]
+ discarded_args = composed_info[3]
+
+ for var_name, var_value in kwargs.items():
+ if var_name in discarded_args and \
+ self._configuration is not None and \
+ self._configuration.discard_unknown_keys and \
+ self._additional_properties_model_instances:
+ # discard variable.
+ continue
+ setattr(self, var_name, var_value)
+
+ @cached_property
+ def _composed_schemas():
+ # we need this here to make our import statements work
+ # we must store _composed_schemas in here so the code is only run
+ # when we invoke this method. If we kept this at the class
+ # level we would get an error beause the class level
+ # code would be run when this module is imported, and these composed
+ # classes don't exist yet because their module has not finished
+ # loading
+ lazy_import()
+ return {
+ 'anyOf': [
+ ],
+ 'allOf': [
+ ChildDogAllOf,
+ ParentPet,
+ ],
+ 'oneOf': [
+ ],
+ }
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/child_dog_all_of.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/child_dog_all_of.py
new file mode 100644
index 000000000000..d460b68b3d3a
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/child_dog_all_of.py
@@ -0,0 +1,166 @@
+"""
+ 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: https://openapi-generator.tech
+"""
+
+
+import re # noqa: F401
+import sys # noqa: F401
+
+from petstore_api.model_utils import ( # noqa: F401
+ ApiTypeError,
+ ModelComposed,
+ ModelNormal,
+ ModelSimple,
+ cached_property,
+ change_keys_js_to_python,
+ convert_js_args_to_python_args,
+ date,
+ datetime,
+ file_type,
+ none_type,
+ validate_get_composed_info,
+)
+
+
+class ChildDogAllOf(ModelNormal):
+ """NOTE: This class is auto generated by OpenAPI Generator.
+ Ref: https://openapi-generator.tech
+
+ Do not edit the class manually.
+
+ Attributes:
+ allowed_values (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ with a capitalized key describing the allowed value and an allowed
+ value. These dicts store the allowed enum values.
+ attribute_map (dict): The key is attribute name
+ and the value is json key in definition.
+ discriminator_value_class_map (dict): A dict to go from the discriminator
+ variable value to the discriminator class name.
+ validations (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ that stores validations for max_length, min_length, max_items,
+ min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
+ inclusive_minimum, and regex.
+ additional_properties_type (tuple): A tuple of classes accepted
+ as additional properties values.
+ """
+
+ allowed_values = {
+ }
+
+ validations = {
+ }
+
+ additional_properties_type = None
+
+ _nullable = False
+
+ @cached_property
+ def openapi_types():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+
+ Returns
+ openapi_types (dict): The key is attribute name
+ and the value is attribute type.
+ """
+ return {
+ 'bark': (str,), # noqa: E501
+ }
+
+ @cached_property
+ def discriminator():
+ return None
+
+
+ attribute_map = {
+ 'bark': 'bark', # noqa: E501
+ }
+
+ _composed_schemas = {}
+
+ required_properties = set([
+ '_data_store',
+ '_check_type',
+ '_spec_property_naming',
+ '_path_to_item',
+ '_configuration',
+ '_visited_composed_classes',
+ ])
+
+ @convert_js_args_to_python_args
+ def __init__(self, *args, **kwargs): # noqa: E501
+ """ChildDogAllOf - a model defined in OpenAPI
+
+ Keyword Args:
+ _check_type (bool): if True, values for parameters in openapi_types
+ will be type checked and a TypeError will be
+ raised if the wrong type is input.
+ Defaults to True
+ _path_to_item (tuple/list): This is a list of keys or values to
+ drill down to the model in received_data
+ when deserializing a response
+ _spec_property_naming (bool): True if the variable names in the input data
+ are serialized names, as specified in the OpenAPI document.
+ False if the variable names in the input data
+ are pythonic names, e.g. snake case (default)
+ _configuration (Configuration): the instance to use when
+ deserializing a file_type parameter.
+ If passed, type conversion is attempted
+ If omitted no type conversion is done.
+ _visited_composed_classes (tuple): This stores a tuple of
+ classes that we have traveled through so that
+ if we see that class again we will not use its
+ discriminator again.
+ When traveling through a discriminator, the
+ composed schema that is
+ is traveled through is added to this set.
+ For example if Animal has a discriminator
+ petType and we pass in "Dog", and the class Dog
+ allOf includes Animal, we move through Animal
+ once using the discriminator, and pick Dog.
+ Then in Dog, we will make an instance of the
+ Animal class but this time we won't travel
+ through its discriminator because we passed in
+ _visited_composed_classes = (Animal,)
+ bark (str): [optional] # noqa: E501
+ """
+
+ _check_type = kwargs.pop('_check_type', True)
+ _spec_property_naming = kwargs.pop('_spec_property_naming', False)
+ _path_to_item = kwargs.pop('_path_to_item', ())
+ _configuration = kwargs.pop('_configuration', None)
+ _visited_composed_classes = kwargs.pop('_visited_composed_classes', ())
+
+ if args:
+ raise ApiTypeError(
+ "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % (
+ args,
+ self.__class__.__name__,
+ ),
+ path_to_item=_path_to_item,
+ valid_classes=(self.__class__,),
+ )
+
+ self._data_store = {}
+ self._check_type = _check_type
+ self._spec_property_naming = _spec_property_naming
+ self._path_to_item = _path_to_item
+ self._configuration = _configuration
+ self._visited_composed_classes = _visited_composed_classes + (self.__class__,)
+
+ for var_name, var_value in kwargs.items():
+ if var_name not in self.attribute_map and \
+ self._configuration is not None and \
+ self._configuration.discard_unknown_keys and \
+ self.additional_properties_type is None:
+ # discard variable.
+ continue
+ setattr(self, var_name, var_value)
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/child_lizard.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/child_lizard.py
new file mode 100644
index 000000000000..1f50ba403ed1
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/child_lizard.py
@@ -0,0 +1,215 @@
+"""
+ 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: https://openapi-generator.tech
+"""
+
+
+import re # noqa: F401
+import sys # noqa: F401
+
+from petstore_api.model_utils import ( # noqa: F401
+ ApiTypeError,
+ ModelComposed,
+ ModelNormal,
+ ModelSimple,
+ cached_property,
+ change_keys_js_to_python,
+ convert_js_args_to_python_args,
+ date,
+ datetime,
+ file_type,
+ none_type,
+ validate_get_composed_info,
+)
+
+def lazy_import():
+ from petstore_api.model.child_lizard_all_of import ChildLizardAllOf
+ from petstore_api.model.parent_pet import ParentPet
+ globals()['ChildLizardAllOf'] = ChildLizardAllOf
+ globals()['ParentPet'] = ParentPet
+
+
+class ChildLizard(ModelComposed):
+ """NOTE: This class is auto generated by OpenAPI Generator.
+ Ref: https://openapi-generator.tech
+
+ Do not edit the class manually.
+
+ Attributes:
+ allowed_values (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ with a capitalized key describing the allowed value and an allowed
+ value. These dicts store the allowed enum values.
+ attribute_map (dict): The key is attribute name
+ and the value is json key in definition.
+ discriminator_value_class_map (dict): A dict to go from the discriminator
+ variable value to the discriminator class name.
+ validations (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ that stores validations for max_length, min_length, max_items,
+ min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
+ inclusive_minimum, and regex.
+ additional_properties_type (tuple): A tuple of classes accepted
+ as additional properties values.
+ """
+
+ allowed_values = {
+ }
+
+ validations = {
+ }
+
+ additional_properties_type = None
+
+ _nullable = False
+
+ @cached_property
+ def openapi_types():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+
+ Returns
+ openapi_types (dict): The key is attribute name
+ and the value is attribute type.
+ """
+ lazy_import()
+ return {
+ 'pet_type': (str,), # noqa: E501
+ 'loves_rocks': (bool,), # noqa: E501
+ }
+
+ @cached_property
+ def discriminator():
+ val = {
+ }
+ if not val:
+ return None
+ return {'pet_type': val}
+
+ attribute_map = {
+ 'pet_type': 'pet_type', # noqa: E501
+ 'loves_rocks': 'lovesRocks', # noqa: E501
+ }
+
+ required_properties = set([
+ '_data_store',
+ '_check_type',
+ '_spec_property_naming',
+ '_path_to_item',
+ '_configuration',
+ '_visited_composed_classes',
+ '_composed_instances',
+ '_var_name_to_model_instances',
+ '_additional_properties_model_instances',
+ ])
+
+ @convert_js_args_to_python_args
+ def __init__(self, *args, **kwargs): # noqa: E501
+ """ChildLizard - a model defined in OpenAPI
+
+ Keyword Args:
+ pet_type (str):
+ _check_type (bool): if True, values for parameters in openapi_types
+ will be type checked and a TypeError will be
+ raised if the wrong type is input.
+ Defaults to True
+ _path_to_item (tuple/list): This is a list of keys or values to
+ drill down to the model in received_data
+ when deserializing a response
+ _spec_property_naming (bool): True if the variable names in the input data
+ are serialized names, as specified in the OpenAPI document.
+ False if the variable names in the input data
+ are pythonic names, e.g. snake case (default)
+ _configuration (Configuration): the instance to use when
+ deserializing a file_type parameter.
+ If passed, type conversion is attempted
+ If omitted no type conversion is done.
+ _visited_composed_classes (tuple): This stores a tuple of
+ classes that we have traveled through so that
+ if we see that class again we will not use its
+ discriminator again.
+ When traveling through a discriminator, the
+ composed schema that is
+ is traveled through is added to this set.
+ For example if Animal has a discriminator
+ petType and we pass in "Dog", and the class Dog
+ allOf includes Animal, we move through Animal
+ once using the discriminator, and pick Dog.
+ Then in Dog, we will make an instance of the
+ Animal class but this time we won't travel
+ through its discriminator because we passed in
+ _visited_composed_classes = (Animal,)
+ loves_rocks (bool): [optional] # noqa: E501
+ """
+
+ _check_type = kwargs.pop('_check_type', True)
+ _spec_property_naming = kwargs.pop('_spec_property_naming', False)
+ _path_to_item = kwargs.pop('_path_to_item', ())
+ _configuration = kwargs.pop('_configuration', None)
+ _visited_composed_classes = kwargs.pop('_visited_composed_classes', ())
+
+ if args:
+ raise ApiTypeError(
+ "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % (
+ args,
+ self.__class__.__name__,
+ ),
+ path_to_item=_path_to_item,
+ valid_classes=(self.__class__,),
+ )
+
+ self._data_store = {}
+ self._check_type = _check_type
+ self._spec_property_naming = _spec_property_naming
+ self._path_to_item = _path_to_item
+ self._configuration = _configuration
+ self._visited_composed_classes = _visited_composed_classes + (self.__class__,)
+
+ constant_args = {
+ '_check_type': _check_type,
+ '_path_to_item': _path_to_item,
+ '_spec_property_naming': _spec_property_naming,
+ '_configuration': _configuration,
+ '_visited_composed_classes': self._visited_composed_classes,
+ }
+ composed_info = validate_get_composed_info(
+ constant_args, kwargs, self)
+ self._composed_instances = composed_info[0]
+ self._var_name_to_model_instances = composed_info[1]
+ self._additional_properties_model_instances = composed_info[2]
+ discarded_args = composed_info[3]
+
+ for var_name, var_value in kwargs.items():
+ if var_name in discarded_args and \
+ self._configuration is not None and \
+ self._configuration.discard_unknown_keys and \
+ self._additional_properties_model_instances:
+ # discard variable.
+ continue
+ setattr(self, var_name, var_value)
+
+ @cached_property
+ def _composed_schemas():
+ # we need this here to make our import statements work
+ # we must store _composed_schemas in here so the code is only run
+ # when we invoke this method. If we kept this at the class
+ # level we would get an error beause the class level
+ # code would be run when this module is imported, and these composed
+ # classes don't exist yet because their module has not finished
+ # loading
+ lazy_import()
+ return {
+ 'anyOf': [
+ ],
+ 'allOf': [
+ ChildLizardAllOf,
+ ParentPet,
+ ],
+ 'oneOf': [
+ ],
+ }
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/child_lizard_all_of.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/child_lizard_all_of.py
new file mode 100644
index 000000000000..669b9338d796
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/child_lizard_all_of.py
@@ -0,0 +1,166 @@
+"""
+ 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: https://openapi-generator.tech
+"""
+
+
+import re # noqa: F401
+import sys # noqa: F401
+
+from petstore_api.model_utils import ( # noqa: F401
+ ApiTypeError,
+ ModelComposed,
+ ModelNormal,
+ ModelSimple,
+ cached_property,
+ change_keys_js_to_python,
+ convert_js_args_to_python_args,
+ date,
+ datetime,
+ file_type,
+ none_type,
+ validate_get_composed_info,
+)
+
+
+class ChildLizardAllOf(ModelNormal):
+ """NOTE: This class is auto generated by OpenAPI Generator.
+ Ref: https://openapi-generator.tech
+
+ Do not edit the class manually.
+
+ Attributes:
+ allowed_values (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ with a capitalized key describing the allowed value and an allowed
+ value. These dicts store the allowed enum values.
+ attribute_map (dict): The key is attribute name
+ and the value is json key in definition.
+ discriminator_value_class_map (dict): A dict to go from the discriminator
+ variable value to the discriminator class name.
+ validations (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ that stores validations for max_length, min_length, max_items,
+ min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
+ inclusive_minimum, and regex.
+ additional_properties_type (tuple): A tuple of classes accepted
+ as additional properties values.
+ """
+
+ allowed_values = {
+ }
+
+ validations = {
+ }
+
+ additional_properties_type = None
+
+ _nullable = False
+
+ @cached_property
+ def openapi_types():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+
+ Returns
+ openapi_types (dict): The key is attribute name
+ and the value is attribute type.
+ """
+ return {
+ 'loves_rocks': (bool,), # noqa: E501
+ }
+
+ @cached_property
+ def discriminator():
+ return None
+
+
+ attribute_map = {
+ 'loves_rocks': 'lovesRocks', # noqa: E501
+ }
+
+ _composed_schemas = {}
+
+ required_properties = set([
+ '_data_store',
+ '_check_type',
+ '_spec_property_naming',
+ '_path_to_item',
+ '_configuration',
+ '_visited_composed_classes',
+ ])
+
+ @convert_js_args_to_python_args
+ def __init__(self, *args, **kwargs): # noqa: E501
+ """ChildLizardAllOf - a model defined in OpenAPI
+
+ Keyword Args:
+ _check_type (bool): if True, values for parameters in openapi_types
+ will be type checked and a TypeError will be
+ raised if the wrong type is input.
+ Defaults to True
+ _path_to_item (tuple/list): This is a list of keys or values to
+ drill down to the model in received_data
+ when deserializing a response
+ _spec_property_naming (bool): True if the variable names in the input data
+ are serialized names, as specified in the OpenAPI document.
+ False if the variable names in the input data
+ are pythonic names, e.g. snake case (default)
+ _configuration (Configuration): the instance to use when
+ deserializing a file_type parameter.
+ If passed, type conversion is attempted
+ If omitted no type conversion is done.
+ _visited_composed_classes (tuple): This stores a tuple of
+ classes that we have traveled through so that
+ if we see that class again we will not use its
+ discriminator again.
+ When traveling through a discriminator, the
+ composed schema that is
+ is traveled through is added to this set.
+ For example if Animal has a discriminator
+ petType and we pass in "Dog", and the class Dog
+ allOf includes Animal, we move through Animal
+ once using the discriminator, and pick Dog.
+ Then in Dog, we will make an instance of the
+ Animal class but this time we won't travel
+ through its discriminator because we passed in
+ _visited_composed_classes = (Animal,)
+ loves_rocks (bool): [optional] # noqa: E501
+ """
+
+ _check_type = kwargs.pop('_check_type', True)
+ _spec_property_naming = kwargs.pop('_spec_property_naming', False)
+ _path_to_item = kwargs.pop('_path_to_item', ())
+ _configuration = kwargs.pop('_configuration', None)
+ _visited_composed_classes = kwargs.pop('_visited_composed_classes', ())
+
+ if args:
+ raise ApiTypeError(
+ "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % (
+ args,
+ self.__class__.__name__,
+ ),
+ path_to_item=_path_to_item,
+ valid_classes=(self.__class__,),
+ )
+
+ self._data_store = {}
+ self._check_type = _check_type
+ self._spec_property_naming = _spec_property_naming
+ self._path_to_item = _path_to_item
+ self._configuration = _configuration
+ self._visited_composed_classes = _visited_composed_classes + (self.__class__,)
+
+ for var_name, var_value in kwargs.items():
+ if var_name not in self.attribute_map and \
+ self._configuration is not None and \
+ self._configuration.discard_unknown_keys and \
+ self.additional_properties_type is None:
+ # discard variable.
+ continue
+ setattr(self, var_name, var_value)
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/class_model.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/class_model.py
new file mode 100644
index 000000000000..18c16f89f908
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/class_model.py
@@ -0,0 +1,166 @@
+"""
+ 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: https://openapi-generator.tech
+"""
+
+
+import re # noqa: F401
+import sys # noqa: F401
+
+from petstore_api.model_utils import ( # noqa: F401
+ ApiTypeError,
+ ModelComposed,
+ ModelNormal,
+ ModelSimple,
+ cached_property,
+ change_keys_js_to_python,
+ convert_js_args_to_python_args,
+ date,
+ datetime,
+ file_type,
+ none_type,
+ validate_get_composed_info,
+)
+
+
+class ClassModel(ModelNormal):
+ """NOTE: This class is auto generated by OpenAPI Generator.
+ Ref: https://openapi-generator.tech
+
+ Do not edit the class manually.
+
+ Attributes:
+ allowed_values (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ with a capitalized key describing the allowed value and an allowed
+ value. These dicts store the allowed enum values.
+ attribute_map (dict): The key is attribute name
+ and the value is json key in definition.
+ discriminator_value_class_map (dict): A dict to go from the discriminator
+ variable value to the discriminator class name.
+ validations (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ that stores validations for max_length, min_length, max_items,
+ min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
+ inclusive_minimum, and regex.
+ additional_properties_type (tuple): A tuple of classes accepted
+ as additional properties values.
+ """
+
+ allowed_values = {
+ }
+
+ validations = {
+ }
+
+ additional_properties_type = None
+
+ _nullable = False
+
+ @cached_property
+ def openapi_types():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+
+ Returns
+ openapi_types (dict): The key is attribute name
+ and the value is attribute type.
+ """
+ return {
+ '_class': (str,), # noqa: E501
+ }
+
+ @cached_property
+ def discriminator():
+ return None
+
+
+ attribute_map = {
+ '_class': '_class', # noqa: E501
+ }
+
+ _composed_schemas = {}
+
+ required_properties = set([
+ '_data_store',
+ '_check_type',
+ '_spec_property_naming',
+ '_path_to_item',
+ '_configuration',
+ '_visited_composed_classes',
+ ])
+
+ @convert_js_args_to_python_args
+ def __init__(self, *args, **kwargs): # noqa: E501
+ """ClassModel - a model defined in OpenAPI
+
+ Keyword Args:
+ _check_type (bool): if True, values for parameters in openapi_types
+ will be type checked and a TypeError will be
+ raised if the wrong type is input.
+ Defaults to True
+ _path_to_item (tuple/list): This is a list of keys or values to
+ drill down to the model in received_data
+ when deserializing a response
+ _spec_property_naming (bool): True if the variable names in the input data
+ are serialized names, as specified in the OpenAPI document.
+ False if the variable names in the input data
+ are pythonic names, e.g. snake case (default)
+ _configuration (Configuration): the instance to use when
+ deserializing a file_type parameter.
+ If passed, type conversion is attempted
+ If omitted no type conversion is done.
+ _visited_composed_classes (tuple): This stores a tuple of
+ classes that we have traveled through so that
+ if we see that class again we will not use its
+ discriminator again.
+ When traveling through a discriminator, the
+ composed schema that is
+ is traveled through is added to this set.
+ For example if Animal has a discriminator
+ petType and we pass in "Dog", and the class Dog
+ allOf includes Animal, we move through Animal
+ once using the discriminator, and pick Dog.
+ Then in Dog, we will make an instance of the
+ Animal class but this time we won't travel
+ through its discriminator because we passed in
+ _visited_composed_classes = (Animal,)
+ _class (str): [optional] # noqa: E501
+ """
+
+ _check_type = kwargs.pop('_check_type', True)
+ _spec_property_naming = kwargs.pop('_spec_property_naming', False)
+ _path_to_item = kwargs.pop('_path_to_item', ())
+ _configuration = kwargs.pop('_configuration', None)
+ _visited_composed_classes = kwargs.pop('_visited_composed_classes', ())
+
+ if args:
+ raise ApiTypeError(
+ "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % (
+ args,
+ self.__class__.__name__,
+ ),
+ path_to_item=_path_to_item,
+ valid_classes=(self.__class__,),
+ )
+
+ self._data_store = {}
+ self._check_type = _check_type
+ self._spec_property_naming = _spec_property_naming
+ self._path_to_item = _path_to_item
+ self._configuration = _configuration
+ self._visited_composed_classes = _visited_composed_classes + (self.__class__,)
+
+ for var_name, var_value in kwargs.items():
+ if var_name not in self.attribute_map and \
+ self._configuration is not None and \
+ self._configuration.discard_unknown_keys and \
+ self.additional_properties_type is None:
+ # discard variable.
+ continue
+ setattr(self, var_name, var_value)
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/client.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/client.py
new file mode 100644
index 000000000000..da615c547731
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/client.py
@@ -0,0 +1,166 @@
+"""
+ 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: https://openapi-generator.tech
+"""
+
+
+import re # noqa: F401
+import sys # noqa: F401
+
+from petstore_api.model_utils import ( # noqa: F401
+ ApiTypeError,
+ ModelComposed,
+ ModelNormal,
+ ModelSimple,
+ cached_property,
+ change_keys_js_to_python,
+ convert_js_args_to_python_args,
+ date,
+ datetime,
+ file_type,
+ none_type,
+ validate_get_composed_info,
+)
+
+
+class Client(ModelNormal):
+ """NOTE: This class is auto generated by OpenAPI Generator.
+ Ref: https://openapi-generator.tech
+
+ Do not edit the class manually.
+
+ Attributes:
+ allowed_values (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ with a capitalized key describing the allowed value and an allowed
+ value. These dicts store the allowed enum values.
+ attribute_map (dict): The key is attribute name
+ and the value is json key in definition.
+ discriminator_value_class_map (dict): A dict to go from the discriminator
+ variable value to the discriminator class name.
+ validations (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ that stores validations for max_length, min_length, max_items,
+ min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
+ inclusive_minimum, and regex.
+ additional_properties_type (tuple): A tuple of classes accepted
+ as additional properties values.
+ """
+
+ allowed_values = {
+ }
+
+ validations = {
+ }
+
+ additional_properties_type = None
+
+ _nullable = False
+
+ @cached_property
+ def openapi_types():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+
+ Returns
+ openapi_types (dict): The key is attribute name
+ and the value is attribute type.
+ """
+ return {
+ 'client': (str,), # noqa: E501
+ }
+
+ @cached_property
+ def discriminator():
+ return None
+
+
+ attribute_map = {
+ 'client': 'client', # noqa: E501
+ }
+
+ _composed_schemas = {}
+
+ required_properties = set([
+ '_data_store',
+ '_check_type',
+ '_spec_property_naming',
+ '_path_to_item',
+ '_configuration',
+ '_visited_composed_classes',
+ ])
+
+ @convert_js_args_to_python_args
+ def __init__(self, *args, **kwargs): # noqa: E501
+ """Client - a model defined in OpenAPI
+
+ Keyword Args:
+ _check_type (bool): if True, values for parameters in openapi_types
+ will be type checked and a TypeError will be
+ raised if the wrong type is input.
+ Defaults to True
+ _path_to_item (tuple/list): This is a list of keys or values to
+ drill down to the model in received_data
+ when deserializing a response
+ _spec_property_naming (bool): True if the variable names in the input data
+ are serialized names, as specified in the OpenAPI document.
+ False if the variable names in the input data
+ are pythonic names, e.g. snake case (default)
+ _configuration (Configuration): the instance to use when
+ deserializing a file_type parameter.
+ If passed, type conversion is attempted
+ If omitted no type conversion is done.
+ _visited_composed_classes (tuple): This stores a tuple of
+ classes that we have traveled through so that
+ if we see that class again we will not use its
+ discriminator again.
+ When traveling through a discriminator, the
+ composed schema that is
+ is traveled through is added to this set.
+ For example if Animal has a discriminator
+ petType and we pass in "Dog", and the class Dog
+ allOf includes Animal, we move through Animal
+ once using the discriminator, and pick Dog.
+ Then in Dog, we will make an instance of the
+ Animal class but this time we won't travel
+ through its discriminator because we passed in
+ _visited_composed_classes = (Animal,)
+ client (str): [optional] # noqa: E501
+ """
+
+ _check_type = kwargs.pop('_check_type', True)
+ _spec_property_naming = kwargs.pop('_spec_property_naming', False)
+ _path_to_item = kwargs.pop('_path_to_item', ())
+ _configuration = kwargs.pop('_configuration', None)
+ _visited_composed_classes = kwargs.pop('_visited_composed_classes', ())
+
+ if args:
+ raise ApiTypeError(
+ "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % (
+ args,
+ self.__class__.__name__,
+ ),
+ path_to_item=_path_to_item,
+ valid_classes=(self.__class__,),
+ )
+
+ self._data_store = {}
+ self._check_type = _check_type
+ self._spec_property_naming = _spec_property_naming
+ self._path_to_item = _path_to_item
+ self._configuration = _configuration
+ self._visited_composed_classes = _visited_composed_classes + (self.__class__,)
+
+ for var_name, var_value in kwargs.items():
+ if var_name not in self.attribute_map and \
+ self._configuration is not None and \
+ self._configuration.discard_unknown_keys and \
+ self.additional_properties_type is None:
+ # discard variable.
+ continue
+ setattr(self, var_name, var_value)
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/dog.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/dog.py
new file mode 100644
index 000000000000..e29ffa336029
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/dog.py
@@ -0,0 +1,218 @@
+"""
+ 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: https://openapi-generator.tech
+"""
+
+
+import re # noqa: F401
+import sys # noqa: F401
+
+from petstore_api.model_utils import ( # noqa: F401
+ ApiTypeError,
+ ModelComposed,
+ ModelNormal,
+ ModelSimple,
+ cached_property,
+ change_keys_js_to_python,
+ convert_js_args_to_python_args,
+ date,
+ datetime,
+ file_type,
+ none_type,
+ validate_get_composed_info,
+)
+
+def lazy_import():
+ from petstore_api.model.animal import Animal
+ from petstore_api.model.dog_all_of import DogAllOf
+ globals()['Animal'] = Animal
+ globals()['DogAllOf'] = DogAllOf
+
+
+class Dog(ModelComposed):
+ """NOTE: This class is auto generated by OpenAPI Generator.
+ Ref: https://openapi-generator.tech
+
+ Do not edit the class manually.
+
+ Attributes:
+ allowed_values (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ with a capitalized key describing the allowed value and an allowed
+ value. These dicts store the allowed enum values.
+ attribute_map (dict): The key is attribute name
+ and the value is json key in definition.
+ discriminator_value_class_map (dict): A dict to go from the discriminator
+ variable value to the discriminator class name.
+ validations (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ that stores validations for max_length, min_length, max_items,
+ min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
+ inclusive_minimum, and regex.
+ additional_properties_type (tuple): A tuple of classes accepted
+ as additional properties values.
+ """
+
+ allowed_values = {
+ }
+
+ validations = {
+ }
+
+ additional_properties_type = None
+
+ _nullable = False
+
+ @cached_property
+ def openapi_types():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+
+ Returns
+ openapi_types (dict): The key is attribute name
+ and the value is attribute type.
+ """
+ lazy_import()
+ return {
+ 'class_name': (str,), # noqa: E501
+ 'breed': (str,), # noqa: E501
+ 'color': (str,), # noqa: E501
+ }
+
+ @cached_property
+ def discriminator():
+ val = {
+ }
+ if not val:
+ return None
+ return {'class_name': val}
+
+ attribute_map = {
+ 'class_name': 'className', # noqa: E501
+ 'breed': 'breed', # noqa: E501
+ 'color': 'color', # noqa: E501
+ }
+
+ required_properties = set([
+ '_data_store',
+ '_check_type',
+ '_spec_property_naming',
+ '_path_to_item',
+ '_configuration',
+ '_visited_composed_classes',
+ '_composed_instances',
+ '_var_name_to_model_instances',
+ '_additional_properties_model_instances',
+ ])
+
+ @convert_js_args_to_python_args
+ def __init__(self, *args, **kwargs): # noqa: E501
+ """Dog - a model defined in OpenAPI
+
+ Keyword Args:
+ class_name (str):
+ _check_type (bool): if True, values for parameters in openapi_types
+ will be type checked and a TypeError will be
+ raised if the wrong type is input.
+ Defaults to True
+ _path_to_item (tuple/list): This is a list of keys or values to
+ drill down to the model in received_data
+ when deserializing a response
+ _spec_property_naming (bool): True if the variable names in the input data
+ are serialized names, as specified in the OpenAPI document.
+ False if the variable names in the input data
+ are pythonic names, e.g. snake case (default)
+ _configuration (Configuration): the instance to use when
+ deserializing a file_type parameter.
+ If passed, type conversion is attempted
+ If omitted no type conversion is done.
+ _visited_composed_classes (tuple): This stores a tuple of
+ classes that we have traveled through so that
+ if we see that class again we will not use its
+ discriminator again.
+ When traveling through a discriminator, the
+ composed schema that is
+ is traveled through is added to this set.
+ For example if Animal has a discriminator
+ petType and we pass in "Dog", and the class Dog
+ allOf includes Animal, we move through Animal
+ once using the discriminator, and pick Dog.
+ Then in Dog, we will make an instance of the
+ Animal class but this time we won't travel
+ through its discriminator because we passed in
+ _visited_composed_classes = (Animal,)
+ breed (str): [optional] # noqa: E501
+ color (str): [optional] if omitted the server will use the default value of "red" # noqa: E501
+ """
+
+ _check_type = kwargs.pop('_check_type', True)
+ _spec_property_naming = kwargs.pop('_spec_property_naming', False)
+ _path_to_item = kwargs.pop('_path_to_item', ())
+ _configuration = kwargs.pop('_configuration', None)
+ _visited_composed_classes = kwargs.pop('_visited_composed_classes', ())
+
+ if args:
+ raise ApiTypeError(
+ "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % (
+ args,
+ self.__class__.__name__,
+ ),
+ path_to_item=_path_to_item,
+ valid_classes=(self.__class__,),
+ )
+
+ self._data_store = {}
+ self._check_type = _check_type
+ self._spec_property_naming = _spec_property_naming
+ self._path_to_item = _path_to_item
+ self._configuration = _configuration
+ self._visited_composed_classes = _visited_composed_classes + (self.__class__,)
+
+ constant_args = {
+ '_check_type': _check_type,
+ '_path_to_item': _path_to_item,
+ '_spec_property_naming': _spec_property_naming,
+ '_configuration': _configuration,
+ '_visited_composed_classes': self._visited_composed_classes,
+ }
+ composed_info = validate_get_composed_info(
+ constant_args, kwargs, self)
+ self._composed_instances = composed_info[0]
+ self._var_name_to_model_instances = composed_info[1]
+ self._additional_properties_model_instances = composed_info[2]
+ discarded_args = composed_info[3]
+
+ for var_name, var_value in kwargs.items():
+ if var_name in discarded_args and \
+ self._configuration is not None and \
+ self._configuration.discard_unknown_keys and \
+ self._additional_properties_model_instances:
+ # discard variable.
+ continue
+ setattr(self, var_name, var_value)
+
+ @cached_property
+ def _composed_schemas():
+ # we need this here to make our import statements work
+ # we must store _composed_schemas in here so the code is only run
+ # when we invoke this method. If we kept this at the class
+ # level we would get an error beause the class level
+ # code would be run when this module is imported, and these composed
+ # classes don't exist yet because their module has not finished
+ # loading
+ lazy_import()
+ return {
+ 'anyOf': [
+ ],
+ 'allOf': [
+ Animal,
+ DogAllOf,
+ ],
+ 'oneOf': [
+ ],
+ }
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/dog_all_of.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/dog_all_of.py
new file mode 100644
index 000000000000..b7b2e7db66d9
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/dog_all_of.py
@@ -0,0 +1,166 @@
+"""
+ 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: https://openapi-generator.tech
+"""
+
+
+import re # noqa: F401
+import sys # noqa: F401
+
+from petstore_api.model_utils import ( # noqa: F401
+ ApiTypeError,
+ ModelComposed,
+ ModelNormal,
+ ModelSimple,
+ cached_property,
+ change_keys_js_to_python,
+ convert_js_args_to_python_args,
+ date,
+ datetime,
+ file_type,
+ none_type,
+ validate_get_composed_info,
+)
+
+
+class DogAllOf(ModelNormal):
+ """NOTE: This class is auto generated by OpenAPI Generator.
+ Ref: https://openapi-generator.tech
+
+ Do not edit the class manually.
+
+ Attributes:
+ allowed_values (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ with a capitalized key describing the allowed value and an allowed
+ value. These dicts store the allowed enum values.
+ attribute_map (dict): The key is attribute name
+ and the value is json key in definition.
+ discriminator_value_class_map (dict): A dict to go from the discriminator
+ variable value to the discriminator class name.
+ validations (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ that stores validations for max_length, min_length, max_items,
+ min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
+ inclusive_minimum, and regex.
+ additional_properties_type (tuple): A tuple of classes accepted
+ as additional properties values.
+ """
+
+ allowed_values = {
+ }
+
+ validations = {
+ }
+
+ additional_properties_type = None
+
+ _nullable = False
+
+ @cached_property
+ def openapi_types():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+
+ Returns
+ openapi_types (dict): The key is attribute name
+ and the value is attribute type.
+ """
+ return {
+ 'breed': (str,), # noqa: E501
+ }
+
+ @cached_property
+ def discriminator():
+ return None
+
+
+ attribute_map = {
+ 'breed': 'breed', # noqa: E501
+ }
+
+ _composed_schemas = {}
+
+ required_properties = set([
+ '_data_store',
+ '_check_type',
+ '_spec_property_naming',
+ '_path_to_item',
+ '_configuration',
+ '_visited_composed_classes',
+ ])
+
+ @convert_js_args_to_python_args
+ def __init__(self, *args, **kwargs): # noqa: E501
+ """DogAllOf - a model defined in OpenAPI
+
+ Keyword Args:
+ _check_type (bool): if True, values for parameters in openapi_types
+ will be type checked and a TypeError will be
+ raised if the wrong type is input.
+ Defaults to True
+ _path_to_item (tuple/list): This is a list of keys or values to
+ drill down to the model in received_data
+ when deserializing a response
+ _spec_property_naming (bool): True if the variable names in the input data
+ are serialized names, as specified in the OpenAPI document.
+ False if the variable names in the input data
+ are pythonic names, e.g. snake case (default)
+ _configuration (Configuration): the instance to use when
+ deserializing a file_type parameter.
+ If passed, type conversion is attempted
+ If omitted no type conversion is done.
+ _visited_composed_classes (tuple): This stores a tuple of
+ classes that we have traveled through so that
+ if we see that class again we will not use its
+ discriminator again.
+ When traveling through a discriminator, the
+ composed schema that is
+ is traveled through is added to this set.
+ For example if Animal has a discriminator
+ petType and we pass in "Dog", and the class Dog
+ allOf includes Animal, we move through Animal
+ once using the discriminator, and pick Dog.
+ Then in Dog, we will make an instance of the
+ Animal class but this time we won't travel
+ through its discriminator because we passed in
+ _visited_composed_classes = (Animal,)
+ breed (str): [optional] # noqa: E501
+ """
+
+ _check_type = kwargs.pop('_check_type', True)
+ _spec_property_naming = kwargs.pop('_spec_property_naming', False)
+ _path_to_item = kwargs.pop('_path_to_item', ())
+ _configuration = kwargs.pop('_configuration', None)
+ _visited_composed_classes = kwargs.pop('_visited_composed_classes', ())
+
+ if args:
+ raise ApiTypeError(
+ "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % (
+ args,
+ self.__class__.__name__,
+ ),
+ path_to_item=_path_to_item,
+ valid_classes=(self.__class__,),
+ )
+
+ self._data_store = {}
+ self._check_type = _check_type
+ self._spec_property_naming = _spec_property_naming
+ self._path_to_item = _path_to_item
+ self._configuration = _configuration
+ self._visited_composed_classes = _visited_composed_classes + (self.__class__,)
+
+ for var_name, var_value in kwargs.items():
+ if var_name not in self.attribute_map and \
+ self._configuration is not None and \
+ self._configuration.discard_unknown_keys and \
+ self.additional_properties_type is None:
+ # discard variable.
+ continue
+ setattr(self, var_name, var_value)
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/enum_arrays.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/enum_arrays.py
new file mode 100644
index 000000000000..43ebac57de38
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/enum_arrays.py
@@ -0,0 +1,177 @@
+"""
+ 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: https://openapi-generator.tech
+"""
+
+
+import re # noqa: F401
+import sys # noqa: F401
+
+from petstore_api.model_utils import ( # noqa: F401
+ ApiTypeError,
+ ModelComposed,
+ ModelNormal,
+ ModelSimple,
+ cached_property,
+ change_keys_js_to_python,
+ convert_js_args_to_python_args,
+ date,
+ datetime,
+ file_type,
+ none_type,
+ validate_get_composed_info,
+)
+
+
+class EnumArrays(ModelNormal):
+ """NOTE: This class is auto generated by OpenAPI Generator.
+ Ref: https://openapi-generator.tech
+
+ Do not edit the class manually.
+
+ Attributes:
+ allowed_values (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ with a capitalized key describing the allowed value and an allowed
+ value. These dicts store the allowed enum values.
+ attribute_map (dict): The key is attribute name
+ and the value is json key in definition.
+ discriminator_value_class_map (dict): A dict to go from the discriminator
+ variable value to the discriminator class name.
+ validations (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ that stores validations for max_length, min_length, max_items,
+ min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
+ inclusive_minimum, and regex.
+ additional_properties_type (tuple): A tuple of classes accepted
+ as additional properties values.
+ """
+
+ allowed_values = {
+ ('just_symbol',): {
+ '>=': ">=",
+ '$': "$",
+ },
+ ('array_enum',): {
+ 'FISH': "fish",
+ 'CRAB': "crab",
+ },
+ }
+
+ validations = {
+ }
+
+ additional_properties_type = None
+
+ _nullable = False
+
+ @cached_property
+ def openapi_types():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+
+ Returns
+ openapi_types (dict): The key is attribute name
+ and the value is attribute type.
+ """
+ return {
+ 'just_symbol': (str,), # noqa: E501
+ 'array_enum': ([str],), # noqa: E501
+ }
+
+ @cached_property
+ def discriminator():
+ return None
+
+
+ attribute_map = {
+ 'just_symbol': 'just_symbol', # noqa: E501
+ 'array_enum': 'array_enum', # noqa: E501
+ }
+
+ _composed_schemas = {}
+
+ required_properties = set([
+ '_data_store',
+ '_check_type',
+ '_spec_property_naming',
+ '_path_to_item',
+ '_configuration',
+ '_visited_composed_classes',
+ ])
+
+ @convert_js_args_to_python_args
+ def __init__(self, *args, **kwargs): # noqa: E501
+ """EnumArrays - a model defined in OpenAPI
+
+ Keyword Args:
+ _check_type (bool): if True, values for parameters in openapi_types
+ will be type checked and a TypeError will be
+ raised if the wrong type is input.
+ Defaults to True
+ _path_to_item (tuple/list): This is a list of keys or values to
+ drill down to the model in received_data
+ when deserializing a response
+ _spec_property_naming (bool): True if the variable names in the input data
+ are serialized names, as specified in the OpenAPI document.
+ False if the variable names in the input data
+ are pythonic names, e.g. snake case (default)
+ _configuration (Configuration): the instance to use when
+ deserializing a file_type parameter.
+ If passed, type conversion is attempted
+ If omitted no type conversion is done.
+ _visited_composed_classes (tuple): This stores a tuple of
+ classes that we have traveled through so that
+ if we see that class again we will not use its
+ discriminator again.
+ When traveling through a discriminator, the
+ composed schema that is
+ is traveled through is added to this set.
+ For example if Animal has a discriminator
+ petType and we pass in "Dog", and the class Dog
+ allOf includes Animal, we move through Animal
+ once using the discriminator, and pick Dog.
+ Then in Dog, we will make an instance of the
+ Animal class but this time we won't travel
+ through its discriminator because we passed in
+ _visited_composed_classes = (Animal,)
+ just_symbol (str): [optional] # noqa: E501
+ array_enum ([str]): [optional] # noqa: E501
+ """
+
+ _check_type = kwargs.pop('_check_type', True)
+ _spec_property_naming = kwargs.pop('_spec_property_naming', False)
+ _path_to_item = kwargs.pop('_path_to_item', ())
+ _configuration = kwargs.pop('_configuration', None)
+ _visited_composed_classes = kwargs.pop('_visited_composed_classes', ())
+
+ if args:
+ raise ApiTypeError(
+ "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % (
+ args,
+ self.__class__.__name__,
+ ),
+ path_to_item=_path_to_item,
+ valid_classes=(self.__class__,),
+ )
+
+ self._data_store = {}
+ self._check_type = _check_type
+ self._spec_property_naming = _spec_property_naming
+ self._path_to_item = _path_to_item
+ self._configuration = _configuration
+ self._visited_composed_classes = _visited_composed_classes + (self.__class__,)
+
+ for var_name, var_value in kwargs.items():
+ if var_name not in self.attribute_map and \
+ self._configuration is not None and \
+ self._configuration.discard_unknown_keys and \
+ self.additional_properties_type is None:
+ # discard variable.
+ continue
+ setattr(self, var_name, var_value)
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/enum_class.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/enum_class.py
new file mode 100644
index 000000000000..14188ca31d28
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/enum_class.py
@@ -0,0 +1,180 @@
+"""
+ 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: https://openapi-generator.tech
+"""
+
+
+import re # noqa: F401
+import sys # noqa: F401
+
+from petstore_api.model_utils import ( # noqa: F401
+ ApiTypeError,
+ ModelComposed,
+ ModelNormal,
+ ModelSimple,
+ cached_property,
+ change_keys_js_to_python,
+ convert_js_args_to_python_args,
+ date,
+ datetime,
+ file_type,
+ none_type,
+ validate_get_composed_info,
+)
+
+
+class EnumClass(ModelSimple):
+ """NOTE: This class is auto generated by OpenAPI Generator.
+ Ref: https://openapi-generator.tech
+
+ Do not edit the class manually.
+
+ Attributes:
+ allowed_values (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ with a capitalized key describing the allowed value and an allowed
+ value. These dicts store the allowed enum values.
+ validations (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ that stores validations for max_length, min_length, max_items,
+ min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
+ inclusive_minimum, and regex.
+ additional_properties_type (tuple): A tuple of classes accepted
+ as additional properties values.
+ """
+
+ allowed_values = {
+ ('value',): {
+ '_ABC': "_abc",
+ '-EFG': "-efg",
+ '(XYZ)': "(xyz)",
+ },
+ }
+
+ validations = {
+ }
+
+ additional_properties_type = None
+
+ _nullable = False
+
+ @cached_property
+ def openapi_types():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+
+ Returns
+ openapi_types (dict): The key is attribute name
+ and the value is attribute type.
+ """
+ return {
+ 'value': (str,),
+ }
+
+ @cached_property
+ def discriminator():
+ return None
+
+
+ attribute_map = {}
+
+ _composed_schemas = None
+
+ required_properties = set([
+ '_data_store',
+ '_check_type',
+ '_spec_property_naming',
+ '_path_to_item',
+ '_configuration',
+ '_visited_composed_classes',
+ ])
+
+ @convert_js_args_to_python_args
+ def __init__(self, *args, **kwargs):
+ """EnumClass - a model defined in OpenAPI
+
+ Note that value can be passed either in args or in kwargs, but not in both.
+
+ Args:
+ args[0] (str): if omitted defaults to "-efg", must be one of ["_abc", "-efg", "(xyz)", ] # noqa: E501
+
+ Keyword Args:
+ value (str): if omitted defaults to "-efg", must be one of ["_abc", "-efg", "(xyz)", ] # noqa: E501
+ _check_type (bool): if True, values for parameters in openapi_types
+ will be type checked and a TypeError will be
+ raised if the wrong type is input.
+ Defaults to True
+ _path_to_item (tuple/list): This is a list of keys or values to
+ drill down to the model in received_data
+ when deserializing a response
+ _spec_property_naming (bool): True if the variable names in the input data
+ are serialized names, as specified in the OpenAPI document.
+ False if the variable names in the input data
+ are pythonic names, e.g. snake case (default)
+ _configuration (Configuration): the instance to use when
+ deserializing a file_type parameter.
+ If passed, type conversion is attempted
+ If omitted no type conversion is done.
+ _visited_composed_classes (tuple): This stores a tuple of
+ classes that we have traveled through so that
+ if we see that class again we will not use its
+ discriminator again.
+ When traveling through a discriminator, the
+ composed schema that is
+ is traveled through is added to this set.
+ For example if Animal has a discriminator
+ petType and we pass in "Dog", and the class Dog
+ allOf includes Animal, we move through Animal
+ once using the discriminator, and pick Dog.
+ Then in Dog, we will make an instance of the
+ Animal class but this time we won't travel
+ through its discriminator because we passed in
+ _visited_composed_classes = (Animal,)
+ """
+ # required up here when default value is not given
+ _path_to_item = kwargs.pop('_path_to_item', ())
+
+ if 'value' in kwargs:
+ value = kwargs.pop('value')
+ elif args:
+ args = list(args)
+ value = args.pop(0)
+ else:
+ value = "-efg"
+
+ _check_type = kwargs.pop('_check_type', True)
+ _spec_property_naming = kwargs.pop('_spec_property_naming', False)
+ _configuration = kwargs.pop('_configuration', None)
+ _visited_composed_classes = kwargs.pop('_visited_composed_classes', ())
+
+ if args:
+ raise ApiTypeError(
+ "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % (
+ args,
+ self.__class__.__name__,
+ ),
+ path_to_item=_path_to_item,
+ valid_classes=(self.__class__,),
+ )
+
+ self._data_store = {}
+ self._check_type = _check_type
+ self._spec_property_naming = _spec_property_naming
+ self._path_to_item = _path_to_item
+ self._configuration = _configuration
+ self._visited_composed_classes = _visited_composed_classes + (self.__class__,)
+ self.value = value
+ if kwargs:
+ raise ApiTypeError(
+ "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % (
+ kwargs,
+ self.__class__.__name__,
+ ),
+ path_to_item=_path_to_item,
+ valid_classes=(self.__class__,),
+ )
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/enum_test.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/enum_test.py
new file mode 100644
index 000000000000..79ba0f6a747c
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/enum_test.py
@@ -0,0 +1,204 @@
+"""
+ 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: https://openapi-generator.tech
+"""
+
+
+import re # noqa: F401
+import sys # noqa: F401
+
+from petstore_api.model_utils import ( # noqa: F401
+ ApiTypeError,
+ ModelComposed,
+ ModelNormal,
+ ModelSimple,
+ cached_property,
+ change_keys_js_to_python,
+ convert_js_args_to_python_args,
+ date,
+ datetime,
+ file_type,
+ none_type,
+ validate_get_composed_info,
+)
+
+def lazy_import():
+ from petstore_api.model.string_enum import StringEnum
+ globals()['StringEnum'] = StringEnum
+
+
+class EnumTest(ModelNormal):
+ """NOTE: This class is auto generated by OpenAPI Generator.
+ Ref: https://openapi-generator.tech
+
+ Do not edit the class manually.
+
+ Attributes:
+ allowed_values (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ with a capitalized key describing the allowed value and an allowed
+ value. These dicts store the allowed enum values.
+ attribute_map (dict): The key is attribute name
+ and the value is json key in definition.
+ discriminator_value_class_map (dict): A dict to go from the discriminator
+ variable value to the discriminator class name.
+ validations (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ that stores validations for max_length, min_length, max_items,
+ min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
+ inclusive_minimum, and regex.
+ additional_properties_type (tuple): A tuple of classes accepted
+ as additional properties values.
+ """
+
+ allowed_values = {
+ ('enum_string_required',): {
+ 'UPPER': "UPPER",
+ 'LOWER': "lower",
+ 'EMPTY': "",
+ },
+ ('enum_string',): {
+ 'UPPER': "UPPER",
+ 'LOWER': "lower",
+ 'EMPTY': "",
+ },
+ ('enum_integer',): {
+ '1': 1,
+ '-1': -1,
+ },
+ ('enum_number',): {
+ '1.1': 1.1,
+ '-1.2': -1.2,
+ },
+ }
+
+ validations = {
+ }
+
+ additional_properties_type = None
+
+ _nullable = False
+
+ @cached_property
+ def openapi_types():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+
+ Returns
+ openapi_types (dict): The key is attribute name
+ and the value is attribute type.
+ """
+ lazy_import()
+ return {
+ 'enum_string_required': (str,), # noqa: E501
+ 'enum_string': (str,), # noqa: E501
+ 'enum_integer': (int,), # noqa: E501
+ 'enum_number': (float,), # noqa: E501
+ 'string_enum': (StringEnum,), # noqa: E501
+ }
+
+ @cached_property
+ def discriminator():
+ return None
+
+
+ attribute_map = {
+ 'enum_string_required': 'enum_string_required', # noqa: E501
+ 'enum_string': 'enum_string', # noqa: E501
+ 'enum_integer': 'enum_integer', # noqa: E501
+ 'enum_number': 'enum_number', # noqa: E501
+ 'string_enum': 'stringEnum', # noqa: E501
+ }
+
+ _composed_schemas = {}
+
+ required_properties = set([
+ '_data_store',
+ '_check_type',
+ '_spec_property_naming',
+ '_path_to_item',
+ '_configuration',
+ '_visited_composed_classes',
+ ])
+
+ @convert_js_args_to_python_args
+ def __init__(self, enum_string_required, *args, **kwargs): # noqa: E501
+ """EnumTest - a model defined in OpenAPI
+
+ Args:
+ enum_string_required (str):
+
+ Keyword Args:
+ _check_type (bool): if True, values for parameters in openapi_types
+ will be type checked and a TypeError will be
+ raised if the wrong type is input.
+ Defaults to True
+ _path_to_item (tuple/list): This is a list of keys or values to
+ drill down to the model in received_data
+ when deserializing a response
+ _spec_property_naming (bool): True if the variable names in the input data
+ are serialized names, as specified in the OpenAPI document.
+ False if the variable names in the input data
+ are pythonic names, e.g. snake case (default)
+ _configuration (Configuration): the instance to use when
+ deserializing a file_type parameter.
+ If passed, type conversion is attempted
+ If omitted no type conversion is done.
+ _visited_composed_classes (tuple): This stores a tuple of
+ classes that we have traveled through so that
+ if we see that class again we will not use its
+ discriminator again.
+ When traveling through a discriminator, the
+ composed schema that is
+ is traveled through is added to this set.
+ For example if Animal has a discriminator
+ petType and we pass in "Dog", and the class Dog
+ allOf includes Animal, we move through Animal
+ once using the discriminator, and pick Dog.
+ Then in Dog, we will make an instance of the
+ Animal class but this time we won't travel
+ through its discriminator because we passed in
+ _visited_composed_classes = (Animal,)
+ enum_string (str): [optional] # noqa: E501
+ enum_integer (int): [optional] # noqa: E501
+ enum_number (float): [optional] # noqa: E501
+ string_enum (StringEnum): [optional] # noqa: E501
+ """
+
+ _check_type = kwargs.pop('_check_type', True)
+ _spec_property_naming = kwargs.pop('_spec_property_naming', False)
+ _path_to_item = kwargs.pop('_path_to_item', ())
+ _configuration = kwargs.pop('_configuration', None)
+ _visited_composed_classes = kwargs.pop('_visited_composed_classes', ())
+
+ if args:
+ raise ApiTypeError(
+ "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % (
+ args,
+ self.__class__.__name__,
+ ),
+ path_to_item=_path_to_item,
+ valid_classes=(self.__class__,),
+ )
+
+ self._data_store = {}
+ self._check_type = _check_type
+ self._spec_property_naming = _spec_property_naming
+ self._path_to_item = _path_to_item
+ self._configuration = _configuration
+ self._visited_composed_classes = _visited_composed_classes + (self.__class__,)
+
+ self.enum_string_required = enum_string_required
+ for var_name, var_value in kwargs.items():
+ if var_name not in self.attribute_map and \
+ self._configuration is not None and \
+ self._configuration.discard_unknown_keys and \
+ self.additional_properties_type is None:
+ # discard variable.
+ continue
+ setattr(self, var_name, var_value)
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/file.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/file.py
new file mode 100644
index 000000000000..a38cccacc6ab
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/file.py
@@ -0,0 +1,166 @@
+"""
+ 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: https://openapi-generator.tech
+"""
+
+
+import re # noqa: F401
+import sys # noqa: F401
+
+from petstore_api.model_utils import ( # noqa: F401
+ ApiTypeError,
+ ModelComposed,
+ ModelNormal,
+ ModelSimple,
+ cached_property,
+ change_keys_js_to_python,
+ convert_js_args_to_python_args,
+ date,
+ datetime,
+ file_type,
+ none_type,
+ validate_get_composed_info,
+)
+
+
+class File(ModelNormal):
+ """NOTE: This class is auto generated by OpenAPI Generator.
+ Ref: https://openapi-generator.tech
+
+ Do not edit the class manually.
+
+ Attributes:
+ allowed_values (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ with a capitalized key describing the allowed value and an allowed
+ value. These dicts store the allowed enum values.
+ attribute_map (dict): The key is attribute name
+ and the value is json key in definition.
+ discriminator_value_class_map (dict): A dict to go from the discriminator
+ variable value to the discriminator class name.
+ validations (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ that stores validations for max_length, min_length, max_items,
+ min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
+ inclusive_minimum, and regex.
+ additional_properties_type (tuple): A tuple of classes accepted
+ as additional properties values.
+ """
+
+ allowed_values = {
+ }
+
+ validations = {
+ }
+
+ additional_properties_type = None
+
+ _nullable = False
+
+ @cached_property
+ def openapi_types():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+
+ Returns
+ openapi_types (dict): The key is attribute name
+ and the value is attribute type.
+ """
+ return {
+ 'source_uri': (str,), # noqa: E501
+ }
+
+ @cached_property
+ def discriminator():
+ return None
+
+
+ attribute_map = {
+ 'source_uri': 'sourceURI', # noqa: E501
+ }
+
+ _composed_schemas = {}
+
+ required_properties = set([
+ '_data_store',
+ '_check_type',
+ '_spec_property_naming',
+ '_path_to_item',
+ '_configuration',
+ '_visited_composed_classes',
+ ])
+
+ @convert_js_args_to_python_args
+ def __init__(self, *args, **kwargs): # noqa: E501
+ """File - a model defined in OpenAPI
+
+ Keyword Args:
+ _check_type (bool): if True, values for parameters in openapi_types
+ will be type checked and a TypeError will be
+ raised if the wrong type is input.
+ Defaults to True
+ _path_to_item (tuple/list): This is a list of keys or values to
+ drill down to the model in received_data
+ when deserializing a response
+ _spec_property_naming (bool): True if the variable names in the input data
+ are serialized names, as specified in the OpenAPI document.
+ False if the variable names in the input data
+ are pythonic names, e.g. snake case (default)
+ _configuration (Configuration): the instance to use when
+ deserializing a file_type parameter.
+ If passed, type conversion is attempted
+ If omitted no type conversion is done.
+ _visited_composed_classes (tuple): This stores a tuple of
+ classes that we have traveled through so that
+ if we see that class again we will not use its
+ discriminator again.
+ When traveling through a discriminator, the
+ composed schema that is
+ is traveled through is added to this set.
+ For example if Animal has a discriminator
+ petType and we pass in "Dog", and the class Dog
+ allOf includes Animal, we move through Animal
+ once using the discriminator, and pick Dog.
+ Then in Dog, we will make an instance of the
+ Animal class but this time we won't travel
+ through its discriminator because we passed in
+ _visited_composed_classes = (Animal,)
+ source_uri (str): Test capitalization. [optional] # noqa: E501
+ """
+
+ _check_type = kwargs.pop('_check_type', True)
+ _spec_property_naming = kwargs.pop('_spec_property_naming', False)
+ _path_to_item = kwargs.pop('_path_to_item', ())
+ _configuration = kwargs.pop('_configuration', None)
+ _visited_composed_classes = kwargs.pop('_visited_composed_classes', ())
+
+ if args:
+ raise ApiTypeError(
+ "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % (
+ args,
+ self.__class__.__name__,
+ ),
+ path_to_item=_path_to_item,
+ valid_classes=(self.__class__,),
+ )
+
+ self._data_store = {}
+ self._check_type = _check_type
+ self._spec_property_naming = _spec_property_naming
+ self._path_to_item = _path_to_item
+ self._configuration = _configuration
+ self._visited_composed_classes = _visited_composed_classes + (self.__class__,)
+
+ for var_name, var_value in kwargs.items():
+ if var_name not in self.attribute_map and \
+ self._configuration is not None and \
+ self._configuration.discard_unknown_keys and \
+ self.additional_properties_type is None:
+ # discard variable.
+ continue
+ setattr(self, var_name, var_value)
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/file_schema_test_class.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/file_schema_test_class.py
new file mode 100644
index 000000000000..b8c519ed9c7c
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/file_schema_test_class.py
@@ -0,0 +1,174 @@
+"""
+ 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: https://openapi-generator.tech
+"""
+
+
+import re # noqa: F401
+import sys # noqa: F401
+
+from petstore_api.model_utils import ( # noqa: F401
+ ApiTypeError,
+ ModelComposed,
+ ModelNormal,
+ ModelSimple,
+ cached_property,
+ change_keys_js_to_python,
+ convert_js_args_to_python_args,
+ date,
+ datetime,
+ file_type,
+ none_type,
+ validate_get_composed_info,
+)
+
+def lazy_import():
+ from petstore_api.model.file import File
+ globals()['File'] = File
+
+
+class FileSchemaTestClass(ModelNormal):
+ """NOTE: This class is auto generated by OpenAPI Generator.
+ Ref: https://openapi-generator.tech
+
+ Do not edit the class manually.
+
+ Attributes:
+ allowed_values (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ with a capitalized key describing the allowed value and an allowed
+ value. These dicts store the allowed enum values.
+ attribute_map (dict): The key is attribute name
+ and the value is json key in definition.
+ discriminator_value_class_map (dict): A dict to go from the discriminator
+ variable value to the discriminator class name.
+ validations (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ that stores validations for max_length, min_length, max_items,
+ min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
+ inclusive_minimum, and regex.
+ additional_properties_type (tuple): A tuple of classes accepted
+ as additional properties values.
+ """
+
+ allowed_values = {
+ }
+
+ validations = {
+ }
+
+ additional_properties_type = None
+
+ _nullable = False
+
+ @cached_property
+ def openapi_types():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+
+ Returns
+ openapi_types (dict): The key is attribute name
+ and the value is attribute type.
+ """
+ lazy_import()
+ return {
+ 'file': (File,), # noqa: E501
+ 'files': ([File],), # noqa: E501
+ }
+
+ @cached_property
+ def discriminator():
+ return None
+
+
+ attribute_map = {
+ 'file': 'file', # noqa: E501
+ 'files': 'files', # noqa: E501
+ }
+
+ _composed_schemas = {}
+
+ required_properties = set([
+ '_data_store',
+ '_check_type',
+ '_spec_property_naming',
+ '_path_to_item',
+ '_configuration',
+ '_visited_composed_classes',
+ ])
+
+ @convert_js_args_to_python_args
+ def __init__(self, *args, **kwargs): # noqa: E501
+ """FileSchemaTestClass - a model defined in OpenAPI
+
+ Keyword Args:
+ _check_type (bool): if True, values for parameters in openapi_types
+ will be type checked and a TypeError will be
+ raised if the wrong type is input.
+ Defaults to True
+ _path_to_item (tuple/list): This is a list of keys or values to
+ drill down to the model in received_data
+ when deserializing a response
+ _spec_property_naming (bool): True if the variable names in the input data
+ are serialized names, as specified in the OpenAPI document.
+ False if the variable names in the input data
+ are pythonic names, e.g. snake case (default)
+ _configuration (Configuration): the instance to use when
+ deserializing a file_type parameter.
+ If passed, type conversion is attempted
+ If omitted no type conversion is done.
+ _visited_composed_classes (tuple): This stores a tuple of
+ classes that we have traveled through so that
+ if we see that class again we will not use its
+ discriminator again.
+ When traveling through a discriminator, the
+ composed schema that is
+ is traveled through is added to this set.
+ For example if Animal has a discriminator
+ petType and we pass in "Dog", and the class Dog
+ allOf includes Animal, we move through Animal
+ once using the discriminator, and pick Dog.
+ Then in Dog, we will make an instance of the
+ Animal class but this time we won't travel
+ through its discriminator because we passed in
+ _visited_composed_classes = (Animal,)
+ file (File): [optional] # noqa: E501
+ files ([File]): [optional] # noqa: E501
+ """
+
+ _check_type = kwargs.pop('_check_type', True)
+ _spec_property_naming = kwargs.pop('_spec_property_naming', False)
+ _path_to_item = kwargs.pop('_path_to_item', ())
+ _configuration = kwargs.pop('_configuration', None)
+ _visited_composed_classes = kwargs.pop('_visited_composed_classes', ())
+
+ if args:
+ raise ApiTypeError(
+ "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % (
+ args,
+ self.__class__.__name__,
+ ),
+ path_to_item=_path_to_item,
+ valid_classes=(self.__class__,),
+ )
+
+ self._data_store = {}
+ self._check_type = _check_type
+ self._spec_property_naming = _spec_property_naming
+ self._path_to_item = _path_to_item
+ self._configuration = _configuration
+ self._visited_composed_classes = _visited_composed_classes + (self.__class__,)
+
+ for var_name, var_value in kwargs.items():
+ if var_name not in self.attribute_map and \
+ self._configuration is not None and \
+ self._configuration.discard_unknown_keys and \
+ self.additional_properties_type is None:
+ # discard variable.
+ continue
+ setattr(self, var_name, var_value)
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/format_test.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/format_test.py
new file mode 100644
index 000000000000..494ce2646da0
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/format_test.py
@@ -0,0 +1,243 @@
+"""
+ 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: https://openapi-generator.tech
+"""
+
+
+import re # noqa: F401
+import sys # noqa: F401
+
+from petstore_api.model_utils import ( # noqa: F401
+ ApiTypeError,
+ ModelComposed,
+ ModelNormal,
+ ModelSimple,
+ cached_property,
+ change_keys_js_to_python,
+ convert_js_args_to_python_args,
+ date,
+ datetime,
+ file_type,
+ none_type,
+ validate_get_composed_info,
+)
+
+
+class FormatTest(ModelNormal):
+ """NOTE: This class is auto generated by OpenAPI Generator.
+ Ref: https://openapi-generator.tech
+
+ Do not edit the class manually.
+
+ Attributes:
+ allowed_values (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ with a capitalized key describing the allowed value and an allowed
+ value. These dicts store the allowed enum values.
+ attribute_map (dict): The key is attribute name
+ and the value is json key in definition.
+ discriminator_value_class_map (dict): A dict to go from the discriminator
+ variable value to the discriminator class name.
+ validations (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ that stores validations for max_length, min_length, max_items,
+ min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
+ inclusive_minimum, and regex.
+ additional_properties_type (tuple): A tuple of classes accepted
+ as additional properties values.
+ """
+
+ allowed_values = {
+ }
+
+ validations = {
+ ('number',): {
+ 'inclusive_maximum': 543.2,
+ 'inclusive_minimum': 32.1,
+ },
+ ('byte',): {
+ 'regex': {
+ 'pattern': r'^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$', # noqa: E501
+ },
+ },
+ ('password',): {
+ 'max_length': 64,
+ 'min_length': 10,
+ },
+ ('integer',): {
+ 'inclusive_maximum': 100,
+ 'inclusive_minimum': 10,
+ },
+ ('int32',): {
+ 'inclusive_maximum': 200,
+ 'inclusive_minimum': 20,
+ },
+ ('float',): {
+ 'inclusive_maximum': 987.6,
+ 'inclusive_minimum': 54.3,
+ },
+ ('double',): {
+ 'inclusive_maximum': 123.4,
+ 'inclusive_minimum': 67.8,
+ },
+ ('string',): {
+ 'regex': {
+ 'pattern': r'^[a-z]+$', # noqa: E501
+ 'flags': (re.IGNORECASE)
+ },
+ },
+ }
+
+ additional_properties_type = None
+
+ _nullable = False
+
+ @cached_property
+ def openapi_types():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+
+ Returns
+ openapi_types (dict): The key is attribute name
+ and the value is attribute type.
+ """
+ return {
+ 'number': (float,), # noqa: E501
+ 'byte': (str,), # noqa: E501
+ 'date': (date,), # noqa: E501
+ 'password': (str,), # noqa: E501
+ 'integer': (int,), # noqa: E501
+ 'int32': (int,), # noqa: E501
+ 'int64': (int,), # noqa: E501
+ 'float': (float,), # noqa: E501
+ 'double': (float,), # noqa: E501
+ 'string': (str,), # noqa: E501
+ 'binary': (file_type,), # noqa: E501
+ 'date_time': (datetime,), # noqa: E501
+ 'uuid': (str,), # noqa: E501
+ }
+
+ @cached_property
+ def discriminator():
+ return None
+
+
+ attribute_map = {
+ 'number': 'number', # noqa: E501
+ 'byte': 'byte', # noqa: E501
+ 'date': 'date', # noqa: E501
+ 'password': 'password', # noqa: E501
+ 'integer': 'integer', # noqa: E501
+ 'int32': 'int32', # noqa: E501
+ 'int64': 'int64', # noqa: E501
+ 'float': 'float', # noqa: E501
+ 'double': 'double', # noqa: E501
+ 'string': 'string', # noqa: E501
+ 'binary': 'binary', # noqa: E501
+ 'date_time': 'dateTime', # noqa: E501
+ 'uuid': 'uuid', # noqa: E501
+ }
+
+ _composed_schemas = {}
+
+ required_properties = set([
+ '_data_store',
+ '_check_type',
+ '_spec_property_naming',
+ '_path_to_item',
+ '_configuration',
+ '_visited_composed_classes',
+ ])
+
+ @convert_js_args_to_python_args
+ def __init__(self, number, byte, date, password, *args, **kwargs): # noqa: E501
+ """FormatTest - a model defined in OpenAPI
+
+ Args:
+ number (float):
+ byte (str):
+ date (date):
+ password (str):
+
+ Keyword Args:
+ _check_type (bool): if True, values for parameters in openapi_types
+ will be type checked and a TypeError will be
+ raised if the wrong type is input.
+ Defaults to True
+ _path_to_item (tuple/list): This is a list of keys or values to
+ drill down to the model in received_data
+ when deserializing a response
+ _spec_property_naming (bool): True if the variable names in the input data
+ are serialized names, as specified in the OpenAPI document.
+ False if the variable names in the input data
+ are pythonic names, e.g. snake case (default)
+ _configuration (Configuration): the instance to use when
+ deserializing a file_type parameter.
+ If passed, type conversion is attempted
+ If omitted no type conversion is done.
+ _visited_composed_classes (tuple): This stores a tuple of
+ classes that we have traveled through so that
+ if we see that class again we will not use its
+ discriminator again.
+ When traveling through a discriminator, the
+ composed schema that is
+ is traveled through is added to this set.
+ For example if Animal has a discriminator
+ petType and we pass in "Dog", and the class Dog
+ allOf includes Animal, we move through Animal
+ once using the discriminator, and pick Dog.
+ Then in Dog, we will make an instance of the
+ Animal class but this time we won't travel
+ through its discriminator because we passed in
+ _visited_composed_classes = (Animal,)
+ integer (int): [optional] # noqa: E501
+ int32 (int): [optional] # noqa: E501
+ int64 (int): [optional] # noqa: E501
+ float (float): [optional] # noqa: E501
+ double (float): [optional] # noqa: E501
+ string (str): [optional] # noqa: E501
+ binary (file_type): [optional] # noqa: E501
+ date_time (datetime): [optional] # noqa: E501
+ uuid (str): [optional] # noqa: E501
+ """
+
+ _check_type = kwargs.pop('_check_type', True)
+ _spec_property_naming = kwargs.pop('_spec_property_naming', False)
+ _path_to_item = kwargs.pop('_path_to_item', ())
+ _configuration = kwargs.pop('_configuration', None)
+ _visited_composed_classes = kwargs.pop('_visited_composed_classes', ())
+
+ if args:
+ raise ApiTypeError(
+ "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % (
+ args,
+ self.__class__.__name__,
+ ),
+ path_to_item=_path_to_item,
+ valid_classes=(self.__class__,),
+ )
+
+ self._data_store = {}
+ self._check_type = _check_type
+ self._spec_property_naming = _spec_property_naming
+ self._path_to_item = _path_to_item
+ self._configuration = _configuration
+ self._visited_composed_classes = _visited_composed_classes + (self.__class__,)
+
+ self.number = number
+ self.byte = byte
+ self.date = date
+ self.password = password
+ for var_name, var_value in kwargs.items():
+ if var_name not in self.attribute_map and \
+ self._configuration is not None and \
+ self._configuration.discard_unknown_keys and \
+ self.additional_properties_type is None:
+ # discard variable.
+ continue
+ setattr(self, var_name, var_value)
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/grandparent.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/grandparent.py
new file mode 100644
index 000000000000..a52744cc3e24
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/grandparent.py
@@ -0,0 +1,166 @@
+"""
+ 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: https://openapi-generator.tech
+"""
+
+
+import re # noqa: F401
+import sys # noqa: F401
+
+from petstore_api.model_utils import ( # noqa: F401
+ ApiTypeError,
+ ModelComposed,
+ ModelNormal,
+ ModelSimple,
+ cached_property,
+ change_keys_js_to_python,
+ convert_js_args_to_python_args,
+ date,
+ datetime,
+ file_type,
+ none_type,
+ validate_get_composed_info,
+)
+
+
+class Grandparent(ModelNormal):
+ """NOTE: This class is auto generated by OpenAPI Generator.
+ Ref: https://openapi-generator.tech
+
+ Do not edit the class manually.
+
+ Attributes:
+ allowed_values (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ with a capitalized key describing the allowed value and an allowed
+ value. These dicts store the allowed enum values.
+ attribute_map (dict): The key is attribute name
+ and the value is json key in definition.
+ discriminator_value_class_map (dict): A dict to go from the discriminator
+ variable value to the discriminator class name.
+ validations (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ that stores validations for max_length, min_length, max_items,
+ min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
+ inclusive_minimum, and regex.
+ additional_properties_type (tuple): A tuple of classes accepted
+ as additional properties values.
+ """
+
+ allowed_values = {
+ }
+
+ validations = {
+ }
+
+ additional_properties_type = None
+
+ _nullable = False
+
+ @cached_property
+ def openapi_types():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+
+ Returns
+ openapi_types (dict): The key is attribute name
+ and the value is attribute type.
+ """
+ return {
+ 'radio_waves': (bool,), # noqa: E501
+ }
+
+ @cached_property
+ def discriminator():
+ return None
+
+
+ attribute_map = {
+ 'radio_waves': 'radioWaves', # noqa: E501
+ }
+
+ _composed_schemas = {}
+
+ required_properties = set([
+ '_data_store',
+ '_check_type',
+ '_spec_property_naming',
+ '_path_to_item',
+ '_configuration',
+ '_visited_composed_classes',
+ ])
+
+ @convert_js_args_to_python_args
+ def __init__(self, *args, **kwargs): # noqa: E501
+ """Grandparent - a model defined in OpenAPI
+
+ Keyword Args:
+ _check_type (bool): if True, values for parameters in openapi_types
+ will be type checked and a TypeError will be
+ raised if the wrong type is input.
+ Defaults to True
+ _path_to_item (tuple/list): This is a list of keys or values to
+ drill down to the model in received_data
+ when deserializing a response
+ _spec_property_naming (bool): True if the variable names in the input data
+ are serialized names, as specified in the OpenAPI document.
+ False if the variable names in the input data
+ are pythonic names, e.g. snake case (default)
+ _configuration (Configuration): the instance to use when
+ deserializing a file_type parameter.
+ If passed, type conversion is attempted
+ If omitted no type conversion is done.
+ _visited_composed_classes (tuple): This stores a tuple of
+ classes that we have traveled through so that
+ if we see that class again we will not use its
+ discriminator again.
+ When traveling through a discriminator, the
+ composed schema that is
+ is traveled through is added to this set.
+ For example if Animal has a discriminator
+ petType and we pass in "Dog", and the class Dog
+ allOf includes Animal, we move through Animal
+ once using the discriminator, and pick Dog.
+ Then in Dog, we will make an instance of the
+ Animal class but this time we won't travel
+ through its discriminator because we passed in
+ _visited_composed_classes = (Animal,)
+ radio_waves (bool): [optional] # noqa: E501
+ """
+
+ _check_type = kwargs.pop('_check_type', True)
+ _spec_property_naming = kwargs.pop('_spec_property_naming', False)
+ _path_to_item = kwargs.pop('_path_to_item', ())
+ _configuration = kwargs.pop('_configuration', None)
+ _visited_composed_classes = kwargs.pop('_visited_composed_classes', ())
+
+ if args:
+ raise ApiTypeError(
+ "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % (
+ args,
+ self.__class__.__name__,
+ ),
+ path_to_item=_path_to_item,
+ valid_classes=(self.__class__,),
+ )
+
+ self._data_store = {}
+ self._check_type = _check_type
+ self._spec_property_naming = _spec_property_naming
+ self._path_to_item = _path_to_item
+ self._configuration = _configuration
+ self._visited_composed_classes = _visited_composed_classes + (self.__class__,)
+
+ for var_name, var_value in kwargs.items():
+ if var_name not in self.attribute_map and \
+ self._configuration is not None and \
+ self._configuration.discard_unknown_keys and \
+ self.additional_properties_type is None:
+ # discard variable.
+ continue
+ setattr(self, var_name, var_value)
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/grandparent_animal.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/grandparent_animal.py
new file mode 100644
index 000000000000..48d3f6d9f0b3
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/grandparent_animal.py
@@ -0,0 +1,188 @@
+"""
+ 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: https://openapi-generator.tech
+"""
+
+
+import re # noqa: F401
+import sys # noqa: F401
+
+from petstore_api.model_utils import ( # noqa: F401
+ ApiTypeError,
+ ModelComposed,
+ ModelNormal,
+ ModelSimple,
+ cached_property,
+ change_keys_js_to_python,
+ convert_js_args_to_python_args,
+ date,
+ datetime,
+ file_type,
+ none_type,
+ validate_get_composed_info,
+)
+
+def lazy_import():
+ from petstore_api.model.child_cat import ChildCat
+ from petstore_api.model.child_dog import ChildDog
+ from petstore_api.model.child_lizard import ChildLizard
+ from petstore_api.model.parent_pet import ParentPet
+ globals()['ChildCat'] = ChildCat
+ globals()['ChildDog'] = ChildDog
+ globals()['ChildLizard'] = ChildLizard
+ globals()['ParentPet'] = ParentPet
+
+
+class GrandparentAnimal(ModelNormal):
+ """NOTE: This class is auto generated by OpenAPI Generator.
+ Ref: https://openapi-generator.tech
+
+ Do not edit the class manually.
+
+ Attributes:
+ allowed_values (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ with a capitalized key describing the allowed value and an allowed
+ value. These dicts store the allowed enum values.
+ attribute_map (dict): The key is attribute name
+ and the value is json key in definition.
+ discriminator_value_class_map (dict): A dict to go from the discriminator
+ variable value to the discriminator class name.
+ validations (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ that stores validations for max_length, min_length, max_items,
+ min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
+ inclusive_minimum, and regex.
+ additional_properties_type (tuple): A tuple of classes accepted
+ as additional properties values.
+ """
+
+ allowed_values = {
+ }
+
+ validations = {
+ }
+
+ additional_properties_type = None
+
+ _nullable = False
+
+ @cached_property
+ def openapi_types():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+
+ Returns
+ openapi_types (dict): The key is attribute name
+ and the value is attribute type.
+ """
+ lazy_import()
+ return {
+ 'pet_type': (str,), # noqa: E501
+ }
+
+ @cached_property
+ def discriminator():
+ lazy_import()
+ val = {
+ 'ChildCat': ChildCat,
+ 'ChildDog': ChildDog,
+ 'ChildLizard': ChildLizard,
+ 'ParentPet': ParentPet,
+ }
+ if not val:
+ return None
+ return {'pet_type': val}
+
+ attribute_map = {
+ 'pet_type': 'pet_type', # noqa: E501
+ }
+
+ _composed_schemas = {}
+
+ required_properties = set([
+ '_data_store',
+ '_check_type',
+ '_spec_property_naming',
+ '_path_to_item',
+ '_configuration',
+ '_visited_composed_classes',
+ ])
+
+ @convert_js_args_to_python_args
+ def __init__(self, pet_type, *args, **kwargs): # noqa: E501
+ """GrandparentAnimal - a model defined in OpenAPI
+
+ Args:
+ pet_type (str):
+
+ Keyword Args:
+ _check_type (bool): if True, values for parameters in openapi_types
+ will be type checked and a TypeError will be
+ raised if the wrong type is input.
+ Defaults to True
+ _path_to_item (tuple/list): This is a list of keys or values to
+ drill down to the model in received_data
+ when deserializing a response
+ _spec_property_naming (bool): True if the variable names in the input data
+ are serialized names, as specified in the OpenAPI document.
+ False if the variable names in the input data
+ are pythonic names, e.g. snake case (default)
+ _configuration (Configuration): the instance to use when
+ deserializing a file_type parameter.
+ If passed, type conversion is attempted
+ If omitted no type conversion is done.
+ _visited_composed_classes (tuple): This stores a tuple of
+ classes that we have traveled through so that
+ if we see that class again we will not use its
+ discriminator again.
+ When traveling through a discriminator, the
+ composed schema that is
+ is traveled through is added to this set.
+ For example if Animal has a discriminator
+ petType and we pass in "Dog", and the class Dog
+ allOf includes Animal, we move through Animal
+ once using the discriminator, and pick Dog.
+ Then in Dog, we will make an instance of the
+ Animal class but this time we won't travel
+ through its discriminator because we passed in
+ _visited_composed_classes = (Animal,)
+ """
+
+ _check_type = kwargs.pop('_check_type', True)
+ _spec_property_naming = kwargs.pop('_spec_property_naming', False)
+ _path_to_item = kwargs.pop('_path_to_item', ())
+ _configuration = kwargs.pop('_configuration', None)
+ _visited_composed_classes = kwargs.pop('_visited_composed_classes', ())
+
+ if args:
+ raise ApiTypeError(
+ "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % (
+ args,
+ self.__class__.__name__,
+ ),
+ path_to_item=_path_to_item,
+ valid_classes=(self.__class__,),
+ )
+
+ self._data_store = {}
+ self._check_type = _check_type
+ self._spec_property_naming = _spec_property_naming
+ self._path_to_item = _path_to_item
+ self._configuration = _configuration
+ self._visited_composed_classes = _visited_composed_classes + (self.__class__,)
+
+ self.pet_type = pet_type
+ for var_name, var_value in kwargs.items():
+ if var_name not in self.attribute_map and \
+ self._configuration is not None and \
+ self._configuration.discard_unknown_keys and \
+ self.additional_properties_type is None:
+ # discard variable.
+ continue
+ setattr(self, var_name, var_value)
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/has_only_read_only.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/has_only_read_only.py
new file mode 100644
index 000000000000..c94781ae2c46
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/has_only_read_only.py
@@ -0,0 +1,169 @@
+"""
+ 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: https://openapi-generator.tech
+"""
+
+
+import re # noqa: F401
+import sys # noqa: F401
+
+from petstore_api.model_utils import ( # noqa: F401
+ ApiTypeError,
+ ModelComposed,
+ ModelNormal,
+ ModelSimple,
+ cached_property,
+ change_keys_js_to_python,
+ convert_js_args_to_python_args,
+ date,
+ datetime,
+ file_type,
+ none_type,
+ validate_get_composed_info,
+)
+
+
+class HasOnlyReadOnly(ModelNormal):
+ """NOTE: This class is auto generated by OpenAPI Generator.
+ Ref: https://openapi-generator.tech
+
+ Do not edit the class manually.
+
+ Attributes:
+ allowed_values (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ with a capitalized key describing the allowed value and an allowed
+ value. These dicts store the allowed enum values.
+ attribute_map (dict): The key is attribute name
+ and the value is json key in definition.
+ discriminator_value_class_map (dict): A dict to go from the discriminator
+ variable value to the discriminator class name.
+ validations (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ that stores validations for max_length, min_length, max_items,
+ min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
+ inclusive_minimum, and regex.
+ additional_properties_type (tuple): A tuple of classes accepted
+ as additional properties values.
+ """
+
+ allowed_values = {
+ }
+
+ validations = {
+ }
+
+ additional_properties_type = None
+
+ _nullable = False
+
+ @cached_property
+ def openapi_types():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+
+ Returns
+ openapi_types (dict): The key is attribute name
+ and the value is attribute type.
+ """
+ return {
+ 'bar': (str,), # noqa: E501
+ 'foo': (str,), # noqa: E501
+ }
+
+ @cached_property
+ def discriminator():
+ return None
+
+
+ attribute_map = {
+ 'bar': 'bar', # noqa: E501
+ 'foo': 'foo', # noqa: E501
+ }
+
+ _composed_schemas = {}
+
+ required_properties = set([
+ '_data_store',
+ '_check_type',
+ '_spec_property_naming',
+ '_path_to_item',
+ '_configuration',
+ '_visited_composed_classes',
+ ])
+
+ @convert_js_args_to_python_args
+ def __init__(self, *args, **kwargs): # noqa: E501
+ """HasOnlyReadOnly - a model defined in OpenAPI
+
+ Keyword Args:
+ _check_type (bool): if True, values for parameters in openapi_types
+ will be type checked and a TypeError will be
+ raised if the wrong type is input.
+ Defaults to True
+ _path_to_item (tuple/list): This is a list of keys or values to
+ drill down to the model in received_data
+ when deserializing a response
+ _spec_property_naming (bool): True if the variable names in the input data
+ are serialized names, as specified in the OpenAPI document.
+ False if the variable names in the input data
+ are pythonic names, e.g. snake case (default)
+ _configuration (Configuration): the instance to use when
+ deserializing a file_type parameter.
+ If passed, type conversion is attempted
+ If omitted no type conversion is done.
+ _visited_composed_classes (tuple): This stores a tuple of
+ classes that we have traveled through so that
+ if we see that class again we will not use its
+ discriminator again.
+ When traveling through a discriminator, the
+ composed schema that is
+ is traveled through is added to this set.
+ For example if Animal has a discriminator
+ petType and we pass in "Dog", and the class Dog
+ allOf includes Animal, we move through Animal
+ once using the discriminator, and pick Dog.
+ Then in Dog, we will make an instance of the
+ Animal class but this time we won't travel
+ through its discriminator because we passed in
+ _visited_composed_classes = (Animal,)
+ bar (str): [optional] # noqa: E501
+ foo (str): [optional] # noqa: E501
+ """
+
+ _check_type = kwargs.pop('_check_type', True)
+ _spec_property_naming = kwargs.pop('_spec_property_naming', False)
+ _path_to_item = kwargs.pop('_path_to_item', ())
+ _configuration = kwargs.pop('_configuration', None)
+ _visited_composed_classes = kwargs.pop('_visited_composed_classes', ())
+
+ if args:
+ raise ApiTypeError(
+ "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % (
+ args,
+ self.__class__.__name__,
+ ),
+ path_to_item=_path_to_item,
+ valid_classes=(self.__class__,),
+ )
+
+ self._data_store = {}
+ self._check_type = _check_type
+ self._spec_property_naming = _spec_property_naming
+ self._path_to_item = _path_to_item
+ self._configuration = _configuration
+ self._visited_composed_classes = _visited_composed_classes + (self.__class__,)
+
+ for var_name, var_value in kwargs.items():
+ if var_name not in self.attribute_map and \
+ self._configuration is not None and \
+ self._configuration.discard_unknown_keys and \
+ self.additional_properties_type is None:
+ # discard variable.
+ continue
+ setattr(self, var_name, var_value)
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/list.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/list.py
new file mode 100644
index 000000000000..09c762d6a794
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/list.py
@@ -0,0 +1,166 @@
+"""
+ 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: https://openapi-generator.tech
+"""
+
+
+import re # noqa: F401
+import sys # noqa: F401
+
+from petstore_api.model_utils import ( # noqa: F401
+ ApiTypeError,
+ ModelComposed,
+ ModelNormal,
+ ModelSimple,
+ cached_property,
+ change_keys_js_to_python,
+ convert_js_args_to_python_args,
+ date,
+ datetime,
+ file_type,
+ none_type,
+ validate_get_composed_info,
+)
+
+
+class List(ModelNormal):
+ """NOTE: This class is auto generated by OpenAPI Generator.
+ Ref: https://openapi-generator.tech
+
+ Do not edit the class manually.
+
+ Attributes:
+ allowed_values (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ with a capitalized key describing the allowed value and an allowed
+ value. These dicts store the allowed enum values.
+ attribute_map (dict): The key is attribute name
+ and the value is json key in definition.
+ discriminator_value_class_map (dict): A dict to go from the discriminator
+ variable value to the discriminator class name.
+ validations (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ that stores validations for max_length, min_length, max_items,
+ min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
+ inclusive_minimum, and regex.
+ additional_properties_type (tuple): A tuple of classes accepted
+ as additional properties values.
+ """
+
+ allowed_values = {
+ }
+
+ validations = {
+ }
+
+ additional_properties_type = None
+
+ _nullable = False
+
+ @cached_property
+ def openapi_types():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+
+ Returns
+ openapi_types (dict): The key is attribute name
+ and the value is attribute type.
+ """
+ return {
+ '_123_list': (str,), # noqa: E501
+ }
+
+ @cached_property
+ def discriminator():
+ return None
+
+
+ attribute_map = {
+ '_123_list': '123-list', # noqa: E501
+ }
+
+ _composed_schemas = {}
+
+ required_properties = set([
+ '_data_store',
+ '_check_type',
+ '_spec_property_naming',
+ '_path_to_item',
+ '_configuration',
+ '_visited_composed_classes',
+ ])
+
+ @convert_js_args_to_python_args
+ def __init__(self, *args, **kwargs): # noqa: E501
+ """List - a model defined in OpenAPI
+
+ Keyword Args:
+ _check_type (bool): if True, values for parameters in openapi_types
+ will be type checked and a TypeError will be
+ raised if the wrong type is input.
+ Defaults to True
+ _path_to_item (tuple/list): This is a list of keys or values to
+ drill down to the model in received_data
+ when deserializing a response
+ _spec_property_naming (bool): True if the variable names in the input data
+ are serialized names, as specified in the OpenAPI document.
+ False if the variable names in the input data
+ are pythonic names, e.g. snake case (default)
+ _configuration (Configuration): the instance to use when
+ deserializing a file_type parameter.
+ If passed, type conversion is attempted
+ If omitted no type conversion is done.
+ _visited_composed_classes (tuple): This stores a tuple of
+ classes that we have traveled through so that
+ if we see that class again we will not use its
+ discriminator again.
+ When traveling through a discriminator, the
+ composed schema that is
+ is traveled through is added to this set.
+ For example if Animal has a discriminator
+ petType and we pass in "Dog", and the class Dog
+ allOf includes Animal, we move through Animal
+ once using the discriminator, and pick Dog.
+ Then in Dog, we will make an instance of the
+ Animal class but this time we won't travel
+ through its discriminator because we passed in
+ _visited_composed_classes = (Animal,)
+ _123_list (str): [optional] # noqa: E501
+ """
+
+ _check_type = kwargs.pop('_check_type', True)
+ _spec_property_naming = kwargs.pop('_spec_property_naming', False)
+ _path_to_item = kwargs.pop('_path_to_item', ())
+ _configuration = kwargs.pop('_configuration', None)
+ _visited_composed_classes = kwargs.pop('_visited_composed_classes', ())
+
+ if args:
+ raise ApiTypeError(
+ "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % (
+ args,
+ self.__class__.__name__,
+ ),
+ path_to_item=_path_to_item,
+ valid_classes=(self.__class__,),
+ )
+
+ self._data_store = {}
+ self._check_type = _check_type
+ self._spec_property_naming = _spec_property_naming
+ self._path_to_item = _path_to_item
+ self._configuration = _configuration
+ self._visited_composed_classes = _visited_composed_classes + (self.__class__,)
+
+ for var_name, var_value in kwargs.items():
+ if var_name not in self.attribute_map and \
+ self._configuration is not None and \
+ self._configuration.discard_unknown_keys and \
+ self.additional_properties_type is None:
+ # discard variable.
+ continue
+ setattr(self, var_name, var_value)
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/map_test.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/map_test.py
new file mode 100644
index 000000000000..169fb9d88ee0
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/map_test.py
@@ -0,0 +1,184 @@
+"""
+ 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: https://openapi-generator.tech
+"""
+
+
+import re # noqa: F401
+import sys # noqa: F401
+
+from petstore_api.model_utils import ( # noqa: F401
+ ApiTypeError,
+ ModelComposed,
+ ModelNormal,
+ ModelSimple,
+ cached_property,
+ change_keys_js_to_python,
+ convert_js_args_to_python_args,
+ date,
+ datetime,
+ file_type,
+ none_type,
+ validate_get_composed_info,
+)
+
+def lazy_import():
+ from petstore_api.model.string_boolean_map import StringBooleanMap
+ globals()['StringBooleanMap'] = StringBooleanMap
+
+
+class MapTest(ModelNormal):
+ """NOTE: This class is auto generated by OpenAPI Generator.
+ Ref: https://openapi-generator.tech
+
+ Do not edit the class manually.
+
+ Attributes:
+ allowed_values (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ with a capitalized key describing the allowed value and an allowed
+ value. These dicts store the allowed enum values.
+ attribute_map (dict): The key is attribute name
+ and the value is json key in definition.
+ discriminator_value_class_map (dict): A dict to go from the discriminator
+ variable value to the discriminator class name.
+ validations (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ that stores validations for max_length, min_length, max_items,
+ min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
+ inclusive_minimum, and regex.
+ additional_properties_type (tuple): A tuple of classes accepted
+ as additional properties values.
+ """
+
+ allowed_values = {
+ ('map_of_enum_string',): {
+ 'UPPER': "UPPER",
+ 'LOWER': "lower",
+ },
+ }
+
+ validations = {
+ }
+
+ additional_properties_type = None
+
+ _nullable = False
+
+ @cached_property
+ def openapi_types():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+
+ Returns
+ openapi_types (dict): The key is attribute name
+ and the value is attribute type.
+ """
+ lazy_import()
+ return {
+ 'map_map_of_string': ({str: ({str: (str,)},)},), # noqa: E501
+ 'map_of_enum_string': ({str: (str,)},), # noqa: E501
+ 'direct_map': ({str: (bool,)},), # noqa: E501
+ 'indirect_map': (StringBooleanMap,), # noqa: E501
+ }
+
+ @cached_property
+ def discriminator():
+ return None
+
+
+ attribute_map = {
+ 'map_map_of_string': 'map_map_of_string', # noqa: E501
+ 'map_of_enum_string': 'map_of_enum_string', # noqa: E501
+ 'direct_map': 'direct_map', # noqa: E501
+ 'indirect_map': 'indirect_map', # noqa: E501
+ }
+
+ _composed_schemas = {}
+
+ required_properties = set([
+ '_data_store',
+ '_check_type',
+ '_spec_property_naming',
+ '_path_to_item',
+ '_configuration',
+ '_visited_composed_classes',
+ ])
+
+ @convert_js_args_to_python_args
+ def __init__(self, *args, **kwargs): # noqa: E501
+ """MapTest - a model defined in OpenAPI
+
+ Keyword Args:
+ _check_type (bool): if True, values for parameters in openapi_types
+ will be type checked and a TypeError will be
+ raised if the wrong type is input.
+ Defaults to True
+ _path_to_item (tuple/list): This is a list of keys or values to
+ drill down to the model in received_data
+ when deserializing a response
+ _spec_property_naming (bool): True if the variable names in the input data
+ are serialized names, as specified in the OpenAPI document.
+ False if the variable names in the input data
+ are pythonic names, e.g. snake case (default)
+ _configuration (Configuration): the instance to use when
+ deserializing a file_type parameter.
+ If passed, type conversion is attempted
+ If omitted no type conversion is done.
+ _visited_composed_classes (tuple): This stores a tuple of
+ classes that we have traveled through so that
+ if we see that class again we will not use its
+ discriminator again.
+ When traveling through a discriminator, the
+ composed schema that is
+ is traveled through is added to this set.
+ For example if Animal has a discriminator
+ petType and we pass in "Dog", and the class Dog
+ allOf includes Animal, we move through Animal
+ once using the discriminator, and pick Dog.
+ Then in Dog, we will make an instance of the
+ Animal class but this time we won't travel
+ through its discriminator because we passed in
+ _visited_composed_classes = (Animal,)
+ map_map_of_string ({str: ({str: (str,)},)}): [optional] # noqa: E501
+ map_of_enum_string ({str: (str,)}): [optional] # noqa: E501
+ direct_map ({str: (bool,)}): [optional] # noqa: E501
+ indirect_map (StringBooleanMap): [optional] # noqa: E501
+ """
+
+ _check_type = kwargs.pop('_check_type', True)
+ _spec_property_naming = kwargs.pop('_spec_property_naming', False)
+ _path_to_item = kwargs.pop('_path_to_item', ())
+ _configuration = kwargs.pop('_configuration', None)
+ _visited_composed_classes = kwargs.pop('_visited_composed_classes', ())
+
+ if args:
+ raise ApiTypeError(
+ "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % (
+ args,
+ self.__class__.__name__,
+ ),
+ path_to_item=_path_to_item,
+ valid_classes=(self.__class__,),
+ )
+
+ self._data_store = {}
+ self._check_type = _check_type
+ self._spec_property_naming = _spec_property_naming
+ self._path_to_item = _path_to_item
+ self._configuration = _configuration
+ self._visited_composed_classes = _visited_composed_classes + (self.__class__,)
+
+ for var_name, var_value in kwargs.items():
+ if var_name not in self.attribute_map and \
+ self._configuration is not None and \
+ self._configuration.discard_unknown_keys and \
+ self.additional_properties_type is None:
+ # discard variable.
+ continue
+ setattr(self, var_name, var_value)
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/mixed_properties_and_additional_properties_class.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/mixed_properties_and_additional_properties_class.py
new file mode 100644
index 000000000000..01df80d9d62b
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/mixed_properties_and_additional_properties_class.py
@@ -0,0 +1,177 @@
+"""
+ 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: https://openapi-generator.tech
+"""
+
+
+import re # noqa: F401
+import sys # noqa: F401
+
+from petstore_api.model_utils import ( # noqa: F401
+ ApiTypeError,
+ ModelComposed,
+ ModelNormal,
+ ModelSimple,
+ cached_property,
+ change_keys_js_to_python,
+ convert_js_args_to_python_args,
+ date,
+ datetime,
+ file_type,
+ none_type,
+ validate_get_composed_info,
+)
+
+def lazy_import():
+ from petstore_api.model.animal import Animal
+ globals()['Animal'] = Animal
+
+
+class MixedPropertiesAndAdditionalPropertiesClass(ModelNormal):
+ """NOTE: This class is auto generated by OpenAPI Generator.
+ Ref: https://openapi-generator.tech
+
+ Do not edit the class manually.
+
+ Attributes:
+ allowed_values (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ with a capitalized key describing the allowed value and an allowed
+ value. These dicts store the allowed enum values.
+ attribute_map (dict): The key is attribute name
+ and the value is json key in definition.
+ discriminator_value_class_map (dict): A dict to go from the discriminator
+ variable value to the discriminator class name.
+ validations (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ that stores validations for max_length, min_length, max_items,
+ min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
+ inclusive_minimum, and regex.
+ additional_properties_type (tuple): A tuple of classes accepted
+ as additional properties values.
+ """
+
+ allowed_values = {
+ }
+
+ validations = {
+ }
+
+ additional_properties_type = None
+
+ _nullable = False
+
+ @cached_property
+ def openapi_types():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+
+ Returns
+ openapi_types (dict): The key is attribute name
+ and the value is attribute type.
+ """
+ lazy_import()
+ return {
+ 'uuid': (str,), # noqa: E501
+ 'date_time': (datetime,), # noqa: E501
+ 'map': ({str: (Animal,)},), # noqa: E501
+ }
+
+ @cached_property
+ def discriminator():
+ return None
+
+
+ attribute_map = {
+ 'uuid': 'uuid', # noqa: E501
+ 'date_time': 'dateTime', # noqa: E501
+ 'map': 'map', # noqa: E501
+ }
+
+ _composed_schemas = {}
+
+ required_properties = set([
+ '_data_store',
+ '_check_type',
+ '_spec_property_naming',
+ '_path_to_item',
+ '_configuration',
+ '_visited_composed_classes',
+ ])
+
+ @convert_js_args_to_python_args
+ def __init__(self, *args, **kwargs): # noqa: E501
+ """MixedPropertiesAndAdditionalPropertiesClass - a model defined in OpenAPI
+
+ Keyword Args:
+ _check_type (bool): if True, values for parameters in openapi_types
+ will be type checked and a TypeError will be
+ raised if the wrong type is input.
+ Defaults to True
+ _path_to_item (tuple/list): This is a list of keys or values to
+ drill down to the model in received_data
+ when deserializing a response
+ _spec_property_naming (bool): True if the variable names in the input data
+ are serialized names, as specified in the OpenAPI document.
+ False if the variable names in the input data
+ are pythonic names, e.g. snake case (default)
+ _configuration (Configuration): the instance to use when
+ deserializing a file_type parameter.
+ If passed, type conversion is attempted
+ If omitted no type conversion is done.
+ _visited_composed_classes (tuple): This stores a tuple of
+ classes that we have traveled through so that
+ if we see that class again we will not use its
+ discriminator again.
+ When traveling through a discriminator, the
+ composed schema that is
+ is traveled through is added to this set.
+ For example if Animal has a discriminator
+ petType and we pass in "Dog", and the class Dog
+ allOf includes Animal, we move through Animal
+ once using the discriminator, and pick Dog.
+ Then in Dog, we will make an instance of the
+ Animal class but this time we won't travel
+ through its discriminator because we passed in
+ _visited_composed_classes = (Animal,)
+ uuid (str): [optional] # noqa: E501
+ date_time (datetime): [optional] # noqa: E501
+ map ({str: (Animal,)}): [optional] # noqa: E501
+ """
+
+ _check_type = kwargs.pop('_check_type', True)
+ _spec_property_naming = kwargs.pop('_spec_property_naming', False)
+ _path_to_item = kwargs.pop('_path_to_item', ())
+ _configuration = kwargs.pop('_configuration', None)
+ _visited_composed_classes = kwargs.pop('_visited_composed_classes', ())
+
+ if args:
+ raise ApiTypeError(
+ "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % (
+ args,
+ self.__class__.__name__,
+ ),
+ path_to_item=_path_to_item,
+ valid_classes=(self.__class__,),
+ )
+
+ self._data_store = {}
+ self._check_type = _check_type
+ self._spec_property_naming = _spec_property_naming
+ self._path_to_item = _path_to_item
+ self._configuration = _configuration
+ self._visited_composed_classes = _visited_composed_classes + (self.__class__,)
+
+ for var_name, var_value in kwargs.items():
+ if var_name not in self.attribute_map and \
+ self._configuration is not None and \
+ self._configuration.discard_unknown_keys and \
+ self.additional_properties_type is None:
+ # discard variable.
+ continue
+ setattr(self, var_name, var_value)
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/model200_response.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/model200_response.py
new file mode 100644
index 000000000000..46b155b65239
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/model200_response.py
@@ -0,0 +1,169 @@
+"""
+ 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: https://openapi-generator.tech
+"""
+
+
+import re # noqa: F401
+import sys # noqa: F401
+
+from petstore_api.model_utils import ( # noqa: F401
+ ApiTypeError,
+ ModelComposed,
+ ModelNormal,
+ ModelSimple,
+ cached_property,
+ change_keys_js_to_python,
+ convert_js_args_to_python_args,
+ date,
+ datetime,
+ file_type,
+ none_type,
+ validate_get_composed_info,
+)
+
+
+class Model200Response(ModelNormal):
+ """NOTE: This class is auto generated by OpenAPI Generator.
+ Ref: https://openapi-generator.tech
+
+ Do not edit the class manually.
+
+ Attributes:
+ allowed_values (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ with a capitalized key describing the allowed value and an allowed
+ value. These dicts store the allowed enum values.
+ attribute_map (dict): The key is attribute name
+ and the value is json key in definition.
+ discriminator_value_class_map (dict): A dict to go from the discriminator
+ variable value to the discriminator class name.
+ validations (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ that stores validations for max_length, min_length, max_items,
+ min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
+ inclusive_minimum, and regex.
+ additional_properties_type (tuple): A tuple of classes accepted
+ as additional properties values.
+ """
+
+ allowed_values = {
+ }
+
+ validations = {
+ }
+
+ additional_properties_type = None
+
+ _nullable = False
+
+ @cached_property
+ def openapi_types():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+
+ Returns
+ openapi_types (dict): The key is attribute name
+ and the value is attribute type.
+ """
+ return {
+ 'name': (int,), # noqa: E501
+ '_class': (str,), # noqa: E501
+ }
+
+ @cached_property
+ def discriminator():
+ return None
+
+
+ attribute_map = {
+ 'name': 'name', # noqa: E501
+ '_class': 'class', # noqa: E501
+ }
+
+ _composed_schemas = {}
+
+ required_properties = set([
+ '_data_store',
+ '_check_type',
+ '_spec_property_naming',
+ '_path_to_item',
+ '_configuration',
+ '_visited_composed_classes',
+ ])
+
+ @convert_js_args_to_python_args
+ def __init__(self, *args, **kwargs): # noqa: E501
+ """Model200Response - a model defined in OpenAPI
+
+ Keyword Args:
+ _check_type (bool): if True, values for parameters in openapi_types
+ will be type checked and a TypeError will be
+ raised if the wrong type is input.
+ Defaults to True
+ _path_to_item (tuple/list): This is a list of keys or values to
+ drill down to the model in received_data
+ when deserializing a response
+ _spec_property_naming (bool): True if the variable names in the input data
+ are serialized names, as specified in the OpenAPI document.
+ False if the variable names in the input data
+ are pythonic names, e.g. snake case (default)
+ _configuration (Configuration): the instance to use when
+ deserializing a file_type parameter.
+ If passed, type conversion is attempted
+ If omitted no type conversion is done.
+ _visited_composed_classes (tuple): This stores a tuple of
+ classes that we have traveled through so that
+ if we see that class again we will not use its
+ discriminator again.
+ When traveling through a discriminator, the
+ composed schema that is
+ is traveled through is added to this set.
+ For example if Animal has a discriminator
+ petType and we pass in "Dog", and the class Dog
+ allOf includes Animal, we move through Animal
+ once using the discriminator, and pick Dog.
+ Then in Dog, we will make an instance of the
+ Animal class but this time we won't travel
+ through its discriminator because we passed in
+ _visited_composed_classes = (Animal,)
+ name (int): [optional] # noqa: E501
+ _class (str): [optional] # noqa: E501
+ """
+
+ _check_type = kwargs.pop('_check_type', True)
+ _spec_property_naming = kwargs.pop('_spec_property_naming', False)
+ _path_to_item = kwargs.pop('_path_to_item', ())
+ _configuration = kwargs.pop('_configuration', None)
+ _visited_composed_classes = kwargs.pop('_visited_composed_classes', ())
+
+ if args:
+ raise ApiTypeError(
+ "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % (
+ args,
+ self.__class__.__name__,
+ ),
+ path_to_item=_path_to_item,
+ valid_classes=(self.__class__,),
+ )
+
+ self._data_store = {}
+ self._check_type = _check_type
+ self._spec_property_naming = _spec_property_naming
+ self._path_to_item = _path_to_item
+ self._configuration = _configuration
+ self._visited_composed_classes = _visited_composed_classes + (self.__class__,)
+
+ for var_name, var_value in kwargs.items():
+ if var_name not in self.attribute_map and \
+ self._configuration is not None and \
+ self._configuration.discard_unknown_keys and \
+ self.additional_properties_type is None:
+ # discard variable.
+ continue
+ setattr(self, var_name, var_value)
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/model_return.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/model_return.py
new file mode 100644
index 000000000000..377b3507a8b3
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/model_return.py
@@ -0,0 +1,166 @@
+"""
+ 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: https://openapi-generator.tech
+"""
+
+
+import re # noqa: F401
+import sys # noqa: F401
+
+from petstore_api.model_utils import ( # noqa: F401
+ ApiTypeError,
+ ModelComposed,
+ ModelNormal,
+ ModelSimple,
+ cached_property,
+ change_keys_js_to_python,
+ convert_js_args_to_python_args,
+ date,
+ datetime,
+ file_type,
+ none_type,
+ validate_get_composed_info,
+)
+
+
+class ModelReturn(ModelNormal):
+ """NOTE: This class is auto generated by OpenAPI Generator.
+ Ref: https://openapi-generator.tech
+
+ Do not edit the class manually.
+
+ Attributes:
+ allowed_values (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ with a capitalized key describing the allowed value and an allowed
+ value. These dicts store the allowed enum values.
+ attribute_map (dict): The key is attribute name
+ and the value is json key in definition.
+ discriminator_value_class_map (dict): A dict to go from the discriminator
+ variable value to the discriminator class name.
+ validations (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ that stores validations for max_length, min_length, max_items,
+ min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
+ inclusive_minimum, and regex.
+ additional_properties_type (tuple): A tuple of classes accepted
+ as additional properties values.
+ """
+
+ allowed_values = {
+ }
+
+ validations = {
+ }
+
+ additional_properties_type = None
+
+ _nullable = False
+
+ @cached_property
+ def openapi_types():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+
+ Returns
+ openapi_types (dict): The key is attribute name
+ and the value is attribute type.
+ """
+ return {
+ '_return': (int,), # noqa: E501
+ }
+
+ @cached_property
+ def discriminator():
+ return None
+
+
+ attribute_map = {
+ '_return': 'return', # noqa: E501
+ }
+
+ _composed_schemas = {}
+
+ required_properties = set([
+ '_data_store',
+ '_check_type',
+ '_spec_property_naming',
+ '_path_to_item',
+ '_configuration',
+ '_visited_composed_classes',
+ ])
+
+ @convert_js_args_to_python_args
+ def __init__(self, *args, **kwargs): # noqa: E501
+ """ModelReturn - a model defined in OpenAPI
+
+ Keyword Args:
+ _check_type (bool): if True, values for parameters in openapi_types
+ will be type checked and a TypeError will be
+ raised if the wrong type is input.
+ Defaults to True
+ _path_to_item (tuple/list): This is a list of keys or values to
+ drill down to the model in received_data
+ when deserializing a response
+ _spec_property_naming (bool): True if the variable names in the input data
+ are serialized names, as specified in the OpenAPI document.
+ False if the variable names in the input data
+ are pythonic names, e.g. snake case (default)
+ _configuration (Configuration): the instance to use when
+ deserializing a file_type parameter.
+ If passed, type conversion is attempted
+ If omitted no type conversion is done.
+ _visited_composed_classes (tuple): This stores a tuple of
+ classes that we have traveled through so that
+ if we see that class again we will not use its
+ discriminator again.
+ When traveling through a discriminator, the
+ composed schema that is
+ is traveled through is added to this set.
+ For example if Animal has a discriminator
+ petType and we pass in "Dog", and the class Dog
+ allOf includes Animal, we move through Animal
+ once using the discriminator, and pick Dog.
+ Then in Dog, we will make an instance of the
+ Animal class but this time we won't travel
+ through its discriminator because we passed in
+ _visited_composed_classes = (Animal,)
+ _return (int): [optional] # noqa: E501
+ """
+
+ _check_type = kwargs.pop('_check_type', True)
+ _spec_property_naming = kwargs.pop('_spec_property_naming', False)
+ _path_to_item = kwargs.pop('_path_to_item', ())
+ _configuration = kwargs.pop('_configuration', None)
+ _visited_composed_classes = kwargs.pop('_visited_composed_classes', ())
+
+ if args:
+ raise ApiTypeError(
+ "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % (
+ args,
+ self.__class__.__name__,
+ ),
+ path_to_item=_path_to_item,
+ valid_classes=(self.__class__,),
+ )
+
+ self._data_store = {}
+ self._check_type = _check_type
+ self._spec_property_naming = _spec_property_naming
+ self._path_to_item = _path_to_item
+ self._configuration = _configuration
+ self._visited_composed_classes = _visited_composed_classes + (self.__class__,)
+
+ for var_name, var_value in kwargs.items():
+ if var_name not in self.attribute_map and \
+ self._configuration is not None and \
+ self._configuration.discard_unknown_keys and \
+ self.additional_properties_type is None:
+ # discard variable.
+ continue
+ setattr(self, var_name, var_value)
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/name.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/name.py
new file mode 100644
index 000000000000..1432e185ad6b
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/name.py
@@ -0,0 +1,178 @@
+"""
+ 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: https://openapi-generator.tech
+"""
+
+
+import re # noqa: F401
+import sys # noqa: F401
+
+from petstore_api.model_utils import ( # noqa: F401
+ ApiTypeError,
+ ModelComposed,
+ ModelNormal,
+ ModelSimple,
+ cached_property,
+ change_keys_js_to_python,
+ convert_js_args_to_python_args,
+ date,
+ datetime,
+ file_type,
+ none_type,
+ validate_get_composed_info,
+)
+
+
+class Name(ModelNormal):
+ """NOTE: This class is auto generated by OpenAPI Generator.
+ Ref: https://openapi-generator.tech
+
+ Do not edit the class manually.
+
+ Attributes:
+ allowed_values (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ with a capitalized key describing the allowed value and an allowed
+ value. These dicts store the allowed enum values.
+ attribute_map (dict): The key is attribute name
+ and the value is json key in definition.
+ discriminator_value_class_map (dict): A dict to go from the discriminator
+ variable value to the discriminator class name.
+ validations (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ that stores validations for max_length, min_length, max_items,
+ min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
+ inclusive_minimum, and regex.
+ additional_properties_type (tuple): A tuple of classes accepted
+ as additional properties values.
+ """
+
+ allowed_values = {
+ }
+
+ validations = {
+ }
+
+ additional_properties_type = None
+
+ _nullable = False
+
+ @cached_property
+ def openapi_types():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+
+ Returns
+ openapi_types (dict): The key is attribute name
+ and the value is attribute type.
+ """
+ return {
+ 'name': (int,), # noqa: E501
+ 'snake_case': (int,), # noqa: E501
+ '_property': (str,), # noqa: E501
+ '_123_number': (int,), # noqa: E501
+ }
+
+ @cached_property
+ def discriminator():
+ return None
+
+
+ attribute_map = {
+ 'name': 'name', # noqa: E501
+ 'snake_case': 'snake_case', # noqa: E501
+ '_property': 'property', # noqa: E501
+ '_123_number': '123Number', # noqa: E501
+ }
+
+ _composed_schemas = {}
+
+ required_properties = set([
+ '_data_store',
+ '_check_type',
+ '_spec_property_naming',
+ '_path_to_item',
+ '_configuration',
+ '_visited_composed_classes',
+ ])
+
+ @convert_js_args_to_python_args
+ def __init__(self, name, *args, **kwargs): # noqa: E501
+ """Name - a model defined in OpenAPI
+
+ Args:
+ name (int):
+
+ Keyword Args:
+ _check_type (bool): if True, values for parameters in openapi_types
+ will be type checked and a TypeError will be
+ raised if the wrong type is input.
+ Defaults to True
+ _path_to_item (tuple/list): This is a list of keys or values to
+ drill down to the model in received_data
+ when deserializing a response
+ _spec_property_naming (bool): True if the variable names in the input data
+ are serialized names, as specified in the OpenAPI document.
+ False if the variable names in the input data
+ are pythonic names, e.g. snake case (default)
+ _configuration (Configuration): the instance to use when
+ deserializing a file_type parameter.
+ If passed, type conversion is attempted
+ If omitted no type conversion is done.
+ _visited_composed_classes (tuple): This stores a tuple of
+ classes that we have traveled through so that
+ if we see that class again we will not use its
+ discriminator again.
+ When traveling through a discriminator, the
+ composed schema that is
+ is traveled through is added to this set.
+ For example if Animal has a discriminator
+ petType and we pass in "Dog", and the class Dog
+ allOf includes Animal, we move through Animal
+ once using the discriminator, and pick Dog.
+ Then in Dog, we will make an instance of the
+ Animal class but this time we won't travel
+ through its discriminator because we passed in
+ _visited_composed_classes = (Animal,)
+ snake_case (int): [optional] # noqa: E501
+ _property (str): [optional] # noqa: E501
+ _123_number (int): [optional] # noqa: E501
+ """
+
+ _check_type = kwargs.pop('_check_type', True)
+ _spec_property_naming = kwargs.pop('_spec_property_naming', False)
+ _path_to_item = kwargs.pop('_path_to_item', ())
+ _configuration = kwargs.pop('_configuration', None)
+ _visited_composed_classes = kwargs.pop('_visited_composed_classes', ())
+
+ if args:
+ raise ApiTypeError(
+ "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % (
+ args,
+ self.__class__.__name__,
+ ),
+ path_to_item=_path_to_item,
+ valid_classes=(self.__class__,),
+ )
+
+ self._data_store = {}
+ self._check_type = _check_type
+ self._spec_property_naming = _spec_property_naming
+ self._path_to_item = _path_to_item
+ self._configuration = _configuration
+ self._visited_composed_classes = _visited_composed_classes + (self.__class__,)
+
+ self.name = name
+ for var_name, var_value in kwargs.items():
+ if var_name not in self.attribute_map and \
+ self._configuration is not None and \
+ self._configuration.discard_unknown_keys and \
+ self.additional_properties_type is None:
+ # discard variable.
+ continue
+ setattr(self, var_name, var_value)
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/number_only.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/number_only.py
new file mode 100644
index 000000000000..d4892dbede5b
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/number_only.py
@@ -0,0 +1,166 @@
+"""
+ 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: https://openapi-generator.tech
+"""
+
+
+import re # noqa: F401
+import sys # noqa: F401
+
+from petstore_api.model_utils import ( # noqa: F401
+ ApiTypeError,
+ ModelComposed,
+ ModelNormal,
+ ModelSimple,
+ cached_property,
+ change_keys_js_to_python,
+ convert_js_args_to_python_args,
+ date,
+ datetime,
+ file_type,
+ none_type,
+ validate_get_composed_info,
+)
+
+
+class NumberOnly(ModelNormal):
+ """NOTE: This class is auto generated by OpenAPI Generator.
+ Ref: https://openapi-generator.tech
+
+ Do not edit the class manually.
+
+ Attributes:
+ allowed_values (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ with a capitalized key describing the allowed value and an allowed
+ value. These dicts store the allowed enum values.
+ attribute_map (dict): The key is attribute name
+ and the value is json key in definition.
+ discriminator_value_class_map (dict): A dict to go from the discriminator
+ variable value to the discriminator class name.
+ validations (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ that stores validations for max_length, min_length, max_items,
+ min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
+ inclusive_minimum, and regex.
+ additional_properties_type (tuple): A tuple of classes accepted
+ as additional properties values.
+ """
+
+ allowed_values = {
+ }
+
+ validations = {
+ }
+
+ additional_properties_type = None
+
+ _nullable = False
+
+ @cached_property
+ def openapi_types():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+
+ Returns
+ openapi_types (dict): The key is attribute name
+ and the value is attribute type.
+ """
+ return {
+ 'just_number': (float,), # noqa: E501
+ }
+
+ @cached_property
+ def discriminator():
+ return None
+
+
+ attribute_map = {
+ 'just_number': 'JustNumber', # noqa: E501
+ }
+
+ _composed_schemas = {}
+
+ required_properties = set([
+ '_data_store',
+ '_check_type',
+ '_spec_property_naming',
+ '_path_to_item',
+ '_configuration',
+ '_visited_composed_classes',
+ ])
+
+ @convert_js_args_to_python_args
+ def __init__(self, *args, **kwargs): # noqa: E501
+ """NumberOnly - a model defined in OpenAPI
+
+ Keyword Args:
+ _check_type (bool): if True, values for parameters in openapi_types
+ will be type checked and a TypeError will be
+ raised if the wrong type is input.
+ Defaults to True
+ _path_to_item (tuple/list): This is a list of keys or values to
+ drill down to the model in received_data
+ when deserializing a response
+ _spec_property_naming (bool): True if the variable names in the input data
+ are serialized names, as specified in the OpenAPI document.
+ False if the variable names in the input data
+ are pythonic names, e.g. snake case (default)
+ _configuration (Configuration): the instance to use when
+ deserializing a file_type parameter.
+ If passed, type conversion is attempted
+ If omitted no type conversion is done.
+ _visited_composed_classes (tuple): This stores a tuple of
+ classes that we have traveled through so that
+ if we see that class again we will not use its
+ discriminator again.
+ When traveling through a discriminator, the
+ composed schema that is
+ is traveled through is added to this set.
+ For example if Animal has a discriminator
+ petType and we pass in "Dog", and the class Dog
+ allOf includes Animal, we move through Animal
+ once using the discriminator, and pick Dog.
+ Then in Dog, we will make an instance of the
+ Animal class but this time we won't travel
+ through its discriminator because we passed in
+ _visited_composed_classes = (Animal,)
+ just_number (float): [optional] # noqa: E501
+ """
+
+ _check_type = kwargs.pop('_check_type', True)
+ _spec_property_naming = kwargs.pop('_spec_property_naming', False)
+ _path_to_item = kwargs.pop('_path_to_item', ())
+ _configuration = kwargs.pop('_configuration', None)
+ _visited_composed_classes = kwargs.pop('_visited_composed_classes', ())
+
+ if args:
+ raise ApiTypeError(
+ "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % (
+ args,
+ self.__class__.__name__,
+ ),
+ path_to_item=_path_to_item,
+ valid_classes=(self.__class__,),
+ )
+
+ self._data_store = {}
+ self._check_type = _check_type
+ self._spec_property_naming = _spec_property_naming
+ self._path_to_item = _path_to_item
+ self._configuration = _configuration
+ self._visited_composed_classes = _visited_composed_classes + (self.__class__,)
+
+ for var_name, var_value in kwargs.items():
+ if var_name not in self.attribute_map and \
+ self._configuration is not None and \
+ self._configuration.discard_unknown_keys and \
+ self.additional_properties_type is None:
+ # discard variable.
+ continue
+ setattr(self, var_name, var_value)
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/number_with_validations.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/number_with_validations.py
new file mode 100644
index 000000000000..458a79459751
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/number_with_validations.py
@@ -0,0 +1,183 @@
+"""
+ 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: https://openapi-generator.tech
+"""
+
+
+import re # noqa: F401
+import sys # noqa: F401
+
+from petstore_api.model_utils import ( # noqa: F401
+ ApiTypeError,
+ ModelComposed,
+ ModelNormal,
+ ModelSimple,
+ cached_property,
+ change_keys_js_to_python,
+ convert_js_args_to_python_args,
+ date,
+ datetime,
+ file_type,
+ none_type,
+ validate_get_composed_info,
+)
+
+
+class NumberWithValidations(ModelSimple):
+ """NOTE: This class is auto generated by OpenAPI Generator.
+ Ref: https://openapi-generator.tech
+
+ Do not edit the class manually.
+
+ Attributes:
+ allowed_values (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ with a capitalized key describing the allowed value and an allowed
+ value. These dicts store the allowed enum values.
+ validations (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ that stores validations for max_length, min_length, max_items,
+ min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
+ inclusive_minimum, and regex.
+ additional_properties_type (tuple): A tuple of classes accepted
+ as additional properties values.
+ """
+
+ allowed_values = {
+ }
+
+ validations = {
+ ('value',): {
+ 'inclusive_maximum': 2E+1,
+ 'inclusive_minimum': 1E+1,
+ },
+ }
+
+ additional_properties_type = None
+
+ _nullable = False
+
+ @cached_property
+ def openapi_types():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+
+ Returns
+ openapi_types (dict): The key is attribute name
+ and the value is attribute type.
+ """
+ return {
+ 'value': (float,),
+ }
+
+ @cached_property
+ def discriminator():
+ return None
+
+
+ attribute_map = {}
+
+ _composed_schemas = None
+
+ required_properties = set([
+ '_data_store',
+ '_check_type',
+ '_spec_property_naming',
+ '_path_to_item',
+ '_configuration',
+ '_visited_composed_classes',
+ ])
+
+ @convert_js_args_to_python_args
+ def __init__(self, *args, **kwargs):
+ """NumberWithValidations - a model defined in OpenAPI
+
+ Note that value can be passed either in args or in kwargs, but not in both.
+
+ Args:
+ args[0] (float): # noqa: E501
+
+ Keyword Args:
+ value (float): # noqa: E501
+ _check_type (bool): if True, values for parameters in openapi_types
+ will be type checked and a TypeError will be
+ raised if the wrong type is input.
+ Defaults to True
+ _path_to_item (tuple/list): This is a list of keys or values to
+ drill down to the model in received_data
+ when deserializing a response
+ _spec_property_naming (bool): True if the variable names in the input data
+ are serialized names, as specified in the OpenAPI document.
+ False if the variable names in the input data
+ are pythonic names, e.g. snake case (default)
+ _configuration (Configuration): the instance to use when
+ deserializing a file_type parameter.
+ If passed, type conversion is attempted
+ If omitted no type conversion is done.
+ _visited_composed_classes (tuple): This stores a tuple of
+ classes that we have traveled through so that
+ if we see that class again we will not use its
+ discriminator again.
+ When traveling through a discriminator, the
+ composed schema that is
+ is traveled through is added to this set.
+ For example if Animal has a discriminator
+ petType and we pass in "Dog", and the class Dog
+ allOf includes Animal, we move through Animal
+ once using the discriminator, and pick Dog.
+ Then in Dog, we will make an instance of the
+ Animal class but this time we won't travel
+ through its discriminator because we passed in
+ _visited_composed_classes = (Animal,)
+ """
+ # required up here when default value is not given
+ _path_to_item = kwargs.pop('_path_to_item', ())
+
+ if 'value' in kwargs:
+ value = kwargs.pop('value')
+ elif args:
+ args = list(args)
+ value = args.pop(0)
+ else:
+ raise ApiTypeError(
+ "value is required, but not passed in args or kwargs and doesn't have default",
+ path_to_item=_path_to_item,
+ valid_classes=(self.__class__,),
+ )
+
+ _check_type = kwargs.pop('_check_type', True)
+ _spec_property_naming = kwargs.pop('_spec_property_naming', False)
+ _configuration = kwargs.pop('_configuration', None)
+ _visited_composed_classes = kwargs.pop('_visited_composed_classes', ())
+
+ if args:
+ raise ApiTypeError(
+ "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % (
+ args,
+ self.__class__.__name__,
+ ),
+ path_to_item=_path_to_item,
+ valid_classes=(self.__class__,),
+ )
+
+ self._data_store = {}
+ self._check_type = _check_type
+ self._spec_property_naming = _spec_property_naming
+ self._path_to_item = _path_to_item
+ self._configuration = _configuration
+ self._visited_composed_classes = _visited_composed_classes + (self.__class__,)
+ self.value = value
+ if kwargs:
+ raise ApiTypeError(
+ "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % (
+ kwargs,
+ self.__class__.__name__,
+ ),
+ path_to_item=_path_to_item,
+ valid_classes=(self.__class__,),
+ )
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/object_model_with_ref_props.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/object_model_with_ref_props.py
new file mode 100644
index 000000000000..b1dc4bf82e2c
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/object_model_with_ref_props.py
@@ -0,0 +1,177 @@
+"""
+ 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: https://openapi-generator.tech
+"""
+
+
+import re # noqa: F401
+import sys # noqa: F401
+
+from petstore_api.model_utils import ( # noqa: F401
+ ApiTypeError,
+ ModelComposed,
+ ModelNormal,
+ ModelSimple,
+ cached_property,
+ change_keys_js_to_python,
+ convert_js_args_to_python_args,
+ date,
+ datetime,
+ file_type,
+ none_type,
+ validate_get_composed_info,
+)
+
+def lazy_import():
+ from petstore_api.model.number_with_validations import NumberWithValidations
+ globals()['NumberWithValidations'] = NumberWithValidations
+
+
+class ObjectModelWithRefProps(ModelNormal):
+ """NOTE: This class is auto generated by OpenAPI Generator.
+ Ref: https://openapi-generator.tech
+
+ Do not edit the class manually.
+
+ Attributes:
+ allowed_values (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ with a capitalized key describing the allowed value and an allowed
+ value. These dicts store the allowed enum values.
+ attribute_map (dict): The key is attribute name
+ and the value is json key in definition.
+ discriminator_value_class_map (dict): A dict to go from the discriminator
+ variable value to the discriminator class name.
+ validations (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ that stores validations for max_length, min_length, max_items,
+ min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
+ inclusive_minimum, and regex.
+ additional_properties_type (tuple): A tuple of classes accepted
+ as additional properties values.
+ """
+
+ allowed_values = {
+ }
+
+ validations = {
+ }
+
+ additional_properties_type = None
+
+ _nullable = False
+
+ @cached_property
+ def openapi_types():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+
+ Returns
+ openapi_types (dict): The key is attribute name
+ and the value is attribute type.
+ """
+ lazy_import()
+ return {
+ 'my_number': (NumberWithValidations,), # noqa: E501
+ 'my_string': (str,), # noqa: E501
+ 'my_boolean': (bool,), # noqa: E501
+ }
+
+ @cached_property
+ def discriminator():
+ return None
+
+
+ attribute_map = {
+ 'my_number': 'my_number', # noqa: E501
+ 'my_string': 'my_string', # noqa: E501
+ 'my_boolean': 'my_boolean', # noqa: E501
+ }
+
+ _composed_schemas = {}
+
+ required_properties = set([
+ '_data_store',
+ '_check_type',
+ '_spec_property_naming',
+ '_path_to_item',
+ '_configuration',
+ '_visited_composed_classes',
+ ])
+
+ @convert_js_args_to_python_args
+ def __init__(self, *args, **kwargs): # noqa: E501
+ """ObjectModelWithRefProps - a model defined in OpenAPI
+
+ Keyword Args:
+ _check_type (bool): if True, values for parameters in openapi_types
+ will be type checked and a TypeError will be
+ raised if the wrong type is input.
+ Defaults to True
+ _path_to_item (tuple/list): This is a list of keys or values to
+ drill down to the model in received_data
+ when deserializing a response
+ _spec_property_naming (bool): True if the variable names in the input data
+ are serialized names, as specified in the OpenAPI document.
+ False if the variable names in the input data
+ are pythonic names, e.g. snake case (default)
+ _configuration (Configuration): the instance to use when
+ deserializing a file_type parameter.
+ If passed, type conversion is attempted
+ If omitted no type conversion is done.
+ _visited_composed_classes (tuple): This stores a tuple of
+ classes that we have traveled through so that
+ if we see that class again we will not use its
+ discriminator again.
+ When traveling through a discriminator, the
+ composed schema that is
+ is traveled through is added to this set.
+ For example if Animal has a discriminator
+ petType and we pass in "Dog", and the class Dog
+ allOf includes Animal, we move through Animal
+ once using the discriminator, and pick Dog.
+ Then in Dog, we will make an instance of the
+ Animal class but this time we won't travel
+ through its discriminator because we passed in
+ _visited_composed_classes = (Animal,)
+ my_number (NumberWithValidations): [optional] # noqa: E501
+ my_string (str): [optional] # noqa: E501
+ my_boolean (bool): [optional] # noqa: E501
+ """
+
+ _check_type = kwargs.pop('_check_type', True)
+ _spec_property_naming = kwargs.pop('_spec_property_naming', False)
+ _path_to_item = kwargs.pop('_path_to_item', ())
+ _configuration = kwargs.pop('_configuration', None)
+ _visited_composed_classes = kwargs.pop('_visited_composed_classes', ())
+
+ if args:
+ raise ApiTypeError(
+ "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % (
+ args,
+ self.__class__.__name__,
+ ),
+ path_to_item=_path_to_item,
+ valid_classes=(self.__class__,),
+ )
+
+ self._data_store = {}
+ self._check_type = _check_type
+ self._spec_property_naming = _spec_property_naming
+ self._path_to_item = _path_to_item
+ self._configuration = _configuration
+ self._visited_composed_classes = _visited_composed_classes + (self.__class__,)
+
+ for var_name, var_value in kwargs.items():
+ if var_name not in self.attribute_map and \
+ self._configuration is not None and \
+ self._configuration.discard_unknown_keys and \
+ self.additional_properties_type is None:
+ # discard variable.
+ continue
+ setattr(self, var_name, var_value)
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/order.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/order.py
new file mode 100644
index 000000000000..b42f066848ab
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/order.py
@@ -0,0 +1,186 @@
+"""
+ 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: https://openapi-generator.tech
+"""
+
+
+import re # noqa: F401
+import sys # noqa: F401
+
+from petstore_api.model_utils import ( # noqa: F401
+ ApiTypeError,
+ ModelComposed,
+ ModelNormal,
+ ModelSimple,
+ cached_property,
+ change_keys_js_to_python,
+ convert_js_args_to_python_args,
+ date,
+ datetime,
+ file_type,
+ none_type,
+ validate_get_composed_info,
+)
+
+
+class Order(ModelNormal):
+ """NOTE: This class is auto generated by OpenAPI Generator.
+ Ref: https://openapi-generator.tech
+
+ Do not edit the class manually.
+
+ Attributes:
+ allowed_values (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ with a capitalized key describing the allowed value and an allowed
+ value. These dicts store the allowed enum values.
+ attribute_map (dict): The key is attribute name
+ and the value is json key in definition.
+ discriminator_value_class_map (dict): A dict to go from the discriminator
+ variable value to the discriminator class name.
+ validations (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ that stores validations for max_length, min_length, max_items,
+ min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
+ inclusive_minimum, and regex.
+ additional_properties_type (tuple): A tuple of classes accepted
+ as additional properties values.
+ """
+
+ allowed_values = {
+ ('status',): {
+ 'PLACED': "placed",
+ 'APPROVED': "approved",
+ 'DELIVERED': "delivered",
+ },
+ }
+
+ validations = {
+ }
+
+ additional_properties_type = None
+
+ _nullable = False
+
+ @cached_property
+ def openapi_types():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+
+ Returns
+ openapi_types (dict): The key is attribute name
+ and the value is attribute type.
+ """
+ return {
+ 'id': (int,), # noqa: E501
+ 'pet_id': (int,), # noqa: E501
+ 'quantity': (int,), # noqa: E501
+ 'ship_date': (datetime,), # noqa: E501
+ 'status': (str,), # noqa: E501
+ 'complete': (bool,), # noqa: E501
+ }
+
+ @cached_property
+ def discriminator():
+ return None
+
+
+ attribute_map = {
+ 'id': 'id', # noqa: E501
+ 'pet_id': 'petId', # noqa: E501
+ 'quantity': 'quantity', # noqa: E501
+ 'ship_date': 'shipDate', # noqa: E501
+ 'status': 'status', # noqa: E501
+ 'complete': 'complete', # noqa: E501
+ }
+
+ _composed_schemas = {}
+
+ required_properties = set([
+ '_data_store',
+ '_check_type',
+ '_spec_property_naming',
+ '_path_to_item',
+ '_configuration',
+ '_visited_composed_classes',
+ ])
+
+ @convert_js_args_to_python_args
+ def __init__(self, *args, **kwargs): # noqa: E501
+ """Order - a model defined in OpenAPI
+
+ Keyword Args:
+ _check_type (bool): if True, values for parameters in openapi_types
+ will be type checked and a TypeError will be
+ raised if the wrong type is input.
+ Defaults to True
+ _path_to_item (tuple/list): This is a list of keys or values to
+ drill down to the model in received_data
+ when deserializing a response
+ _spec_property_naming (bool): True if the variable names in the input data
+ are serialized names, as specified in the OpenAPI document.
+ False if the variable names in the input data
+ are pythonic names, e.g. snake case (default)
+ _configuration (Configuration): the instance to use when
+ deserializing a file_type parameter.
+ If passed, type conversion is attempted
+ If omitted no type conversion is done.
+ _visited_composed_classes (tuple): This stores a tuple of
+ classes that we have traveled through so that
+ if we see that class again we will not use its
+ discriminator again.
+ When traveling through a discriminator, the
+ composed schema that is
+ is traveled through is added to this set.
+ For example if Animal has a discriminator
+ petType and we pass in "Dog", and the class Dog
+ allOf includes Animal, we move through Animal
+ once using the discriminator, and pick Dog.
+ Then in Dog, we will make an instance of the
+ Animal class but this time we won't travel
+ through its discriminator because we passed in
+ _visited_composed_classes = (Animal,)
+ id (int): [optional] # noqa: E501
+ pet_id (int): [optional] # noqa: E501
+ quantity (int): [optional] # noqa: E501
+ ship_date (datetime): [optional] # noqa: E501
+ status (str): Order Status. [optional] # noqa: E501
+ complete (bool): [optional] if omitted the server will use the default value of False # noqa: E501
+ """
+
+ _check_type = kwargs.pop('_check_type', True)
+ _spec_property_naming = kwargs.pop('_spec_property_naming', False)
+ _path_to_item = kwargs.pop('_path_to_item', ())
+ _configuration = kwargs.pop('_configuration', None)
+ _visited_composed_classes = kwargs.pop('_visited_composed_classes', ())
+
+ if args:
+ raise ApiTypeError(
+ "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % (
+ args,
+ self.__class__.__name__,
+ ),
+ path_to_item=_path_to_item,
+ valid_classes=(self.__class__,),
+ )
+
+ self._data_store = {}
+ self._check_type = _check_type
+ self._spec_property_naming = _spec_property_naming
+ self._path_to_item = _path_to_item
+ self._configuration = _configuration
+ self._visited_composed_classes = _visited_composed_classes + (self.__class__,)
+
+ for var_name, var_value in kwargs.items():
+ if var_name not in self.attribute_map and \
+ self._configuration is not None and \
+ self._configuration.discard_unknown_keys and \
+ self.additional_properties_type is None:
+ # discard variable.
+ continue
+ setattr(self, var_name, var_value)
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/parent.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/parent.py
new file mode 100644
index 000000000000..b07448d9e1fe
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/parent.py
@@ -0,0 +1,212 @@
+"""
+ 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: https://openapi-generator.tech
+"""
+
+
+import re # noqa: F401
+import sys # noqa: F401
+
+from petstore_api.model_utils import ( # noqa: F401
+ ApiTypeError,
+ ModelComposed,
+ ModelNormal,
+ ModelSimple,
+ cached_property,
+ change_keys_js_to_python,
+ convert_js_args_to_python_args,
+ date,
+ datetime,
+ file_type,
+ none_type,
+ validate_get_composed_info,
+)
+
+def lazy_import():
+ from petstore_api.model.grandparent import Grandparent
+ from petstore_api.model.parent_all_of import ParentAllOf
+ globals()['Grandparent'] = Grandparent
+ globals()['ParentAllOf'] = ParentAllOf
+
+
+class Parent(ModelComposed):
+ """NOTE: This class is auto generated by OpenAPI Generator.
+ Ref: https://openapi-generator.tech
+
+ Do not edit the class manually.
+
+ Attributes:
+ allowed_values (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ with a capitalized key describing the allowed value and an allowed
+ value. These dicts store the allowed enum values.
+ attribute_map (dict): The key is attribute name
+ and the value is json key in definition.
+ discriminator_value_class_map (dict): A dict to go from the discriminator
+ variable value to the discriminator class name.
+ validations (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ that stores validations for max_length, min_length, max_items,
+ min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
+ inclusive_minimum, and regex.
+ additional_properties_type (tuple): A tuple of classes accepted
+ as additional properties values.
+ """
+
+ allowed_values = {
+ }
+
+ validations = {
+ }
+
+ additional_properties_type = None
+
+ _nullable = False
+
+ @cached_property
+ def openapi_types():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+
+ Returns
+ openapi_types (dict): The key is attribute name
+ and the value is attribute type.
+ """
+ lazy_import()
+ return {
+ 'radio_waves': (bool,), # noqa: E501
+ 'tele_vision': (bool,), # noqa: E501
+ }
+
+ @cached_property
+ def discriminator():
+ return None
+
+
+ attribute_map = {
+ 'radio_waves': 'radioWaves', # noqa: E501
+ 'tele_vision': 'teleVision', # noqa: E501
+ }
+
+ required_properties = set([
+ '_data_store',
+ '_check_type',
+ '_spec_property_naming',
+ '_path_to_item',
+ '_configuration',
+ '_visited_composed_classes',
+ '_composed_instances',
+ '_var_name_to_model_instances',
+ '_additional_properties_model_instances',
+ ])
+
+ @convert_js_args_to_python_args
+ def __init__(self, *args, **kwargs): # noqa: E501
+ """Parent - a model defined in OpenAPI
+
+ Keyword Args:
+ _check_type (bool): if True, values for parameters in openapi_types
+ will be type checked and a TypeError will be
+ raised if the wrong type is input.
+ Defaults to True
+ _path_to_item (tuple/list): This is a list of keys or values to
+ drill down to the model in received_data
+ when deserializing a response
+ _spec_property_naming (bool): True if the variable names in the input data
+ are serialized names, as specified in the OpenAPI document.
+ False if the variable names in the input data
+ are pythonic names, e.g. snake case (default)
+ _configuration (Configuration): the instance to use when
+ deserializing a file_type parameter.
+ If passed, type conversion is attempted
+ If omitted no type conversion is done.
+ _visited_composed_classes (tuple): This stores a tuple of
+ classes that we have traveled through so that
+ if we see that class again we will not use its
+ discriminator again.
+ When traveling through a discriminator, the
+ composed schema that is
+ is traveled through is added to this set.
+ For example if Animal has a discriminator
+ petType and we pass in "Dog", and the class Dog
+ allOf includes Animal, we move through Animal
+ once using the discriminator, and pick Dog.
+ Then in Dog, we will make an instance of the
+ Animal class but this time we won't travel
+ through its discriminator because we passed in
+ _visited_composed_classes = (Animal,)
+ radio_waves (bool): [optional] # noqa: E501
+ tele_vision (bool): [optional] # noqa: E501
+ """
+
+ _check_type = kwargs.pop('_check_type', True)
+ _spec_property_naming = kwargs.pop('_spec_property_naming', False)
+ _path_to_item = kwargs.pop('_path_to_item', ())
+ _configuration = kwargs.pop('_configuration', None)
+ _visited_composed_classes = kwargs.pop('_visited_composed_classes', ())
+
+ if args:
+ raise ApiTypeError(
+ "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % (
+ args,
+ self.__class__.__name__,
+ ),
+ path_to_item=_path_to_item,
+ valid_classes=(self.__class__,),
+ )
+
+ self._data_store = {}
+ self._check_type = _check_type
+ self._spec_property_naming = _spec_property_naming
+ self._path_to_item = _path_to_item
+ self._configuration = _configuration
+ self._visited_composed_classes = _visited_composed_classes + (self.__class__,)
+
+ constant_args = {
+ '_check_type': _check_type,
+ '_path_to_item': _path_to_item,
+ '_spec_property_naming': _spec_property_naming,
+ '_configuration': _configuration,
+ '_visited_composed_classes': self._visited_composed_classes,
+ }
+ composed_info = validate_get_composed_info(
+ constant_args, kwargs, self)
+ self._composed_instances = composed_info[0]
+ self._var_name_to_model_instances = composed_info[1]
+ self._additional_properties_model_instances = composed_info[2]
+ discarded_args = composed_info[3]
+
+ for var_name, var_value in kwargs.items():
+ if var_name in discarded_args and \
+ self._configuration is not None and \
+ self._configuration.discard_unknown_keys and \
+ self._additional_properties_model_instances:
+ # discard variable.
+ continue
+ setattr(self, var_name, var_value)
+
+ @cached_property
+ def _composed_schemas():
+ # we need this here to make our import statements work
+ # we must store _composed_schemas in here so the code is only run
+ # when we invoke this method. If we kept this at the class
+ # level we would get an error beause the class level
+ # code would be run when this module is imported, and these composed
+ # classes don't exist yet because their module has not finished
+ # loading
+ lazy_import()
+ return {
+ 'anyOf': [
+ ],
+ 'allOf': [
+ Grandparent,
+ ParentAllOf,
+ ],
+ 'oneOf': [
+ ],
+ }
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/parent_all_of.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/parent_all_of.py
new file mode 100644
index 000000000000..0d109f25a4c2
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/parent_all_of.py
@@ -0,0 +1,166 @@
+"""
+ 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: https://openapi-generator.tech
+"""
+
+
+import re # noqa: F401
+import sys # noqa: F401
+
+from petstore_api.model_utils import ( # noqa: F401
+ ApiTypeError,
+ ModelComposed,
+ ModelNormal,
+ ModelSimple,
+ cached_property,
+ change_keys_js_to_python,
+ convert_js_args_to_python_args,
+ date,
+ datetime,
+ file_type,
+ none_type,
+ validate_get_composed_info,
+)
+
+
+class ParentAllOf(ModelNormal):
+ """NOTE: This class is auto generated by OpenAPI Generator.
+ Ref: https://openapi-generator.tech
+
+ Do not edit the class manually.
+
+ Attributes:
+ allowed_values (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ with a capitalized key describing the allowed value and an allowed
+ value. These dicts store the allowed enum values.
+ attribute_map (dict): The key is attribute name
+ and the value is json key in definition.
+ discriminator_value_class_map (dict): A dict to go from the discriminator
+ variable value to the discriminator class name.
+ validations (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ that stores validations for max_length, min_length, max_items,
+ min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
+ inclusive_minimum, and regex.
+ additional_properties_type (tuple): A tuple of classes accepted
+ as additional properties values.
+ """
+
+ allowed_values = {
+ }
+
+ validations = {
+ }
+
+ additional_properties_type = None
+
+ _nullable = False
+
+ @cached_property
+ def openapi_types():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+
+ Returns
+ openapi_types (dict): The key is attribute name
+ and the value is attribute type.
+ """
+ return {
+ 'tele_vision': (bool,), # noqa: E501
+ }
+
+ @cached_property
+ def discriminator():
+ return None
+
+
+ attribute_map = {
+ 'tele_vision': 'teleVision', # noqa: E501
+ }
+
+ _composed_schemas = {}
+
+ required_properties = set([
+ '_data_store',
+ '_check_type',
+ '_spec_property_naming',
+ '_path_to_item',
+ '_configuration',
+ '_visited_composed_classes',
+ ])
+
+ @convert_js_args_to_python_args
+ def __init__(self, *args, **kwargs): # noqa: E501
+ """ParentAllOf - a model defined in OpenAPI
+
+ Keyword Args:
+ _check_type (bool): if True, values for parameters in openapi_types
+ will be type checked and a TypeError will be
+ raised if the wrong type is input.
+ Defaults to True
+ _path_to_item (tuple/list): This is a list of keys or values to
+ drill down to the model in received_data
+ when deserializing a response
+ _spec_property_naming (bool): True if the variable names in the input data
+ are serialized names, as specified in the OpenAPI document.
+ False if the variable names in the input data
+ are pythonic names, e.g. snake case (default)
+ _configuration (Configuration): the instance to use when
+ deserializing a file_type parameter.
+ If passed, type conversion is attempted
+ If omitted no type conversion is done.
+ _visited_composed_classes (tuple): This stores a tuple of
+ classes that we have traveled through so that
+ if we see that class again we will not use its
+ discriminator again.
+ When traveling through a discriminator, the
+ composed schema that is
+ is traveled through is added to this set.
+ For example if Animal has a discriminator
+ petType and we pass in "Dog", and the class Dog
+ allOf includes Animal, we move through Animal
+ once using the discriminator, and pick Dog.
+ Then in Dog, we will make an instance of the
+ Animal class but this time we won't travel
+ through its discriminator because we passed in
+ _visited_composed_classes = (Animal,)
+ tele_vision (bool): [optional] # noqa: E501
+ """
+
+ _check_type = kwargs.pop('_check_type', True)
+ _spec_property_naming = kwargs.pop('_spec_property_naming', False)
+ _path_to_item = kwargs.pop('_path_to_item', ())
+ _configuration = kwargs.pop('_configuration', None)
+ _visited_composed_classes = kwargs.pop('_visited_composed_classes', ())
+
+ if args:
+ raise ApiTypeError(
+ "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % (
+ args,
+ self.__class__.__name__,
+ ),
+ path_to_item=_path_to_item,
+ valid_classes=(self.__class__,),
+ )
+
+ self._data_store = {}
+ self._check_type = _check_type
+ self._spec_property_naming = _spec_property_naming
+ self._path_to_item = _path_to_item
+ self._configuration = _configuration
+ self._visited_composed_classes = _visited_composed_classes + (self.__class__,)
+
+ for var_name, var_value in kwargs.items():
+ if var_name not in self.attribute_map and \
+ self._configuration is not None and \
+ self._configuration.discard_unknown_keys and \
+ self.additional_properties_type is None:
+ # discard variable.
+ continue
+ setattr(self, var_name, var_value)
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/parent_pet.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/parent_pet.py
new file mode 100644
index 000000000000..597e30bb9c4a
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/parent_pet.py
@@ -0,0 +1,219 @@
+"""
+ 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: https://openapi-generator.tech
+"""
+
+
+import re # noqa: F401
+import sys # noqa: F401
+
+from petstore_api.model_utils import ( # noqa: F401
+ ApiTypeError,
+ ModelComposed,
+ ModelNormal,
+ ModelSimple,
+ cached_property,
+ change_keys_js_to_python,
+ convert_js_args_to_python_args,
+ date,
+ datetime,
+ file_type,
+ none_type,
+ validate_get_composed_info,
+)
+
+def lazy_import():
+ from petstore_api.model.child_cat import ChildCat
+ from petstore_api.model.child_dog import ChildDog
+ from petstore_api.model.child_lizard import ChildLizard
+ from petstore_api.model.grandparent_animal import GrandparentAnimal
+ globals()['ChildCat'] = ChildCat
+ globals()['ChildDog'] = ChildDog
+ globals()['ChildLizard'] = ChildLizard
+ globals()['GrandparentAnimal'] = GrandparentAnimal
+
+
+class ParentPet(ModelComposed):
+ """NOTE: This class is auto generated by OpenAPI Generator.
+ Ref: https://openapi-generator.tech
+
+ Do not edit the class manually.
+
+ Attributes:
+ allowed_values (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ with a capitalized key describing the allowed value and an allowed
+ value. These dicts store the allowed enum values.
+ attribute_map (dict): The key is attribute name
+ and the value is json key in definition.
+ discriminator_value_class_map (dict): A dict to go from the discriminator
+ variable value to the discriminator class name.
+ validations (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ that stores validations for max_length, min_length, max_items,
+ min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
+ inclusive_minimum, and regex.
+ additional_properties_type (tuple): A tuple of classes accepted
+ as additional properties values.
+ """
+
+ allowed_values = {
+ }
+
+ validations = {
+ }
+
+ additional_properties_type = None
+
+ _nullable = False
+
+ @cached_property
+ def openapi_types():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+
+ Returns
+ openapi_types (dict): The key is attribute name
+ and the value is attribute type.
+ """
+ lazy_import()
+ return {
+ 'pet_type': (str,), # noqa: E501
+ }
+
+ @cached_property
+ def discriminator():
+ lazy_import()
+ val = {
+ 'ChildCat': ChildCat,
+ 'ChildDog': ChildDog,
+ 'ChildLizard': ChildLizard,
+ }
+ if not val:
+ return None
+ return {'pet_type': val}
+
+ attribute_map = {
+ 'pet_type': 'pet_type', # noqa: E501
+ }
+
+ required_properties = set([
+ '_data_store',
+ '_check_type',
+ '_spec_property_naming',
+ '_path_to_item',
+ '_configuration',
+ '_visited_composed_classes',
+ '_composed_instances',
+ '_var_name_to_model_instances',
+ '_additional_properties_model_instances',
+ ])
+
+ @convert_js_args_to_python_args
+ def __init__(self, *args, **kwargs): # noqa: E501
+ """ParentPet - a model defined in OpenAPI
+
+ Keyword Args:
+ pet_type (str):
+ _check_type (bool): if True, values for parameters in openapi_types
+ will be type checked and a TypeError will be
+ raised if the wrong type is input.
+ Defaults to True
+ _path_to_item (tuple/list): This is a list of keys or values to
+ drill down to the model in received_data
+ when deserializing a response
+ _spec_property_naming (bool): True if the variable names in the input data
+ are serialized names, as specified in the OpenAPI document.
+ False if the variable names in the input data
+ are pythonic names, e.g. snake case (default)
+ _configuration (Configuration): the instance to use when
+ deserializing a file_type parameter.
+ If passed, type conversion is attempted
+ If omitted no type conversion is done.
+ _visited_composed_classes (tuple): This stores a tuple of
+ classes that we have traveled through so that
+ if we see that class again we will not use its
+ discriminator again.
+ When traveling through a discriminator, the
+ composed schema that is
+ is traveled through is added to this set.
+ For example if Animal has a discriminator
+ petType and we pass in "Dog", and the class Dog
+ allOf includes Animal, we move through Animal
+ once using the discriminator, and pick Dog.
+ Then in Dog, we will make an instance of the
+ Animal class but this time we won't travel
+ through its discriminator because we passed in
+ _visited_composed_classes = (Animal,)
+ """
+
+ _check_type = kwargs.pop('_check_type', True)
+ _spec_property_naming = kwargs.pop('_spec_property_naming', False)
+ _path_to_item = kwargs.pop('_path_to_item', ())
+ _configuration = kwargs.pop('_configuration', None)
+ _visited_composed_classes = kwargs.pop('_visited_composed_classes', ())
+
+ if args:
+ raise ApiTypeError(
+ "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % (
+ args,
+ self.__class__.__name__,
+ ),
+ path_to_item=_path_to_item,
+ valid_classes=(self.__class__,),
+ )
+
+ self._data_store = {}
+ self._check_type = _check_type
+ self._spec_property_naming = _spec_property_naming
+ self._path_to_item = _path_to_item
+ self._configuration = _configuration
+ self._visited_composed_classes = _visited_composed_classes + (self.__class__,)
+
+ constant_args = {
+ '_check_type': _check_type,
+ '_path_to_item': _path_to_item,
+ '_spec_property_naming': _spec_property_naming,
+ '_configuration': _configuration,
+ '_visited_composed_classes': self._visited_composed_classes,
+ }
+ composed_info = validate_get_composed_info(
+ constant_args, kwargs, self)
+ self._composed_instances = composed_info[0]
+ self._var_name_to_model_instances = composed_info[1]
+ self._additional_properties_model_instances = composed_info[2]
+ discarded_args = composed_info[3]
+
+ for var_name, var_value in kwargs.items():
+ if var_name in discarded_args and \
+ self._configuration is not None and \
+ self._configuration.discard_unknown_keys and \
+ self._additional_properties_model_instances:
+ # discard variable.
+ continue
+ setattr(self, var_name, var_value)
+
+ @cached_property
+ def _composed_schemas():
+ # we need this here to make our import statements work
+ # we must store _composed_schemas in here so the code is only run
+ # when we invoke this method. If we kept this at the class
+ # level we would get an error beause the class level
+ # code would be run when this module is imported, and these composed
+ # classes don't exist yet because their module has not finished
+ # loading
+ lazy_import()
+ return {
+ 'anyOf': [
+ ],
+ 'allOf': [
+ GrandparentAnimal,
+ ],
+ 'oneOf': [
+ ],
+ }
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/pet.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/pet.py
new file mode 100644
index 000000000000..e9f1e30a3196
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/pet.py
@@ -0,0 +1,197 @@
+"""
+ 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: https://openapi-generator.tech
+"""
+
+
+import re # noqa: F401
+import sys # noqa: F401
+
+from petstore_api.model_utils import ( # noqa: F401
+ ApiTypeError,
+ ModelComposed,
+ ModelNormal,
+ ModelSimple,
+ cached_property,
+ change_keys_js_to_python,
+ convert_js_args_to_python_args,
+ date,
+ datetime,
+ file_type,
+ none_type,
+ validate_get_composed_info,
+)
+
+def lazy_import():
+ from petstore_api.model.category import Category
+ from petstore_api.model.tag import Tag
+ globals()['Category'] = Category
+ globals()['Tag'] = Tag
+
+
+class Pet(ModelNormal):
+ """NOTE: This class is auto generated by OpenAPI Generator.
+ Ref: https://openapi-generator.tech
+
+ Do not edit the class manually.
+
+ Attributes:
+ allowed_values (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ with a capitalized key describing the allowed value and an allowed
+ value. These dicts store the allowed enum values.
+ attribute_map (dict): The key is attribute name
+ and the value is json key in definition.
+ discriminator_value_class_map (dict): A dict to go from the discriminator
+ variable value to the discriminator class name.
+ validations (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ that stores validations for max_length, min_length, max_items,
+ min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
+ inclusive_minimum, and regex.
+ additional_properties_type (tuple): A tuple of classes accepted
+ as additional properties values.
+ """
+
+ allowed_values = {
+ ('status',): {
+ 'AVAILABLE': "available",
+ 'PENDING': "pending",
+ 'SOLD': "sold",
+ },
+ }
+
+ validations = {
+ }
+
+ additional_properties_type = None
+
+ _nullable = False
+
+ @cached_property
+ def openapi_types():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+
+ Returns
+ openapi_types (dict): The key is attribute name
+ and the value is attribute type.
+ """
+ lazy_import()
+ return {
+ 'name': (str,), # noqa: E501
+ 'photo_urls': ([str],), # noqa: E501
+ 'id': (int,), # noqa: E501
+ 'category': (Category,), # noqa: E501
+ 'tags': ([Tag],), # noqa: E501
+ 'status': (str,), # noqa: E501
+ }
+
+ @cached_property
+ def discriminator():
+ return None
+
+
+ attribute_map = {
+ 'name': 'name', # noqa: E501
+ 'photo_urls': 'photoUrls', # noqa: E501
+ 'id': 'id', # noqa: E501
+ 'category': 'category', # noqa: E501
+ 'tags': 'tags', # noqa: E501
+ 'status': 'status', # noqa: E501
+ }
+
+ _composed_schemas = {}
+
+ required_properties = set([
+ '_data_store',
+ '_check_type',
+ '_spec_property_naming',
+ '_path_to_item',
+ '_configuration',
+ '_visited_composed_classes',
+ ])
+
+ @convert_js_args_to_python_args
+ def __init__(self, name, photo_urls, *args, **kwargs): # noqa: E501
+ """Pet - a model defined in OpenAPI
+
+ Args:
+ name (str):
+ photo_urls ([str]):
+
+ Keyword Args:
+ _check_type (bool): if True, values for parameters in openapi_types
+ will be type checked and a TypeError will be
+ raised if the wrong type is input.
+ Defaults to True
+ _path_to_item (tuple/list): This is a list of keys or values to
+ drill down to the model in received_data
+ when deserializing a response
+ _spec_property_naming (bool): True if the variable names in the input data
+ are serialized names, as specified in the OpenAPI document.
+ False if the variable names in the input data
+ are pythonic names, e.g. snake case (default)
+ _configuration (Configuration): the instance to use when
+ deserializing a file_type parameter.
+ If passed, type conversion is attempted
+ If omitted no type conversion is done.
+ _visited_composed_classes (tuple): This stores a tuple of
+ classes that we have traveled through so that
+ if we see that class again we will not use its
+ discriminator again.
+ When traveling through a discriminator, the
+ composed schema that is
+ is traveled through is added to this set.
+ For example if Animal has a discriminator
+ petType and we pass in "Dog", and the class Dog
+ allOf includes Animal, we move through Animal
+ once using the discriminator, and pick Dog.
+ Then in Dog, we will make an instance of the
+ Animal class but this time we won't travel
+ through its discriminator because we passed in
+ _visited_composed_classes = (Animal,)
+ id (int): [optional] # noqa: E501
+ category (Category): [optional] # noqa: E501
+ tags ([Tag]): [optional] # noqa: E501
+ status (str): pet status in the store. [optional] # noqa: E501
+ """
+
+ _check_type = kwargs.pop('_check_type', True)
+ _spec_property_naming = kwargs.pop('_spec_property_naming', False)
+ _path_to_item = kwargs.pop('_path_to_item', ())
+ _configuration = kwargs.pop('_configuration', None)
+ _visited_composed_classes = kwargs.pop('_visited_composed_classes', ())
+
+ if args:
+ raise ApiTypeError(
+ "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % (
+ args,
+ self.__class__.__name__,
+ ),
+ path_to_item=_path_to_item,
+ valid_classes=(self.__class__,),
+ )
+
+ self._data_store = {}
+ self._check_type = _check_type
+ self._spec_property_naming = _spec_property_naming
+ self._path_to_item = _path_to_item
+ self._configuration = _configuration
+ self._visited_composed_classes = _visited_composed_classes + (self.__class__,)
+
+ self.name = name
+ self.photo_urls = photo_urls
+ for var_name, var_value in kwargs.items():
+ if var_name not in self.attribute_map and \
+ self._configuration is not None and \
+ self._configuration.discard_unknown_keys and \
+ self.additional_properties_type is None:
+ # discard variable.
+ continue
+ setattr(self, var_name, var_value)
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/player.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/player.py
new file mode 100644
index 000000000000..6e4485fb6500
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/player.py
@@ -0,0 +1,172 @@
+"""
+ 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: https://openapi-generator.tech
+"""
+
+
+import re # noqa: F401
+import sys # noqa: F401
+
+from petstore_api.model_utils import ( # noqa: F401
+ ApiTypeError,
+ ModelComposed,
+ ModelNormal,
+ ModelSimple,
+ cached_property,
+ change_keys_js_to_python,
+ convert_js_args_to_python_args,
+ date,
+ datetime,
+ file_type,
+ none_type,
+ validate_get_composed_info,
+)
+
+
+class Player(ModelNormal):
+ """NOTE: This class is auto generated by OpenAPI Generator.
+ Ref: https://openapi-generator.tech
+
+ Do not edit the class manually.
+
+ Attributes:
+ allowed_values (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ with a capitalized key describing the allowed value and an allowed
+ value. These dicts store the allowed enum values.
+ attribute_map (dict): The key is attribute name
+ and the value is json key in definition.
+ discriminator_value_class_map (dict): A dict to go from the discriminator
+ variable value to the discriminator class name.
+ validations (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ that stores validations for max_length, min_length, max_items,
+ min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
+ inclusive_minimum, and regex.
+ additional_properties_type (tuple): A tuple of classes accepted
+ as additional properties values.
+ """
+
+ allowed_values = {
+ }
+
+ validations = {
+ }
+
+ additional_properties_type = None
+
+ _nullable = False
+
+ @cached_property
+ def openapi_types():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+
+ Returns
+ openapi_types (dict): The key is attribute name
+ and the value is attribute type.
+ """
+ return {
+ 'name': (str,), # noqa: E501
+ 'enemy_player': (Player,), # noqa: E501
+ }
+
+ @cached_property
+ def discriminator():
+ return None
+
+
+ attribute_map = {
+ 'name': 'name', # noqa: E501
+ 'enemy_player': 'enemyPlayer', # noqa: E501
+ }
+
+ _composed_schemas = {}
+
+ required_properties = set([
+ '_data_store',
+ '_check_type',
+ '_spec_property_naming',
+ '_path_to_item',
+ '_configuration',
+ '_visited_composed_classes',
+ ])
+
+ @convert_js_args_to_python_args
+ def __init__(self, name, *args, **kwargs): # noqa: E501
+ """Player - a model defined in OpenAPI
+
+ Args:
+ name (str):
+
+ Keyword Args:
+ _check_type (bool): if True, values for parameters in openapi_types
+ will be type checked and a TypeError will be
+ raised if the wrong type is input.
+ Defaults to True
+ _path_to_item (tuple/list): This is a list of keys or values to
+ drill down to the model in received_data
+ when deserializing a response
+ _spec_property_naming (bool): True if the variable names in the input data
+ are serialized names, as specified in the OpenAPI document.
+ False if the variable names in the input data
+ are pythonic names, e.g. snake case (default)
+ _configuration (Configuration): the instance to use when
+ deserializing a file_type parameter.
+ If passed, type conversion is attempted
+ If omitted no type conversion is done.
+ _visited_composed_classes (tuple): This stores a tuple of
+ classes that we have traveled through so that
+ if we see that class again we will not use its
+ discriminator again.
+ When traveling through a discriminator, the
+ composed schema that is
+ is traveled through is added to this set.
+ For example if Animal has a discriminator
+ petType and we pass in "Dog", and the class Dog
+ allOf includes Animal, we move through Animal
+ once using the discriminator, and pick Dog.
+ Then in Dog, we will make an instance of the
+ Animal class but this time we won't travel
+ through its discriminator because we passed in
+ _visited_composed_classes = (Animal,)
+ enemy_player (Player): [optional] # noqa: E501
+ """
+
+ _check_type = kwargs.pop('_check_type', True)
+ _spec_property_naming = kwargs.pop('_spec_property_naming', False)
+ _path_to_item = kwargs.pop('_path_to_item', ())
+ _configuration = kwargs.pop('_configuration', None)
+ _visited_composed_classes = kwargs.pop('_visited_composed_classes', ())
+
+ if args:
+ raise ApiTypeError(
+ "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % (
+ args,
+ self.__class__.__name__,
+ ),
+ path_to_item=_path_to_item,
+ valid_classes=(self.__class__,),
+ )
+
+ self._data_store = {}
+ self._check_type = _check_type
+ self._spec_property_naming = _spec_property_naming
+ self._path_to_item = _path_to_item
+ self._configuration = _configuration
+ self._visited_composed_classes = _visited_composed_classes + (self.__class__,)
+
+ self.name = name
+ for var_name, var_value in kwargs.items():
+ if var_name not in self.attribute_map and \
+ self._configuration is not None and \
+ self._configuration.discard_unknown_keys and \
+ self.additional_properties_type is None:
+ # discard variable.
+ continue
+ setattr(self, var_name, var_value)
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/read_only_first.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/read_only_first.py
new file mode 100644
index 000000000000..5c68eab91ea3
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/read_only_first.py
@@ -0,0 +1,169 @@
+"""
+ 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: https://openapi-generator.tech
+"""
+
+
+import re # noqa: F401
+import sys # noqa: F401
+
+from petstore_api.model_utils import ( # noqa: F401
+ ApiTypeError,
+ ModelComposed,
+ ModelNormal,
+ ModelSimple,
+ cached_property,
+ change_keys_js_to_python,
+ convert_js_args_to_python_args,
+ date,
+ datetime,
+ file_type,
+ none_type,
+ validate_get_composed_info,
+)
+
+
+class ReadOnlyFirst(ModelNormal):
+ """NOTE: This class is auto generated by OpenAPI Generator.
+ Ref: https://openapi-generator.tech
+
+ Do not edit the class manually.
+
+ Attributes:
+ allowed_values (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ with a capitalized key describing the allowed value and an allowed
+ value. These dicts store the allowed enum values.
+ attribute_map (dict): The key is attribute name
+ and the value is json key in definition.
+ discriminator_value_class_map (dict): A dict to go from the discriminator
+ variable value to the discriminator class name.
+ validations (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ that stores validations for max_length, min_length, max_items,
+ min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
+ inclusive_minimum, and regex.
+ additional_properties_type (tuple): A tuple of classes accepted
+ as additional properties values.
+ """
+
+ allowed_values = {
+ }
+
+ validations = {
+ }
+
+ additional_properties_type = None
+
+ _nullable = False
+
+ @cached_property
+ def openapi_types():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+
+ Returns
+ openapi_types (dict): The key is attribute name
+ and the value is attribute type.
+ """
+ return {
+ 'bar': (str,), # noqa: E501
+ 'baz': (str,), # noqa: E501
+ }
+
+ @cached_property
+ def discriminator():
+ return None
+
+
+ attribute_map = {
+ 'bar': 'bar', # noqa: E501
+ 'baz': 'baz', # noqa: E501
+ }
+
+ _composed_schemas = {}
+
+ required_properties = set([
+ '_data_store',
+ '_check_type',
+ '_spec_property_naming',
+ '_path_to_item',
+ '_configuration',
+ '_visited_composed_classes',
+ ])
+
+ @convert_js_args_to_python_args
+ def __init__(self, *args, **kwargs): # noqa: E501
+ """ReadOnlyFirst - a model defined in OpenAPI
+
+ Keyword Args:
+ _check_type (bool): if True, values for parameters in openapi_types
+ will be type checked and a TypeError will be
+ raised if the wrong type is input.
+ Defaults to True
+ _path_to_item (tuple/list): This is a list of keys or values to
+ drill down to the model in received_data
+ when deserializing a response
+ _spec_property_naming (bool): True if the variable names in the input data
+ are serialized names, as specified in the OpenAPI document.
+ False if the variable names in the input data
+ are pythonic names, e.g. snake case (default)
+ _configuration (Configuration): the instance to use when
+ deserializing a file_type parameter.
+ If passed, type conversion is attempted
+ If omitted no type conversion is done.
+ _visited_composed_classes (tuple): This stores a tuple of
+ classes that we have traveled through so that
+ if we see that class again we will not use its
+ discriminator again.
+ When traveling through a discriminator, the
+ composed schema that is
+ is traveled through is added to this set.
+ For example if Animal has a discriminator
+ petType and we pass in "Dog", and the class Dog
+ allOf includes Animal, we move through Animal
+ once using the discriminator, and pick Dog.
+ Then in Dog, we will make an instance of the
+ Animal class but this time we won't travel
+ through its discriminator because we passed in
+ _visited_composed_classes = (Animal,)
+ bar (str): [optional] # noqa: E501
+ baz (str): [optional] # noqa: E501
+ """
+
+ _check_type = kwargs.pop('_check_type', True)
+ _spec_property_naming = kwargs.pop('_spec_property_naming', False)
+ _path_to_item = kwargs.pop('_path_to_item', ())
+ _configuration = kwargs.pop('_configuration', None)
+ _visited_composed_classes = kwargs.pop('_visited_composed_classes', ())
+
+ if args:
+ raise ApiTypeError(
+ "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % (
+ args,
+ self.__class__.__name__,
+ ),
+ path_to_item=_path_to_item,
+ valid_classes=(self.__class__,),
+ )
+
+ self._data_store = {}
+ self._check_type = _check_type
+ self._spec_property_naming = _spec_property_naming
+ self._path_to_item = _path_to_item
+ self._configuration = _configuration
+ self._visited_composed_classes = _visited_composed_classes + (self.__class__,)
+
+ for var_name, var_value in kwargs.items():
+ if var_name not in self.attribute_map and \
+ self._configuration is not None and \
+ self._configuration.discard_unknown_keys and \
+ self.additional_properties_type is None:
+ # discard variable.
+ continue
+ setattr(self, var_name, var_value)
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/special_model_name.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/special_model_name.py
new file mode 100644
index 000000000000..823e77596636
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/special_model_name.py
@@ -0,0 +1,166 @@
+"""
+ 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: https://openapi-generator.tech
+"""
+
+
+import re # noqa: F401
+import sys # noqa: F401
+
+from petstore_api.model_utils import ( # noqa: F401
+ ApiTypeError,
+ ModelComposed,
+ ModelNormal,
+ ModelSimple,
+ cached_property,
+ change_keys_js_to_python,
+ convert_js_args_to_python_args,
+ date,
+ datetime,
+ file_type,
+ none_type,
+ validate_get_composed_info,
+)
+
+
+class SpecialModelName(ModelNormal):
+ """NOTE: This class is auto generated by OpenAPI Generator.
+ Ref: https://openapi-generator.tech
+
+ Do not edit the class manually.
+
+ Attributes:
+ allowed_values (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ with a capitalized key describing the allowed value and an allowed
+ value. These dicts store the allowed enum values.
+ attribute_map (dict): The key is attribute name
+ and the value is json key in definition.
+ discriminator_value_class_map (dict): A dict to go from the discriminator
+ variable value to the discriminator class name.
+ validations (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ that stores validations for max_length, min_length, max_items,
+ min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
+ inclusive_minimum, and regex.
+ additional_properties_type (tuple): A tuple of classes accepted
+ as additional properties values.
+ """
+
+ allowed_values = {
+ }
+
+ validations = {
+ }
+
+ additional_properties_type = None
+
+ _nullable = False
+
+ @cached_property
+ def openapi_types():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+
+ Returns
+ openapi_types (dict): The key is attribute name
+ and the value is attribute type.
+ """
+ return {
+ 'special_property_name': (int,), # noqa: E501
+ }
+
+ @cached_property
+ def discriminator():
+ return None
+
+
+ attribute_map = {
+ 'special_property_name': '$special[property.name]', # noqa: E501
+ }
+
+ _composed_schemas = {}
+
+ required_properties = set([
+ '_data_store',
+ '_check_type',
+ '_spec_property_naming',
+ '_path_to_item',
+ '_configuration',
+ '_visited_composed_classes',
+ ])
+
+ @convert_js_args_to_python_args
+ def __init__(self, *args, **kwargs): # noqa: E501
+ """SpecialModelName - a model defined in OpenAPI
+
+ Keyword Args:
+ _check_type (bool): if True, values for parameters in openapi_types
+ will be type checked and a TypeError will be
+ raised if the wrong type is input.
+ Defaults to True
+ _path_to_item (tuple/list): This is a list of keys or values to
+ drill down to the model in received_data
+ when deserializing a response
+ _spec_property_naming (bool): True if the variable names in the input data
+ are serialized names, as specified in the OpenAPI document.
+ False if the variable names in the input data
+ are pythonic names, e.g. snake case (default)
+ _configuration (Configuration): the instance to use when
+ deserializing a file_type parameter.
+ If passed, type conversion is attempted
+ If omitted no type conversion is done.
+ _visited_composed_classes (tuple): This stores a tuple of
+ classes that we have traveled through so that
+ if we see that class again we will not use its
+ discriminator again.
+ When traveling through a discriminator, the
+ composed schema that is
+ is traveled through is added to this set.
+ For example if Animal has a discriminator
+ petType and we pass in "Dog", and the class Dog
+ allOf includes Animal, we move through Animal
+ once using the discriminator, and pick Dog.
+ Then in Dog, we will make an instance of the
+ Animal class but this time we won't travel
+ through its discriminator because we passed in
+ _visited_composed_classes = (Animal,)
+ special_property_name (int): [optional] # noqa: E501
+ """
+
+ _check_type = kwargs.pop('_check_type', True)
+ _spec_property_naming = kwargs.pop('_spec_property_naming', False)
+ _path_to_item = kwargs.pop('_path_to_item', ())
+ _configuration = kwargs.pop('_configuration', None)
+ _visited_composed_classes = kwargs.pop('_visited_composed_classes', ())
+
+ if args:
+ raise ApiTypeError(
+ "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % (
+ args,
+ self.__class__.__name__,
+ ),
+ path_to_item=_path_to_item,
+ valid_classes=(self.__class__,),
+ )
+
+ self._data_store = {}
+ self._check_type = _check_type
+ self._spec_property_naming = _spec_property_naming
+ self._path_to_item = _path_to_item
+ self._configuration = _configuration
+ self._visited_composed_classes = _visited_composed_classes + (self.__class__,)
+
+ for var_name, var_value in kwargs.items():
+ if var_name not in self.attribute_map and \
+ self._configuration is not None and \
+ self._configuration.discard_unknown_keys and \
+ self.additional_properties_type is None:
+ # discard variable.
+ continue
+ setattr(self, var_name, var_value)
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/string_boolean_map.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/string_boolean_map.py
new file mode 100644
index 000000000000..4ac526991839
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/string_boolean_map.py
@@ -0,0 +1,169 @@
+"""
+ 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: https://openapi-generator.tech
+"""
+
+
+import re # noqa: F401
+import sys # noqa: F401
+
+from petstore_api.model_utils import ( # noqa: F401
+ ApiTypeError,
+ ModelComposed,
+ ModelNormal,
+ ModelSimple,
+ cached_property,
+ change_keys_js_to_python,
+ convert_js_args_to_python_args,
+ date,
+ datetime,
+ file_type,
+ none_type,
+ validate_get_composed_info,
+)
+
+
+class StringBooleanMap(ModelNormal):
+ """NOTE: This class is auto generated by OpenAPI Generator.
+ Ref: https://openapi-generator.tech
+
+ Do not edit the class manually.
+
+ Attributes:
+ allowed_values (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ with a capitalized key describing the allowed value and an allowed
+ value. These dicts store the allowed enum values.
+ attribute_map (dict): The key is attribute name
+ and the value is json key in definition.
+ discriminator_value_class_map (dict): A dict to go from the discriminator
+ variable value to the discriminator class name.
+ validations (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ that stores validations for max_length, min_length, max_items,
+ min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
+ inclusive_minimum, and regex.
+ additional_properties_type (tuple): A tuple of classes accepted
+ as additional properties values.
+ """
+
+ allowed_values = {
+ }
+
+ validations = {
+ }
+
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ return (bool,) # noqa: E501
+
+ _nullable = False
+
+ @cached_property
+ def openapi_types():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+
+ Returns
+ openapi_types (dict): The key is attribute name
+ and the value is attribute type.
+ """
+ return {
+ }
+
+ @cached_property
+ def discriminator():
+ return None
+
+
+ attribute_map = {
+ }
+
+ _composed_schemas = {}
+
+ required_properties = set([
+ '_data_store',
+ '_check_type',
+ '_spec_property_naming',
+ '_path_to_item',
+ '_configuration',
+ '_visited_composed_classes',
+ ])
+
+ @convert_js_args_to_python_args
+ def __init__(self, *args, **kwargs): # noqa: E501
+ """StringBooleanMap - a model defined in OpenAPI
+
+ Keyword Args:
+ _check_type (bool): if True, values for parameters in openapi_types
+ will be type checked and a TypeError will be
+ raised if the wrong type is input.
+ Defaults to True
+ _path_to_item (tuple/list): This is a list of keys or values to
+ drill down to the model in received_data
+ when deserializing a response
+ _spec_property_naming (bool): True if the variable names in the input data
+ are serialized names, as specified in the OpenAPI document.
+ False if the variable names in the input data
+ are pythonic names, e.g. snake case (default)
+ _configuration (Configuration): the instance to use when
+ deserializing a file_type parameter.
+ If passed, type conversion is attempted
+ If omitted no type conversion is done.
+ _visited_composed_classes (tuple): This stores a tuple of
+ classes that we have traveled through so that
+ if we see that class again we will not use its
+ discriminator again.
+ When traveling through a discriminator, the
+ composed schema that is
+ is traveled through is added to this set.
+ For example if Animal has a discriminator
+ petType and we pass in "Dog", and the class Dog
+ allOf includes Animal, we move through Animal
+ once using the discriminator, and pick Dog.
+ Then in Dog, we will make an instance of the
+ Animal class but this time we won't travel
+ through its discriminator because we passed in
+ _visited_composed_classes = (Animal,)
+ """
+
+ _check_type = kwargs.pop('_check_type', True)
+ _spec_property_naming = kwargs.pop('_spec_property_naming', False)
+ _path_to_item = kwargs.pop('_path_to_item', ())
+ _configuration = kwargs.pop('_configuration', None)
+ _visited_composed_classes = kwargs.pop('_visited_composed_classes', ())
+
+ if args:
+ raise ApiTypeError(
+ "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % (
+ args,
+ self.__class__.__name__,
+ ),
+ path_to_item=_path_to_item,
+ valid_classes=(self.__class__,),
+ )
+
+ self._data_store = {}
+ self._check_type = _check_type
+ self._spec_property_naming = _spec_property_naming
+ self._path_to_item = _path_to_item
+ self._configuration = _configuration
+ self._visited_composed_classes = _visited_composed_classes + (self.__class__,)
+
+ for var_name, var_value in kwargs.items():
+ if var_name not in self.attribute_map and \
+ self._configuration is not None and \
+ self._configuration.discard_unknown_keys and \
+ self.additional_properties_type is None:
+ # discard variable.
+ continue
+ setattr(self, var_name, var_value)
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/string_enum.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/string_enum.py
new file mode 100644
index 000000000000..37dc04332cac
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/string_enum.py
@@ -0,0 +1,184 @@
+"""
+ 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: https://openapi-generator.tech
+"""
+
+
+import re # noqa: F401
+import sys # noqa: F401
+
+from petstore_api.model_utils import ( # noqa: F401
+ ApiTypeError,
+ ModelComposed,
+ ModelNormal,
+ ModelSimple,
+ cached_property,
+ change_keys_js_to_python,
+ convert_js_args_to_python_args,
+ date,
+ datetime,
+ file_type,
+ none_type,
+ validate_get_composed_info,
+)
+
+
+class StringEnum(ModelSimple):
+ """NOTE: This class is auto generated by OpenAPI Generator.
+ Ref: https://openapi-generator.tech
+
+ Do not edit the class manually.
+
+ Attributes:
+ allowed_values (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ with a capitalized key describing the allowed value and an allowed
+ value. These dicts store the allowed enum values.
+ validations (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ that stores validations for max_length, min_length, max_items,
+ min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
+ inclusive_minimum, and regex.
+ additional_properties_type (tuple): A tuple of classes accepted
+ as additional properties values.
+ """
+
+ allowed_values = {
+ ('value',): {
+ 'PLACED': "placed",
+ 'APPROVED': "approved",
+ 'DELIVERED': "delivered",
+ },
+ }
+
+ validations = {
+ }
+
+ additional_properties_type = None
+
+ _nullable = False
+
+ @cached_property
+ def openapi_types():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+
+ Returns
+ openapi_types (dict): The key is attribute name
+ and the value is attribute type.
+ """
+ return {
+ 'value': (str,),
+ }
+
+ @cached_property
+ def discriminator():
+ return None
+
+
+ attribute_map = {}
+
+ _composed_schemas = None
+
+ required_properties = set([
+ '_data_store',
+ '_check_type',
+ '_spec_property_naming',
+ '_path_to_item',
+ '_configuration',
+ '_visited_composed_classes',
+ ])
+
+ @convert_js_args_to_python_args
+ def __init__(self, *args, **kwargs):
+ """StringEnum - a model defined in OpenAPI
+
+ Note that value can be passed either in args or in kwargs, but not in both.
+
+ Args:
+ args[0] (str):, must be one of ["placed", "approved", "delivered", ] # noqa: E501
+
+ Keyword Args:
+ value (str):, must be one of ["placed", "approved", "delivered", ] # noqa: E501
+ _check_type (bool): if True, values for parameters in openapi_types
+ will be type checked and a TypeError will be
+ raised if the wrong type is input.
+ Defaults to True
+ _path_to_item (tuple/list): This is a list of keys or values to
+ drill down to the model in received_data
+ when deserializing a response
+ _spec_property_naming (bool): True if the variable names in the input data
+ are serialized names, as specified in the OpenAPI document.
+ False if the variable names in the input data
+ are pythonic names, e.g. snake case (default)
+ _configuration (Configuration): the instance to use when
+ deserializing a file_type parameter.
+ If passed, type conversion is attempted
+ If omitted no type conversion is done.
+ _visited_composed_classes (tuple): This stores a tuple of
+ classes that we have traveled through so that
+ if we see that class again we will not use its
+ discriminator again.
+ When traveling through a discriminator, the
+ composed schema that is
+ is traveled through is added to this set.
+ For example if Animal has a discriminator
+ petType and we pass in "Dog", and the class Dog
+ allOf includes Animal, we move through Animal
+ once using the discriminator, and pick Dog.
+ Then in Dog, we will make an instance of the
+ Animal class but this time we won't travel
+ through its discriminator because we passed in
+ _visited_composed_classes = (Animal,)
+ """
+ # required up here when default value is not given
+ _path_to_item = kwargs.pop('_path_to_item', ())
+
+ if 'value' in kwargs:
+ value = kwargs.pop('value')
+ elif args:
+ args = list(args)
+ value = args.pop(0)
+ else:
+ raise ApiTypeError(
+ "value is required, but not passed in args or kwargs and doesn't have default",
+ path_to_item=_path_to_item,
+ valid_classes=(self.__class__,),
+ )
+
+ _check_type = kwargs.pop('_check_type', True)
+ _spec_property_naming = kwargs.pop('_spec_property_naming', False)
+ _configuration = kwargs.pop('_configuration', None)
+ _visited_composed_classes = kwargs.pop('_visited_composed_classes', ())
+
+ if args:
+ raise ApiTypeError(
+ "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % (
+ args,
+ self.__class__.__name__,
+ ),
+ path_to_item=_path_to_item,
+ valid_classes=(self.__class__,),
+ )
+
+ self._data_store = {}
+ self._check_type = _check_type
+ self._spec_property_naming = _spec_property_naming
+ self._path_to_item = _path_to_item
+ self._configuration = _configuration
+ self._visited_composed_classes = _visited_composed_classes + (self.__class__,)
+ self.value = value
+ if kwargs:
+ raise ApiTypeError(
+ "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % (
+ kwargs,
+ self.__class__.__name__,
+ ),
+ path_to_item=_path_to_item,
+ valid_classes=(self.__class__,),
+ )
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/tag.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/tag.py
new file mode 100644
index 000000000000..d3dcb78b7ea0
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/tag.py
@@ -0,0 +1,172 @@
+"""
+ 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: https://openapi-generator.tech
+"""
+
+
+import re # noqa: F401
+import sys # noqa: F401
+
+from petstore_api.model_utils import ( # noqa: F401
+ ApiTypeError,
+ ModelComposed,
+ ModelNormal,
+ ModelSimple,
+ cached_property,
+ change_keys_js_to_python,
+ convert_js_args_to_python_args,
+ date,
+ datetime,
+ file_type,
+ none_type,
+ validate_get_composed_info,
+)
+
+
+class Tag(ModelNormal):
+ """NOTE: This class is auto generated by OpenAPI Generator.
+ Ref: https://openapi-generator.tech
+
+ Do not edit the class manually.
+
+ Attributes:
+ allowed_values (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ with a capitalized key describing the allowed value and an allowed
+ value. These dicts store the allowed enum values.
+ attribute_map (dict): The key is attribute name
+ and the value is json key in definition.
+ discriminator_value_class_map (dict): A dict to go from the discriminator
+ variable value to the discriminator class name.
+ validations (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ that stores validations for max_length, min_length, max_items,
+ min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
+ inclusive_minimum, and regex.
+ additional_properties_type (tuple): A tuple of classes accepted
+ as additional properties values.
+ """
+
+ allowed_values = {
+ }
+
+ validations = {
+ }
+
+ additional_properties_type = None
+
+ _nullable = False
+
+ @cached_property
+ def openapi_types():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+
+ Returns
+ openapi_types (dict): The key is attribute name
+ and the value is attribute type.
+ """
+ return {
+ 'id': (int,), # noqa: E501
+ 'name': (str,), # noqa: E501
+ 'full_name': (str,), # noqa: E501
+ }
+
+ @cached_property
+ def discriminator():
+ return None
+
+
+ attribute_map = {
+ 'id': 'id', # noqa: E501
+ 'name': 'name', # noqa: E501
+ 'full_name': 'fullName', # noqa: E501
+ }
+
+ _composed_schemas = {}
+
+ required_properties = set([
+ '_data_store',
+ '_check_type',
+ '_spec_property_naming',
+ '_path_to_item',
+ '_configuration',
+ '_visited_composed_classes',
+ ])
+
+ @convert_js_args_to_python_args
+ def __init__(self, *args, **kwargs): # noqa: E501
+ """Tag - a model defined in OpenAPI
+
+ Keyword Args:
+ _check_type (bool): if True, values for parameters in openapi_types
+ will be type checked and a TypeError will be
+ raised if the wrong type is input.
+ Defaults to True
+ _path_to_item (tuple/list): This is a list of keys or values to
+ drill down to the model in received_data
+ when deserializing a response
+ _spec_property_naming (bool): True if the variable names in the input data
+ are serialized names, as specified in the OpenAPI document.
+ False if the variable names in the input data
+ are pythonic names, e.g. snake case (default)
+ _configuration (Configuration): the instance to use when
+ deserializing a file_type parameter.
+ If passed, type conversion is attempted
+ If omitted no type conversion is done.
+ _visited_composed_classes (tuple): This stores a tuple of
+ classes that we have traveled through so that
+ if we see that class again we will not use its
+ discriminator again.
+ When traveling through a discriminator, the
+ composed schema that is
+ is traveled through is added to this set.
+ For example if Animal has a discriminator
+ petType and we pass in "Dog", and the class Dog
+ allOf includes Animal, we move through Animal
+ once using the discriminator, and pick Dog.
+ Then in Dog, we will make an instance of the
+ Animal class but this time we won't travel
+ through its discriminator because we passed in
+ _visited_composed_classes = (Animal,)
+ id (int): [optional] # noqa: E501
+ name (str): [optional] # noqa: E501
+ full_name (str): [optional] # noqa: E501
+ """
+
+ _check_type = kwargs.pop('_check_type', True)
+ _spec_property_naming = kwargs.pop('_spec_property_naming', False)
+ _path_to_item = kwargs.pop('_path_to_item', ())
+ _configuration = kwargs.pop('_configuration', None)
+ _visited_composed_classes = kwargs.pop('_visited_composed_classes', ())
+
+ if args:
+ raise ApiTypeError(
+ "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % (
+ args,
+ self.__class__.__name__,
+ ),
+ path_to_item=_path_to_item,
+ valid_classes=(self.__class__,),
+ )
+
+ self._data_store = {}
+ self._check_type = _check_type
+ self._spec_property_naming = _spec_property_naming
+ self._path_to_item = _path_to_item
+ self._configuration = _configuration
+ self._visited_composed_classes = _visited_composed_classes + (self.__class__,)
+
+ for var_name, var_value in kwargs.items():
+ if var_name not in self.attribute_map and \
+ self._configuration is not None and \
+ self._configuration.discard_unknown_keys and \
+ self.additional_properties_type is None:
+ # discard variable.
+ continue
+ setattr(self, var_name, var_value)
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/type_holder_default.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/type_holder_default.py
new file mode 100644
index 000000000000..324b131f3a2d
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/type_holder_default.py
@@ -0,0 +1,195 @@
+"""
+ 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: https://openapi-generator.tech
+"""
+
+
+import re # noqa: F401
+import sys # noqa: F401
+
+from petstore_api.model_utils import ( # noqa: F401
+ ApiTypeError,
+ ModelComposed,
+ ModelNormal,
+ ModelSimple,
+ cached_property,
+ change_keys_js_to_python,
+ convert_js_args_to_python_args,
+ date,
+ datetime,
+ file_type,
+ none_type,
+ validate_get_composed_info,
+)
+
+
+class TypeHolderDefault(ModelNormal):
+ """NOTE: This class is auto generated by OpenAPI Generator.
+ Ref: https://openapi-generator.tech
+
+ Do not edit the class manually.
+
+ Attributes:
+ allowed_values (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ with a capitalized key describing the allowed value and an allowed
+ value. These dicts store the allowed enum values.
+ attribute_map (dict): The key is attribute name
+ and the value is json key in definition.
+ discriminator_value_class_map (dict): A dict to go from the discriminator
+ variable value to the discriminator class name.
+ validations (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ that stores validations for max_length, min_length, max_items,
+ min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
+ inclusive_minimum, and regex.
+ additional_properties_type (tuple): A tuple of classes accepted
+ as additional properties values.
+ """
+
+ allowed_values = {
+ }
+
+ validations = {
+ }
+
+ additional_properties_type = None
+
+ _nullable = False
+
+ @cached_property
+ def openapi_types():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+
+ Returns
+ openapi_types (dict): The key is attribute name
+ and the value is attribute type.
+ """
+ return {
+ 'string_item': (str,), # noqa: E501
+ 'number_item': (float,), # noqa: E501
+ 'integer_item': (int,), # noqa: E501
+ 'bool_item': (bool,), # noqa: E501
+ 'array_item': ([int],), # noqa: E501
+ 'date_item': (date,), # noqa: E501
+ 'datetime_item': (datetime,), # noqa: E501
+ }
+
+ @cached_property
+ def discriminator():
+ return None
+
+
+ attribute_map = {
+ 'string_item': 'string_item', # noqa: E501
+ 'number_item': 'number_item', # noqa: E501
+ 'integer_item': 'integer_item', # noqa: E501
+ 'bool_item': 'bool_item', # noqa: E501
+ 'array_item': 'array_item', # noqa: E501
+ 'date_item': 'date_item', # noqa: E501
+ 'datetime_item': 'datetime_item', # noqa: E501
+ }
+
+ _composed_schemas = {}
+
+ required_properties = set([
+ '_data_store',
+ '_check_type',
+ '_spec_property_naming',
+ '_path_to_item',
+ '_configuration',
+ '_visited_composed_classes',
+ ])
+
+ @convert_js_args_to_python_args
+ def __init__(self, array_item, *args, **kwargs): # noqa: E501
+ """TypeHolderDefault - a model defined in OpenAPI
+
+ Args:
+ array_item ([int]):
+
+ Keyword Args:
+ string_item (str): defaults to "what" # noqa: E501
+ number_item (float): defaults to 1.234 # noqa: E501
+ integer_item (int): defaults to -2 # noqa: E501
+ bool_item (bool): defaults to True # noqa: E501
+ _check_type (bool): if True, values for parameters in openapi_types
+ will be type checked and a TypeError will be
+ raised if the wrong type is input.
+ Defaults to True
+ _path_to_item (tuple/list): This is a list of keys or values to
+ drill down to the model in received_data
+ when deserializing a response
+ _spec_property_naming (bool): True if the variable names in the input data
+ are serialized names, as specified in the OpenAPI document.
+ False if the variable names in the input data
+ are pythonic names, e.g. snake case (default)
+ _configuration (Configuration): the instance to use when
+ deserializing a file_type parameter.
+ If passed, type conversion is attempted
+ If omitted no type conversion is done.
+ _visited_composed_classes (tuple): This stores a tuple of
+ classes that we have traveled through so that
+ if we see that class again we will not use its
+ discriminator again.
+ When traveling through a discriminator, the
+ composed schema that is
+ is traveled through is added to this set.
+ For example if Animal has a discriminator
+ petType and we pass in "Dog", and the class Dog
+ allOf includes Animal, we move through Animal
+ once using the discriminator, and pick Dog.
+ Then in Dog, we will make an instance of the
+ Animal class but this time we won't travel
+ through its discriminator because we passed in
+ _visited_composed_classes = (Animal,)
+ date_item (date): [optional] # noqa: E501
+ datetime_item (datetime): [optional] # noqa: E501
+ """
+
+ string_item = kwargs.get('string_item', "what")
+ number_item = kwargs.get('number_item', 1.234)
+ integer_item = kwargs.get('integer_item', -2)
+ bool_item = kwargs.get('bool_item', True)
+ _check_type = kwargs.pop('_check_type', True)
+ _spec_property_naming = kwargs.pop('_spec_property_naming', False)
+ _path_to_item = kwargs.pop('_path_to_item', ())
+ _configuration = kwargs.pop('_configuration', None)
+ _visited_composed_classes = kwargs.pop('_visited_composed_classes', ())
+
+ if args:
+ raise ApiTypeError(
+ "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % (
+ args,
+ self.__class__.__name__,
+ ),
+ path_to_item=_path_to_item,
+ valid_classes=(self.__class__,),
+ )
+
+ self._data_store = {}
+ self._check_type = _check_type
+ self._spec_property_naming = _spec_property_naming
+ self._path_to_item = _path_to_item
+ self._configuration = _configuration
+ self._visited_composed_classes = _visited_composed_classes + (self.__class__,)
+
+ self.string_item = string_item
+ self.number_item = number_item
+ self.integer_item = integer_item
+ self.bool_item = bool_item
+ self.array_item = array_item
+ for var_name, var_value in kwargs.items():
+ if var_name not in self.attribute_map and \
+ self._configuration is not None and \
+ self._configuration.discard_unknown_keys and \
+ self.additional_properties_type is None:
+ # discard variable.
+ continue
+ setattr(self, var_name, var_value)
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/type_holder_example.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/type_holder_example.py
new file mode 100644
index 000000000000..30bbba178f4f
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/type_holder_example.py
@@ -0,0 +1,197 @@
+"""
+ 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: https://openapi-generator.tech
+"""
+
+
+import re # noqa: F401
+import sys # noqa: F401
+
+from petstore_api.model_utils import ( # noqa: F401
+ ApiTypeError,
+ ModelComposed,
+ ModelNormal,
+ ModelSimple,
+ cached_property,
+ change_keys_js_to_python,
+ convert_js_args_to_python_args,
+ date,
+ datetime,
+ file_type,
+ none_type,
+ validate_get_composed_info,
+)
+
+
+class TypeHolderExample(ModelNormal):
+ """NOTE: This class is auto generated by OpenAPI Generator.
+ Ref: https://openapi-generator.tech
+
+ Do not edit the class manually.
+
+ Attributes:
+ allowed_values (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ with a capitalized key describing the allowed value and an allowed
+ value. These dicts store the allowed enum values.
+ attribute_map (dict): The key is attribute name
+ and the value is json key in definition.
+ discriminator_value_class_map (dict): A dict to go from the discriminator
+ variable value to the discriminator class name.
+ validations (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ that stores validations for max_length, min_length, max_items,
+ min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
+ inclusive_minimum, and regex.
+ additional_properties_type (tuple): A tuple of classes accepted
+ as additional properties values.
+ """
+
+ allowed_values = {
+ ('string_item',): {
+ 'WHAT': "what",
+ },
+ ('number_item',): {
+ '1.234': 1.234,
+ },
+ ('integer_item',): {
+ '-2': -2,
+ },
+ }
+
+ validations = {
+ }
+
+ additional_properties_type = None
+
+ _nullable = False
+
+ @cached_property
+ def openapi_types():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+
+ Returns
+ openapi_types (dict): The key is attribute name
+ and the value is attribute type.
+ """
+ return {
+ 'string_item': (str,), # noqa: E501
+ 'number_item': (float,), # noqa: E501
+ 'integer_item': (int,), # noqa: E501
+ 'bool_item': (bool,), # noqa: E501
+ 'array_item': ([int],), # noqa: E501
+ }
+
+ @cached_property
+ def discriminator():
+ return None
+
+
+ attribute_map = {
+ 'string_item': 'string_item', # noqa: E501
+ 'number_item': 'number_item', # noqa: E501
+ 'integer_item': 'integer_item', # noqa: E501
+ 'bool_item': 'bool_item', # noqa: E501
+ 'array_item': 'array_item', # noqa: E501
+ }
+
+ _composed_schemas = {}
+
+ required_properties = set([
+ '_data_store',
+ '_check_type',
+ '_spec_property_naming',
+ '_path_to_item',
+ '_configuration',
+ '_visited_composed_classes',
+ ])
+
+ @convert_js_args_to_python_args
+ def __init__(self, bool_item, array_item, *args, **kwargs): # noqa: E501
+ """TypeHolderExample - a model defined in OpenAPI
+
+ Args:
+ bool_item (bool):
+ array_item ([int]):
+
+ Keyword Args:
+ string_item (str): defaults to "what", must be one of ["what", ] # noqa: E501
+ number_item (float): defaults to 1.234, must be one of [1.234, ] # noqa: E501
+ integer_item (int): defaults to -2, must be one of [-2, ] # noqa: E501
+ _check_type (bool): if True, values for parameters in openapi_types
+ will be type checked and a TypeError will be
+ raised if the wrong type is input.
+ Defaults to True
+ _path_to_item (tuple/list): This is a list of keys or values to
+ drill down to the model in received_data
+ when deserializing a response
+ _spec_property_naming (bool): True if the variable names in the input data
+ are serialized names, as specified in the OpenAPI document.
+ False if the variable names in the input data
+ are pythonic names, e.g. snake case (default)
+ _configuration (Configuration): the instance to use when
+ deserializing a file_type parameter.
+ If passed, type conversion is attempted
+ If omitted no type conversion is done.
+ _visited_composed_classes (tuple): This stores a tuple of
+ classes that we have traveled through so that
+ if we see that class again we will not use its
+ discriminator again.
+ When traveling through a discriminator, the
+ composed schema that is
+ is traveled through is added to this set.
+ For example if Animal has a discriminator
+ petType and we pass in "Dog", and the class Dog
+ allOf includes Animal, we move through Animal
+ once using the discriminator, and pick Dog.
+ Then in Dog, we will make an instance of the
+ Animal class but this time we won't travel
+ through its discriminator because we passed in
+ _visited_composed_classes = (Animal,)
+ """
+
+ string_item = kwargs.get('string_item', "what")
+ number_item = kwargs.get('number_item', 1.234)
+ integer_item = kwargs.get('integer_item', -2)
+ _check_type = kwargs.pop('_check_type', True)
+ _spec_property_naming = kwargs.pop('_spec_property_naming', False)
+ _path_to_item = kwargs.pop('_path_to_item', ())
+ _configuration = kwargs.pop('_configuration', None)
+ _visited_composed_classes = kwargs.pop('_visited_composed_classes', ())
+
+ if args:
+ raise ApiTypeError(
+ "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % (
+ args,
+ self.__class__.__name__,
+ ),
+ path_to_item=_path_to_item,
+ valid_classes=(self.__class__,),
+ )
+
+ self._data_store = {}
+ self._check_type = _check_type
+ self._spec_property_naming = _spec_property_naming
+ self._path_to_item = _path_to_item
+ self._configuration = _configuration
+ self._visited_composed_classes = _visited_composed_classes + (self.__class__,)
+
+ self.string_item = string_item
+ self.number_item = number_item
+ self.integer_item = integer_item
+ self.bool_item = bool_item
+ self.array_item = array_item
+ for var_name, var_value in kwargs.items():
+ if var_name not in self.attribute_map and \
+ self._configuration is not None and \
+ self._configuration.discard_unknown_keys and \
+ self.additional_properties_type is None:
+ # discard variable.
+ continue
+ setattr(self, var_name, var_value)
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/user.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/user.py
new file mode 100644
index 000000000000..9a3cd0814114
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/user.py
@@ -0,0 +1,187 @@
+"""
+ 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: https://openapi-generator.tech
+"""
+
+
+import re # noqa: F401
+import sys # noqa: F401
+
+from petstore_api.model_utils import ( # noqa: F401
+ ApiTypeError,
+ ModelComposed,
+ ModelNormal,
+ ModelSimple,
+ cached_property,
+ change_keys_js_to_python,
+ convert_js_args_to_python_args,
+ date,
+ datetime,
+ file_type,
+ none_type,
+ validate_get_composed_info,
+)
+
+
+class User(ModelNormal):
+ """NOTE: This class is auto generated by OpenAPI Generator.
+ Ref: https://openapi-generator.tech
+
+ Do not edit the class manually.
+
+ Attributes:
+ allowed_values (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ with a capitalized key describing the allowed value and an allowed
+ value. These dicts store the allowed enum values.
+ attribute_map (dict): The key is attribute name
+ and the value is json key in definition.
+ discriminator_value_class_map (dict): A dict to go from the discriminator
+ variable value to the discriminator class name.
+ validations (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ that stores validations for max_length, min_length, max_items,
+ min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
+ inclusive_minimum, and regex.
+ additional_properties_type (tuple): A tuple of classes accepted
+ as additional properties values.
+ """
+
+ allowed_values = {
+ }
+
+ validations = {
+ }
+
+ additional_properties_type = None
+
+ _nullable = False
+
+ @cached_property
+ def openapi_types():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+
+ Returns
+ openapi_types (dict): The key is attribute name
+ and the value is attribute type.
+ """
+ return {
+ 'id': (int,), # noqa: E501
+ 'username': (str,), # noqa: E501
+ 'first_name': (str,), # noqa: E501
+ 'last_name': (str,), # noqa: E501
+ 'email': (str,), # noqa: E501
+ 'password': (str,), # noqa: E501
+ 'phone': (str,), # noqa: E501
+ 'user_status': (int,), # noqa: E501
+ }
+
+ @cached_property
+ def discriminator():
+ return None
+
+
+ attribute_map = {
+ 'id': 'id', # noqa: E501
+ 'username': 'username', # noqa: E501
+ 'first_name': 'firstName', # noqa: E501
+ 'last_name': 'lastName', # noqa: E501
+ 'email': 'email', # noqa: E501
+ 'password': 'password', # noqa: E501
+ 'phone': 'phone', # noqa: E501
+ 'user_status': 'userStatus', # noqa: E501
+ }
+
+ _composed_schemas = {}
+
+ required_properties = set([
+ '_data_store',
+ '_check_type',
+ '_spec_property_naming',
+ '_path_to_item',
+ '_configuration',
+ '_visited_composed_classes',
+ ])
+
+ @convert_js_args_to_python_args
+ def __init__(self, *args, **kwargs): # noqa: E501
+ """User - a model defined in OpenAPI
+
+ Keyword Args:
+ _check_type (bool): if True, values for parameters in openapi_types
+ will be type checked and a TypeError will be
+ raised if the wrong type is input.
+ Defaults to True
+ _path_to_item (tuple/list): This is a list of keys or values to
+ drill down to the model in received_data
+ when deserializing a response
+ _spec_property_naming (bool): True if the variable names in the input data
+ are serialized names, as specified in the OpenAPI document.
+ False if the variable names in the input data
+ are pythonic names, e.g. snake case (default)
+ _configuration (Configuration): the instance to use when
+ deserializing a file_type parameter.
+ If passed, type conversion is attempted
+ If omitted no type conversion is done.
+ _visited_composed_classes (tuple): This stores a tuple of
+ classes that we have traveled through so that
+ if we see that class again we will not use its
+ discriminator again.
+ When traveling through a discriminator, the
+ composed schema that is
+ is traveled through is added to this set.
+ For example if Animal has a discriminator
+ petType and we pass in "Dog", and the class Dog
+ allOf includes Animal, we move through Animal
+ once using the discriminator, and pick Dog.
+ Then in Dog, we will make an instance of the
+ Animal class but this time we won't travel
+ through its discriminator because we passed in
+ _visited_composed_classes = (Animal,)
+ id (int): [optional] # noqa: E501
+ username (str): [optional] # noqa: E501
+ first_name (str): [optional] # noqa: E501
+ last_name (str): [optional] # noqa: E501
+ email (str): [optional] # noqa: E501
+ password (str): [optional] # noqa: E501
+ phone (str): [optional] # noqa: E501
+ user_status (int): User Status. [optional] # noqa: E501
+ """
+
+ _check_type = kwargs.pop('_check_type', True)
+ _spec_property_naming = kwargs.pop('_spec_property_naming', False)
+ _path_to_item = kwargs.pop('_path_to_item', ())
+ _configuration = kwargs.pop('_configuration', None)
+ _visited_composed_classes = kwargs.pop('_visited_composed_classes', ())
+
+ if args:
+ raise ApiTypeError(
+ "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % (
+ args,
+ self.__class__.__name__,
+ ),
+ path_to_item=_path_to_item,
+ valid_classes=(self.__class__,),
+ )
+
+ self._data_store = {}
+ self._check_type = _check_type
+ self._spec_property_naming = _spec_property_naming
+ self._path_to_item = _path_to_item
+ self._configuration = _configuration
+ self._visited_composed_classes = _visited_composed_classes + (self.__class__,)
+
+ for var_name, var_value in kwargs.items():
+ if var_name not in self.attribute_map and \
+ self._configuration is not None and \
+ self._configuration.discard_unknown_keys and \
+ self.additional_properties_type is None:
+ # discard variable.
+ continue
+ setattr(self, var_name, var_value)
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/xml_item.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/xml_item.py
new file mode 100644
index 000000000000..8401b3f40076
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/xml_item.py
@@ -0,0 +1,250 @@
+"""
+ 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: https://openapi-generator.tech
+"""
+
+
+import re # noqa: F401
+import sys # noqa: F401
+
+from petstore_api.model_utils import ( # noqa: F401
+ ApiTypeError,
+ ModelComposed,
+ ModelNormal,
+ ModelSimple,
+ cached_property,
+ change_keys_js_to_python,
+ convert_js_args_to_python_args,
+ date,
+ datetime,
+ file_type,
+ none_type,
+ validate_get_composed_info,
+)
+
+
+class XmlItem(ModelNormal):
+ """NOTE: This class is auto generated by OpenAPI Generator.
+ Ref: https://openapi-generator.tech
+
+ Do not edit the class manually.
+
+ Attributes:
+ allowed_values (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ with a capitalized key describing the allowed value and an allowed
+ value. These dicts store the allowed enum values.
+ attribute_map (dict): The key is attribute name
+ and the value is json key in definition.
+ discriminator_value_class_map (dict): A dict to go from the discriminator
+ variable value to the discriminator class name.
+ validations (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ that stores validations for max_length, min_length, max_items,
+ min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
+ inclusive_minimum, and regex.
+ additional_properties_type (tuple): A tuple of classes accepted
+ as additional properties values.
+ """
+
+ allowed_values = {
+ }
+
+ validations = {
+ }
+
+ additional_properties_type = None
+
+ _nullable = False
+
+ @cached_property
+ def openapi_types():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+
+ Returns
+ openapi_types (dict): The key is attribute name
+ and the value is attribute type.
+ """
+ return {
+ 'attribute_string': (str,), # noqa: E501
+ 'attribute_number': (float,), # noqa: E501
+ 'attribute_integer': (int,), # noqa: E501
+ 'attribute_boolean': (bool,), # noqa: E501
+ 'wrapped_array': ([int],), # noqa: E501
+ 'name_string': (str,), # noqa: E501
+ 'name_number': (float,), # noqa: E501
+ 'name_integer': (int,), # noqa: E501
+ 'name_boolean': (bool,), # noqa: E501
+ 'name_array': ([int],), # noqa: E501
+ 'name_wrapped_array': ([int],), # noqa: E501
+ 'prefix_string': (str,), # noqa: E501
+ 'prefix_number': (float,), # noqa: E501
+ 'prefix_integer': (int,), # noqa: E501
+ 'prefix_boolean': (bool,), # noqa: E501
+ 'prefix_array': ([int],), # noqa: E501
+ 'prefix_wrapped_array': ([int],), # noqa: E501
+ 'namespace_string': (str,), # noqa: E501
+ 'namespace_number': (float,), # noqa: E501
+ 'namespace_integer': (int,), # noqa: E501
+ 'namespace_boolean': (bool,), # noqa: E501
+ 'namespace_array': ([int],), # noqa: E501
+ 'namespace_wrapped_array': ([int],), # noqa: E501
+ 'prefix_ns_string': (str,), # noqa: E501
+ 'prefix_ns_number': (float,), # noqa: E501
+ 'prefix_ns_integer': (int,), # noqa: E501
+ 'prefix_ns_boolean': (bool,), # noqa: E501
+ 'prefix_ns_array': ([int],), # noqa: E501
+ 'prefix_ns_wrapped_array': ([int],), # noqa: E501
+ }
+
+ @cached_property
+ def discriminator():
+ return None
+
+
+ attribute_map = {
+ 'attribute_string': 'attribute_string', # noqa: E501
+ 'attribute_number': 'attribute_number', # noqa: E501
+ 'attribute_integer': 'attribute_integer', # noqa: E501
+ 'attribute_boolean': 'attribute_boolean', # noqa: E501
+ 'wrapped_array': 'wrapped_array', # noqa: E501
+ 'name_string': 'name_string', # noqa: E501
+ 'name_number': 'name_number', # noqa: E501
+ 'name_integer': 'name_integer', # noqa: E501
+ 'name_boolean': 'name_boolean', # noqa: E501
+ 'name_array': 'name_array', # noqa: E501
+ 'name_wrapped_array': 'name_wrapped_array', # noqa: E501
+ 'prefix_string': 'prefix_string', # noqa: E501
+ 'prefix_number': 'prefix_number', # noqa: E501
+ 'prefix_integer': 'prefix_integer', # noqa: E501
+ 'prefix_boolean': 'prefix_boolean', # noqa: E501
+ 'prefix_array': 'prefix_array', # noqa: E501
+ 'prefix_wrapped_array': 'prefix_wrapped_array', # noqa: E501
+ 'namespace_string': 'namespace_string', # noqa: E501
+ 'namespace_number': 'namespace_number', # noqa: E501
+ 'namespace_integer': 'namespace_integer', # noqa: E501
+ 'namespace_boolean': 'namespace_boolean', # noqa: E501
+ 'namespace_array': 'namespace_array', # noqa: E501
+ 'namespace_wrapped_array': 'namespace_wrapped_array', # noqa: E501
+ 'prefix_ns_string': 'prefix_ns_string', # noqa: E501
+ 'prefix_ns_number': 'prefix_ns_number', # noqa: E501
+ 'prefix_ns_integer': 'prefix_ns_integer', # noqa: E501
+ 'prefix_ns_boolean': 'prefix_ns_boolean', # noqa: E501
+ 'prefix_ns_array': 'prefix_ns_array', # noqa: E501
+ 'prefix_ns_wrapped_array': 'prefix_ns_wrapped_array', # noqa: E501
+ }
+
+ _composed_schemas = {}
+
+ required_properties = set([
+ '_data_store',
+ '_check_type',
+ '_spec_property_naming',
+ '_path_to_item',
+ '_configuration',
+ '_visited_composed_classes',
+ ])
+
+ @convert_js_args_to_python_args
+ def __init__(self, *args, **kwargs): # noqa: E501
+ """XmlItem - a model defined in OpenAPI
+
+ Keyword Args:
+ _check_type (bool): if True, values for parameters in openapi_types
+ will be type checked and a TypeError will be
+ raised if the wrong type is input.
+ Defaults to True
+ _path_to_item (tuple/list): This is a list of keys or values to
+ drill down to the model in received_data
+ when deserializing a response
+ _spec_property_naming (bool): True if the variable names in the input data
+ are serialized names, as specified in the OpenAPI document.
+ False if the variable names in the input data
+ are pythonic names, e.g. snake case (default)
+ _configuration (Configuration): the instance to use when
+ deserializing a file_type parameter.
+ If passed, type conversion is attempted
+ If omitted no type conversion is done.
+ _visited_composed_classes (tuple): This stores a tuple of
+ classes that we have traveled through so that
+ if we see that class again we will not use its
+ discriminator again.
+ When traveling through a discriminator, the
+ composed schema that is
+ is traveled through is added to this set.
+ For example if Animal has a discriminator
+ petType and we pass in "Dog", and the class Dog
+ allOf includes Animal, we move through Animal
+ once using the discriminator, and pick Dog.
+ Then in Dog, we will make an instance of the
+ Animal class but this time we won't travel
+ through its discriminator because we passed in
+ _visited_composed_classes = (Animal,)
+ attribute_string (str): [optional] # noqa: E501
+ attribute_number (float): [optional] # noqa: E501
+ attribute_integer (int): [optional] # noqa: E501
+ attribute_boolean (bool): [optional] # noqa: E501
+ wrapped_array ([int]): [optional] # noqa: E501
+ name_string (str): [optional] # noqa: E501
+ name_number (float): [optional] # noqa: E501
+ name_integer (int): [optional] # noqa: E501
+ name_boolean (bool): [optional] # noqa: E501
+ name_array ([int]): [optional] # noqa: E501
+ name_wrapped_array ([int]): [optional] # noqa: E501
+ prefix_string (str): [optional] # noqa: E501
+ prefix_number (float): [optional] # noqa: E501
+ prefix_integer (int): [optional] # noqa: E501
+ prefix_boolean (bool): [optional] # noqa: E501
+ prefix_array ([int]): [optional] # noqa: E501
+ prefix_wrapped_array ([int]): [optional] # noqa: E501
+ namespace_string (str): [optional] # noqa: E501
+ namespace_number (float): [optional] # noqa: E501
+ namespace_integer (int): [optional] # noqa: E501
+ namespace_boolean (bool): [optional] # noqa: E501
+ namespace_array ([int]): [optional] # noqa: E501
+ namespace_wrapped_array ([int]): [optional] # noqa: E501
+ prefix_ns_string (str): [optional] # noqa: E501
+ prefix_ns_number (float): [optional] # noqa: E501
+ prefix_ns_integer (int): [optional] # noqa: E501
+ prefix_ns_boolean (bool): [optional] # noqa: E501
+ prefix_ns_array ([int]): [optional] # noqa: E501
+ prefix_ns_wrapped_array ([int]): [optional] # noqa: E501
+ """
+
+ _check_type = kwargs.pop('_check_type', True)
+ _spec_property_naming = kwargs.pop('_spec_property_naming', False)
+ _path_to_item = kwargs.pop('_path_to_item', ())
+ _configuration = kwargs.pop('_configuration', None)
+ _visited_composed_classes = kwargs.pop('_visited_composed_classes', ())
+
+ if args:
+ raise ApiTypeError(
+ "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % (
+ args,
+ self.__class__.__name__,
+ ),
+ path_to_item=_path_to_item,
+ valid_classes=(self.__class__,),
+ )
+
+ self._data_store = {}
+ self._check_type = _check_type
+ self._spec_property_naming = _spec_property_naming
+ self._path_to_item = _path_to_item
+ self._configuration = _configuration
+ self._visited_composed_classes = _visited_composed_classes + (self.__class__,)
+
+ for var_name, var_value in kwargs.items():
+ if var_name not in self.attribute_map and \
+ self._configuration is not None and \
+ self._configuration.discard_unknown_keys and \
+ self.additional_properties_type is None:
+ # discard variable.
+ continue
+ setattr(self, var_name, var_value)
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model_utils.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model_utils.py
new file mode 100644
index 000000000000..b6d5934170a3
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model_utils.py
@@ -0,0 +1,1848 @@
+"""
+ 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: https://openapi-generator.tech
+"""
+
+
+from datetime import date, datetime # noqa: F401
+import inspect
+import io
+import os
+import pprint
+import re
+import tempfile
+
+from dateutil.parser import parse
+
+from petstore_api.exceptions import (
+ ApiKeyError,
+ ApiAttributeError,
+ ApiTypeError,
+ ApiValueError,
+)
+
+none_type = type(None)
+file_type = io.IOBase
+
+
+class cached_property(object):
+ # this caches the result of the function call for fn with no inputs
+ # use this as a decorator on fuction methods that you want converted
+ # into cached properties
+ result_key = '_results'
+
+ def __init__(self, fn):
+ self._fn = fn
+
+ def __get__(self, instance, cls=None):
+ if self.result_key in vars(self):
+ return vars(self)[self.result_key]
+ else:
+ result = self._fn()
+ setattr(self, self.result_key, result)
+ return result
+
+
+PRIMITIVE_TYPES = (list, float, int, bool, datetime, date, str, file_type)
+
+def allows_single_value_input(cls):
+ """
+ This function returns True if the input composed schema model or any
+ descendant model allows a value only input
+ This is true for cases where oneOf contains items like:
+ oneOf:
+ - float
+ - NumberWithValidation
+ - StringEnum
+ - ArrayModel
+ - null
+ TODO: lru_cache this
+ """
+ if (
+ issubclass(cls, ModelSimple) or
+ cls in PRIMITIVE_TYPES
+ ):
+ return True
+ elif issubclass(cls, ModelComposed):
+ if not cls._composed_schemas['oneOf']:
+ return False
+ return any(allows_single_value_input(c) for c in cls._composed_schemas['oneOf'])
+ return False
+
+def composed_model_input_classes(cls):
+ """
+ This function returns a list of the possible models that can be accepted as
+ inputs.
+ TODO: lru_cache this
+ """
+ if issubclass(cls, ModelSimple) or cls in PRIMITIVE_TYPES:
+ return [cls]
+ elif issubclass(cls, ModelNormal):
+ if cls.discriminator is None:
+ return [cls]
+ else:
+ return get_discriminated_classes(cls)
+ elif issubclass(cls, ModelComposed):
+ if not cls._composed_schemas['oneOf']:
+ return []
+ if cls.discriminator is None:
+ input_classes = []
+ for c in cls._composed_schemas['oneOf']:
+ input_classes.extend(composed_model_input_classes(c))
+ return input_classes
+ else:
+ return get_discriminated_classes(cls)
+ return []
+
+
+class OpenApiModel(object):
+ """The base class for all OpenAPIModels"""
+
+ def set_attribute(self, name, value):
+ # this is only used to set properties on self
+
+ path_to_item = []
+ if self._path_to_item:
+ path_to_item.extend(self._path_to_item)
+ path_to_item.append(name)
+
+ if name in self.openapi_types:
+ required_types_mixed = self.openapi_types[name]
+ elif self.additional_properties_type is None:
+ raise ApiAttributeError(
+ "{0} has no attribute '{1}'".format(
+ type(self).__name__, name),
+ path_to_item
+ )
+ elif self.additional_properties_type is not None:
+ required_types_mixed = self.additional_properties_type
+
+ if get_simple_class(name) != str:
+ error_msg = type_error_message(
+ var_name=name,
+ var_value=name,
+ valid_classes=(str,),
+ key_type=True
+ )
+ raise ApiTypeError(
+ error_msg,
+ path_to_item=path_to_item,
+ valid_classes=(str,),
+ key_type=True
+ )
+
+ if self._check_type:
+ value = validate_and_convert_types(
+ value, required_types_mixed, path_to_item, self._spec_property_naming,
+ self._check_type, configuration=self._configuration)
+ if (name,) in self.allowed_values:
+ check_allowed_values(
+ self.allowed_values,
+ (name,),
+ value
+ )
+ if (name,) in self.validations:
+ check_validations(
+ self.validations,
+ (name,),
+ value,
+ self._configuration
+ )
+ self.__dict__['_data_store'][name] = value
+
+ def __repr__(self):
+ """For `print` and `pprint`"""
+ return self.to_str()
+
+ def __ne__(self, other):
+ """Returns true if both objects are not equal"""
+ return not self == other
+
+ def __setattr__(self, attr, value):
+ """set the value of an attribute using dot notation: `instance.attr = val`"""
+ self[attr] = value
+
+ def __getattr__(self, attr):
+ """get the value of an attribute using dot notation: `instance.attr`"""
+ return self.__getitem__(attr)
+
+ def __new__(cls, *args, **kwargs):
+ # this function uses the discriminator to
+ # pick a new schema/class to instantiate because a discriminator
+ # propertyName value was passed in
+
+ if len(args) == 1:
+ arg = args[0]
+ if arg is None and is_type_nullable(cls):
+ # The input data is the 'null' value and the type is nullable.
+ return None
+
+ if issubclass(cls, ModelComposed) and allows_single_value_input(cls):
+ model_kwargs = {}
+ oneof_instance = get_oneof_instance(cls, model_kwargs, kwargs, model_arg=arg)
+ return oneof_instance
+
+
+ visited_composed_classes = kwargs.get('_visited_composed_classes', ())
+ if (
+ cls.discriminator is None or
+ cls in visited_composed_classes
+ ):
+ # Use case 1: this openapi schema (cls) does not have a discriminator
+ # Use case 2: we have already visited this class before and are sure that we
+ # want to instantiate it this time. We have visited this class deserializing
+ # a payload with a discriminator. During that process we traveled through
+ # this class but did not make an instance of it. Now we are making an
+ # instance of a composed class which contains cls in it, so this time make an instance of cls.
+ #
+ # Here's an example of use case 2: If Animal has a discriminator
+ # petType and we pass in "Dog", and the class Dog
+ # allOf includes Animal, we move through Animal
+ # once using the discriminator, and pick Dog.
+ # Then in the composed schema dog Dog, we will make an instance of the
+ # Animal class (because Dal has allOf: Animal) but this time we won't travel
+ # through Animal's discriminator because we passed in
+ # _visited_composed_classes = (Animal,)
+
+ return super(OpenApiModel, cls).__new__(cls)
+
+ # Get the name and value of the discriminator property.
+ # The discriminator name is obtained from the discriminator meta-data
+ # and the discriminator value is obtained from the input data.
+ discr_propertyname_py = list(cls.discriminator.keys())[0]
+ discr_propertyname_js = cls.attribute_map[discr_propertyname_py]
+ if discr_propertyname_js in kwargs:
+ discr_value = kwargs[discr_propertyname_js]
+ elif discr_propertyname_py in kwargs:
+ discr_value = kwargs[discr_propertyname_py]
+ else:
+ # The input data does not contain the discriminator property.
+ path_to_item = kwargs.get('_path_to_item', ())
+ raise ApiValueError(
+ "Cannot deserialize input data due to missing discriminator. "
+ "The discriminator property '%s' is missing at path: %s" %
+ (discr_propertyname_js, path_to_item)
+ )
+
+ # Implementation note: the last argument to get_discriminator_class
+ # is a list of visited classes. get_discriminator_class may recursively
+ # call itself and update the list of visited classes, and the initial
+ # value must be an empty list. Hence not using 'visited_composed_classes'
+ new_cls = get_discriminator_class(
+ cls, discr_propertyname_py, discr_value, [])
+ if new_cls is None:
+ path_to_item = kwargs.get('_path_to_item', ())
+ disc_prop_value = kwargs.get(
+ discr_propertyname_js, kwargs.get(discr_propertyname_py))
+ raise ApiValueError(
+ "Cannot deserialize input data due to invalid discriminator "
+ "value. The OpenAPI document has no mapping for discriminator "
+ "property '%s'='%s' at path: %s" %
+ (discr_propertyname_js, disc_prop_value, path_to_item)
+ )
+
+ if new_cls in visited_composed_classes:
+ # if we are making an instance of a composed schema Descendent
+ # which allOf includes Ancestor, then Ancestor contains
+ # a discriminator that includes Descendent.
+ # So if we make an instance of Descendent, we have to make an
+ # instance of Ancestor to hold the allOf properties.
+ # This code detects that use case and makes the instance of Ancestor
+ # For example:
+ # When making an instance of Dog, _visited_composed_classes = (Dog,)
+ # then we make an instance of Animal to include in dog._composed_instances
+ # so when we are here, cls is Animal
+ # cls.discriminator != None
+ # cls not in _visited_composed_classes
+ # new_cls = Dog
+ # but we know we know that we already have Dog
+ # because it is in visited_composed_classes
+ # so make Animal here
+ return super(OpenApiModel, cls).__new__(cls)
+
+ # Build a list containing all oneOf and anyOf descendants.
+ oneof_anyof_classes = None
+ if cls._composed_schemas is not None:
+ oneof_anyof_classes = (
+ cls._composed_schemas.get('oneOf', ()) +
+ cls._composed_schemas.get('anyOf', ()))
+ oneof_anyof_child = new_cls in oneof_anyof_classes
+ kwargs['_visited_composed_classes'] = visited_composed_classes + (cls,)
+
+ if cls._composed_schemas.get('allOf') and oneof_anyof_child:
+ # Validate that we can make self because when we make the
+ # new_cls it will not include the allOf validations in self
+ self_inst = super(OpenApiModel, cls).__new__(cls)
+ self_inst.__init__(*args, **kwargs)
+
+ new_inst = new_cls.__new__(new_cls, *args, **kwargs)
+ new_inst.__init__(*args, **kwargs)
+ return new_inst
+
+
+class ModelSimple(OpenApiModel):
+ """the parent class of models whose type != object in their
+ swagger/openapi"""
+
+ def __setitem__(self, name, value):
+ """set the value of an attribute using square-bracket notation: `instance[attr] = val`"""
+ if name in self.required_properties:
+ self.__dict__[name] = value
+ return
+
+ self.set_attribute(name, value)
+
+ def get(self, name, default=None):
+ """returns the value of an attribute or some default value if the attribute was not set"""
+ if name in self.required_properties:
+ return self.__dict__[name]
+
+ return self.__dict__['_data_store'].get(name, default)
+
+ def __getitem__(self, name):
+ """get the value of an attribute using square-bracket notation: `instance[attr]`"""
+ if name in self:
+ return self.get(name)
+
+ raise ApiAttributeError(
+ "{0} has no attribute '{1}'".format(
+ type(self).__name__, name),
+ [e for e in [self._path_to_item, name] if e]
+ )
+
+ def __contains__(self, name):
+ """used by `in` operator to check if an attrbute value was set in an instance: `'attr' in instance`"""
+ if name in self.required_properties:
+ return name in self.__dict__
+
+ return name in self.__dict__['_data_store']
+
+ def to_str(self):
+ """Returns the string representation of the model"""
+ return str(self.value)
+
+ def __eq__(self, other):
+ """Returns true if both objects are equal"""
+ if not isinstance(other, self.__class__):
+ return False
+
+ this_val = self._data_store['value']
+ that_val = other._data_store['value']
+ types = set()
+ types.add(this_val.__class__)
+ types.add(that_val.__class__)
+ vals_equal = this_val == that_val
+ return vals_equal
+
+
+class ModelNormal(OpenApiModel):
+ """the parent class of models whose type == object in their
+ swagger/openapi"""
+
+ def __setitem__(self, name, value):
+ """set the value of an attribute using square-bracket notation: `instance[attr] = val`"""
+ if name in self.required_properties:
+ self.__dict__[name] = value
+ return
+
+ self.set_attribute(name, value)
+
+ def get(self, name, default=None):
+ """returns the value of an attribute or some default value if the attribute was not set"""
+ if name in self.required_properties:
+ return self.__dict__[name]
+
+ return self.__dict__['_data_store'].get(name, default)
+
+ def __getitem__(self, name):
+ """get the value of an attribute using square-bracket notation: `instance[attr]`"""
+ if name in self:
+ return self.get(name)
+
+ raise ApiAttributeError(
+ "{0} has no attribute '{1}'".format(
+ type(self).__name__, name),
+ [e for e in [self._path_to_item, name] if e]
+ )
+
+ def __contains__(self, name):
+ """used by `in` operator to check if an attrbute value was set in an instance: `'attr' in instance`"""
+ if name in self.required_properties:
+ return name in self.__dict__
+
+ return name in self.__dict__['_data_store']
+
+ def to_dict(self):
+ """Returns the model properties as a dict"""
+ return model_to_dict(self, serialize=False)
+
+ def to_str(self):
+ """Returns the string representation of the model"""
+ return pprint.pformat(self.to_dict())
+
+ def __eq__(self, other):
+ """Returns true if both objects are equal"""
+ if not isinstance(other, self.__class__):
+ return False
+
+ if not set(self._data_store.keys()) == set(other._data_store.keys()):
+ return False
+ for _var_name, this_val in self._data_store.items():
+ that_val = other._data_store[_var_name]
+ types = set()
+ types.add(this_val.__class__)
+ types.add(that_val.__class__)
+ vals_equal = this_val == that_val
+ if not vals_equal:
+ return False
+ return True
+
+
+class ModelComposed(OpenApiModel):
+ """the parent class of models whose type == object in their
+ swagger/openapi and have oneOf/allOf/anyOf
+
+ When one sets a property we use var_name_to_model_instances to store the value in
+ the correct class instances + run any type checking + validation code.
+ When one gets a property we use var_name_to_model_instances to get the value
+ from the correct class instances.
+ This allows multiple composed schemas to contain the same property with additive
+ constraints on the value.
+
+ _composed_schemas (dict) stores the anyOf/allOf/oneOf classes
+ key (str): allOf/oneOf/anyOf
+ value (list): the classes in the XOf definition.
+ Note: none_type can be included when the openapi document version >= 3.1.0
+ _composed_instances (list): stores a list of instances of the composed schemas
+ defined in _composed_schemas. When properties are accessed in the self instance,
+ they are returned from the self._data_store or the data stores in the instances
+ in self._composed_schemas
+ _var_name_to_model_instances (dict): maps between a variable name on self and
+ the composed instances (self included) which contain that data
+ key (str): property name
+ value (list): list of class instances, self or instances in _composed_instances
+ which contain the value that the key is referring to.
+ """
+
+ def __setitem__(self, name, value):
+ """set the value of an attribute using square-bracket notation: `instance[attr] = val`"""
+ if name in self.required_properties:
+ self.__dict__[name] = value
+ return
+
+ """
+ Use cases:
+ 1. additional_properties_type is None (additionalProperties == False in spec)
+ Check for property presence in self.openapi_types
+ if not present then throw an error
+ if present set in self, set attribute
+ always set on composed schemas
+ 2. additional_properties_type exists
+ set attribute on self
+ always set on composed schemas
+ """
+ if self.additional_properties_type is None:
+ """
+ For an attribute to exist on a composed schema it must:
+ - fulfill schema_requirements in the self composed schema not considering oneOf/anyOf/allOf schemas AND
+ - fulfill schema_requirements in each oneOf/anyOf/allOf schemas
+
+ schema_requirements:
+ For an attribute to exist on a schema it must:
+ - be present in properties at the schema OR
+ - have additionalProperties unset (defaults additionalProperties = any type) OR
+ - have additionalProperties set
+ """
+ if name not in self.openapi_types:
+ raise ApiAttributeError(
+ "{0} has no attribute '{1}'".format(
+ type(self).__name__, name),
+ [e for e in [self._path_to_item, name] if e]
+ )
+ # attribute must be set on self and composed instances
+ self.set_attribute(name, value)
+ for model_instance in self._composed_instances:
+ setattr(model_instance, name, value)
+ if name not in self._var_name_to_model_instances:
+ # we assigned an additional property
+ self.__dict__['_var_name_to_model_instances'][name] = self._composed_instances + [self]
+ return None
+
+ __unset_attribute_value__ = object()
+
+ def get(self, name, default=None):
+ """returns the value of an attribute or some default value if the attribute was not set"""
+ if name in self.required_properties:
+ return self.__dict__[name]
+
+ # get the attribute from the correct instance
+ model_instances = self._var_name_to_model_instances.get(name)
+ values = []
+ # A composed model stores self and child (oneof/anyOf/allOf) models under
+ # self._var_name_to_model_instances.
+ # Any property must exist in self and all model instances
+ # The value stored in all model instances must be the same
+ if model_instances:
+ for model_instance in model_instances:
+ if name in model_instance._data_store:
+ v = model_instance._data_store[name]
+ if v not in values:
+ values.append(v)
+ len_values = len(values)
+ if len_values == 0:
+ return default
+ elif len_values == 1:
+ return values[0]
+ elif len_values > 1:
+ raise ApiValueError(
+ "Values stored for property {0} in {1} differ when looking "
+ "at self and self's composed instances. All values must be "
+ "the same".format(name, type(self).__name__),
+ [e for e in [self._path_to_item, name] if e]
+ )
+
+ def __getitem__(self, name):
+ """get the value of an attribute using square-bracket notation: `instance[attr]`"""
+ value = self.get(name, self.__unset_attribute_value__)
+ if value is self.__unset_attribute_value__:
+ raise ApiAttributeError(
+ "{0} has no attribute '{1}'".format(
+ type(self).__name__, name),
+ [e for e in [self._path_to_item, name] if e]
+ )
+ return value
+
+ def __contains__(self, name):
+ """used by `in` operator to check if an attrbute value was set in an instance: `'attr' in instance`"""
+
+ if name in self.required_properties:
+ return name in self.__dict__
+
+ model_instances = self._var_name_to_model_instances.get(
+ name, self._additional_properties_model_instances)
+
+ if model_instances:
+ for model_instance in model_instances:
+ if name in model_instance._data_store:
+ return True
+
+ return False
+
+ def to_dict(self):
+ """Returns the model properties as a dict"""
+ return model_to_dict(self, serialize=False)
+
+ def to_str(self):
+ """Returns the string representation of the model"""
+ return pprint.pformat(self.to_dict())
+
+ def __eq__(self, other):
+ """Returns true if both objects are equal"""
+ if not isinstance(other, self.__class__):
+ return False
+
+ if not set(self._data_store.keys()) == set(other._data_store.keys()):
+ return False
+ for _var_name, this_val in self._data_store.items():
+ that_val = other._data_store[_var_name]
+ types = set()
+ types.add(this_val.__class__)
+ types.add(that_val.__class__)
+ vals_equal = this_val == that_val
+ if not vals_equal:
+ return False
+ return True
+
+
+COERCION_INDEX_BY_TYPE = {
+ ModelComposed: 0,
+ ModelNormal: 1,
+ ModelSimple: 2,
+ none_type: 3, # The type of 'None'.
+ list: 4,
+ dict: 5,
+ float: 6,
+ int: 7,
+ bool: 8,
+ datetime: 9,
+ date: 10,
+ str: 11,
+ file_type: 12, # 'file_type' is an alias for the built-in 'file' or 'io.IOBase' type.
+}
+
+# these are used to limit what type conversions we try to do
+# when we have a valid type already and we want to try converting
+# to another type
+UPCONVERSION_TYPE_PAIRS = (
+ (str, datetime),
+ (str, date),
+ (int, float), # A float may be serialized as an integer, e.g. '3' is a valid serialized float.
+ (list, ModelComposed),
+ (dict, ModelComposed),
+ (str, ModelComposed),
+ (int, ModelComposed),
+ (float, ModelComposed),
+ (list, ModelComposed),
+ (list, ModelNormal),
+ (dict, ModelNormal),
+ (str, ModelSimple),
+ (int, ModelSimple),
+ (float, ModelSimple),
+ (list, ModelSimple),
+)
+
+COERCIBLE_TYPE_PAIRS = {
+ False: ( # client instantiation of a model with client data
+ # (dict, ModelComposed),
+ # (list, ModelComposed),
+ # (dict, ModelNormal),
+ # (list, ModelNormal),
+ # (str, ModelSimple),
+ # (int, ModelSimple),
+ # (float, ModelSimple),
+ # (list, ModelSimple),
+ # (str, int),
+ # (str, float),
+ # (str, datetime),
+ # (str, date),
+ # (int, str),
+ # (float, str),
+ ),
+ True: ( # server -> client data
+ (dict, ModelComposed),
+ (list, ModelComposed),
+ (dict, ModelNormal),
+ (list, ModelNormal),
+ (str, ModelSimple),
+ (int, ModelSimple),
+ (float, ModelSimple),
+ (list, ModelSimple),
+ # (str, int),
+ # (str, float),
+ (str, datetime),
+ (str, date),
+ # (int, str),
+ # (float, str),
+ (str, file_type)
+ ),
+}
+
+
+def get_simple_class(input_value):
+ """Returns an input_value's simple class that we will use for type checking
+ Python2:
+ float and int will return int, where int is the python3 int backport
+ str and unicode will return str, where str is the python3 str backport
+ Note: float and int ARE both instances of int backport
+ Note: str_py2 and unicode_py2 are NOT both instances of str backport
+
+ Args:
+ input_value (class/class_instance): the item for which we will return
+ the simple class
+ """
+ if isinstance(input_value, type):
+ # input_value is a class
+ return input_value
+ elif isinstance(input_value, tuple):
+ return tuple
+ elif isinstance(input_value, list):
+ return list
+ elif isinstance(input_value, dict):
+ return dict
+ elif isinstance(input_value, none_type):
+ return none_type
+ elif isinstance(input_value, file_type):
+ return file_type
+ elif isinstance(input_value, bool):
+ # this must be higher than the int check because
+ # isinstance(True, int) == True
+ return bool
+ elif isinstance(input_value, int):
+ return int
+ elif isinstance(input_value, datetime):
+ # this must be higher than the date check because
+ # isinstance(datetime_instance, date) == True
+ return datetime
+ elif isinstance(input_value, date):
+ return date
+ elif isinstance(input_value, str):
+ return str
+ return type(input_value)
+
+
+def check_allowed_values(allowed_values, input_variable_path, input_values):
+ """Raises an exception if the input_values are not allowed
+
+ Args:
+ allowed_values (dict): the allowed_values dict
+ input_variable_path (tuple): the path to the input variable
+ input_values (list/str/int/float/date/datetime): the values that we
+ are checking to see if they are in allowed_values
+ """
+ these_allowed_values = list(allowed_values[input_variable_path].values())
+ if (isinstance(input_values, list)
+ and not set(input_values).issubset(
+ set(these_allowed_values))):
+ invalid_values = ", ".join(
+ map(str, set(input_values) - set(these_allowed_values))),
+ raise ApiValueError(
+ "Invalid values for `%s` [%s], must be a subset of [%s]" %
+ (
+ input_variable_path[0],
+ invalid_values,
+ ", ".join(map(str, these_allowed_values))
+ )
+ )
+ elif (isinstance(input_values, dict)
+ and not set(
+ input_values.keys()).issubset(set(these_allowed_values))):
+ invalid_values = ", ".join(
+ map(str, set(input_values.keys()) - set(these_allowed_values)))
+ raise ApiValueError(
+ "Invalid keys in `%s` [%s], must be a subset of [%s]" %
+ (
+ input_variable_path[0],
+ invalid_values,
+ ", ".join(map(str, these_allowed_values))
+ )
+ )
+ elif (not isinstance(input_values, (list, dict))
+ and input_values not in these_allowed_values):
+ raise ApiValueError(
+ "Invalid value for `%s` (%s), must be one of %s" %
+ (
+ input_variable_path[0],
+ input_values,
+ these_allowed_values
+ )
+ )
+
+
+def is_json_validation_enabled(schema_keyword, configuration=None):
+ """Returns true if JSON schema validation is enabled for the specified
+ validation keyword. This can be used to skip JSON schema structural validation
+ as requested in the configuration.
+
+ Args:
+ schema_keyword (string): the name of a JSON schema validation keyword.
+ configuration (Configuration): the configuration class.
+ """
+
+ return (configuration is None or
+ not hasattr(configuration, '_disabled_client_side_validations') or
+ schema_keyword not in configuration._disabled_client_side_validations)
+
+
+def check_validations(
+ validations, input_variable_path, input_values,
+ configuration=None):
+ """Raises an exception if the input_values are invalid
+
+ Args:
+ validations (dict): the validation dictionary.
+ input_variable_path (tuple): the path to the input variable.
+ input_values (list/str/int/float/date/datetime): the values that we
+ are checking.
+ configuration (Configuration): the configuration class.
+ """
+
+ if input_values is None:
+ return
+
+ current_validations = validations[input_variable_path]
+ if (is_json_validation_enabled('multipleOf', configuration) and
+ 'multiple_of' in current_validations and
+ isinstance(input_values, (int, float)) and
+ not (float(input_values) / current_validations['multiple_of']).is_integer()):
+ # Note 'multipleOf' will be as good as the floating point arithmetic.
+ raise ApiValueError(
+ "Invalid value for `%s`, value must be a multiple of "
+ "`%s`" % (
+ input_variable_path[0],
+ current_validations['multiple_of']
+ )
+ )
+
+ if (is_json_validation_enabled('maxLength', configuration) and
+ 'max_length' in current_validations and
+ len(input_values) > current_validations['max_length']):
+ raise ApiValueError(
+ "Invalid value for `%s`, length must be less than or equal to "
+ "`%s`" % (
+ input_variable_path[0],
+ current_validations['max_length']
+ )
+ )
+
+ if (is_json_validation_enabled('minLength', configuration) and
+ 'min_length' in current_validations and
+ len(input_values) < current_validations['min_length']):
+ raise ApiValueError(
+ "Invalid value for `%s`, length must be greater than or equal to "
+ "`%s`" % (
+ input_variable_path[0],
+ current_validations['min_length']
+ )
+ )
+
+ if (is_json_validation_enabled('maxItems', configuration) and
+ 'max_items' in current_validations and
+ len(input_values) > current_validations['max_items']):
+ raise ApiValueError(
+ "Invalid value for `%s`, number of items must be less than or "
+ "equal to `%s`" % (
+ input_variable_path[0],
+ current_validations['max_items']
+ )
+ )
+
+ if (is_json_validation_enabled('minItems', configuration) and
+ 'min_items' in current_validations and
+ len(input_values) < current_validations['min_items']):
+ raise ValueError(
+ "Invalid value for `%s`, number of items must be greater than or "
+ "equal to `%s`" % (
+ input_variable_path[0],
+ current_validations['min_items']
+ )
+ )
+
+ items = ('exclusive_maximum', 'inclusive_maximum', 'exclusive_minimum',
+ 'inclusive_minimum')
+ if (any(item in current_validations for item in items)):
+ if isinstance(input_values, list):
+ max_val = max(input_values)
+ min_val = min(input_values)
+ elif isinstance(input_values, dict):
+ max_val = max(input_values.values())
+ min_val = min(input_values.values())
+ else:
+ max_val = input_values
+ min_val = input_values
+
+ if (is_json_validation_enabled('exclusiveMaximum', configuration) and
+ 'exclusive_maximum' in current_validations and
+ max_val >= current_validations['exclusive_maximum']):
+ raise ApiValueError(
+ "Invalid value for `%s`, must be a value less than `%s`" % (
+ input_variable_path[0],
+ current_validations['exclusive_maximum']
+ )
+ )
+
+ if (is_json_validation_enabled('maximum', configuration) and
+ 'inclusive_maximum' in current_validations and
+ max_val > current_validations['inclusive_maximum']):
+ raise ApiValueError(
+ "Invalid value for `%s`, must be a value less than or equal to "
+ "`%s`" % (
+ input_variable_path[0],
+ current_validations['inclusive_maximum']
+ )
+ )
+
+ if (is_json_validation_enabled('exclusiveMinimum', configuration) and
+ 'exclusive_minimum' in current_validations and
+ min_val <= current_validations['exclusive_minimum']):
+ raise ApiValueError(
+ "Invalid value for `%s`, must be a value greater than `%s`" %
+ (
+ input_variable_path[0],
+ current_validations['exclusive_maximum']
+ )
+ )
+
+ if (is_json_validation_enabled('minimum', configuration) and
+ 'inclusive_minimum' in current_validations and
+ min_val < current_validations['inclusive_minimum']):
+ raise ApiValueError(
+ "Invalid value for `%s`, must be a value greater than or equal "
+ "to `%s`" % (
+ input_variable_path[0],
+ current_validations['inclusive_minimum']
+ )
+ )
+ flags = current_validations.get('regex', {}).get('flags', 0)
+ if (is_json_validation_enabled('pattern', configuration) and
+ 'regex' in current_validations and
+ not re.search(current_validations['regex']['pattern'],
+ input_values, flags=flags)):
+ err_msg = r"Invalid value for `%s`, must match regular expression `%s`" % (
+ input_variable_path[0],
+ current_validations['regex']['pattern']
+ )
+ if flags != 0:
+ # Don't print the regex flags if the flags are not
+ # specified in the OAS document.
+ err_msg = r"%s with flags=`%s`" % (err_msg, flags)
+ raise ApiValueError(err_msg)
+
+
+def order_response_types(required_types):
+ """Returns the required types sorted in coercion order
+
+ Args:
+ required_types (list/tuple): collection of classes or instance of
+ list or dict with class information inside it.
+
+ Returns:
+ (list): coercion order sorted collection of classes or instance
+ of list or dict with class information inside it.
+ """
+
+ def index_getter(class_or_instance):
+ if isinstance(class_or_instance, list):
+ return COERCION_INDEX_BY_TYPE[list]
+ elif isinstance(class_or_instance, dict):
+ return COERCION_INDEX_BY_TYPE[dict]
+ elif (inspect.isclass(class_or_instance)
+ and issubclass(class_or_instance, ModelComposed)):
+ return COERCION_INDEX_BY_TYPE[ModelComposed]
+ elif (inspect.isclass(class_or_instance)
+ and issubclass(class_or_instance, ModelNormal)):
+ return COERCION_INDEX_BY_TYPE[ModelNormal]
+ elif (inspect.isclass(class_or_instance)
+ and issubclass(class_or_instance, ModelSimple)):
+ return COERCION_INDEX_BY_TYPE[ModelSimple]
+ elif class_or_instance in COERCION_INDEX_BY_TYPE:
+ return COERCION_INDEX_BY_TYPE[class_or_instance]
+ raise ApiValueError("Unsupported type: %s" % class_or_instance)
+
+ sorted_types = sorted(
+ required_types,
+ key=lambda class_or_instance: index_getter(class_or_instance)
+ )
+ return sorted_types
+
+
+def remove_uncoercible(required_types_classes, current_item, spec_property_naming,
+ must_convert=True):
+ """Only keeps the type conversions that are possible
+
+ Args:
+ required_types_classes (tuple): tuple of classes that are required
+ these should be ordered by COERCION_INDEX_BY_TYPE
+ spec_property_naming (bool): True if the variable names in the input
+ data are serialized names as specified in the OpenAPI document.
+ False if the variables names in the input data are python
+ variable names in PEP-8 snake case.
+ current_item (any): the current item (input data) to be converted
+
+ Keyword Args:
+ must_convert (bool): if True the item to convert is of the wrong
+ type and we want a big list of coercibles
+ if False, we want a limited list of coercibles
+
+ Returns:
+ (list): the remaining coercible required types, classes only
+ """
+ current_type_simple = get_simple_class(current_item)
+
+ results_classes = []
+ for required_type_class in required_types_classes:
+ # convert our models to OpenApiModel
+ required_type_class_simplified = required_type_class
+ if isinstance(required_type_class_simplified, type):
+ if issubclass(required_type_class_simplified, ModelComposed):
+ required_type_class_simplified = ModelComposed
+ elif issubclass(required_type_class_simplified, ModelNormal):
+ required_type_class_simplified = ModelNormal
+ elif issubclass(required_type_class_simplified, ModelSimple):
+ required_type_class_simplified = ModelSimple
+
+ if required_type_class_simplified == current_type_simple:
+ # don't consider converting to one's own class
+ continue
+
+ class_pair = (current_type_simple, required_type_class_simplified)
+ if must_convert and class_pair in COERCIBLE_TYPE_PAIRS[spec_property_naming]:
+ results_classes.append(required_type_class)
+ elif class_pair in UPCONVERSION_TYPE_PAIRS:
+ results_classes.append(required_type_class)
+ return results_classes
+
+def get_discriminated_classes(cls):
+ """
+ Returns all the classes that a discriminator converts to
+ TODO: lru_cache this
+ """
+ possible_classes = []
+ key = list(cls.discriminator.keys())[0]
+ if is_type_nullable(cls):
+ possible_classes.append(cls)
+ for discr_cls in cls.discriminator[key].values():
+ if hasattr(discr_cls, 'discriminator') and discr_cls.discriminator is not None:
+ possible_classes.extend(get_discriminated_classes(discr_cls))
+ else:
+ possible_classes.append(discr_cls)
+ return possible_classes
+
+
+def get_possible_classes(cls, from_server_context):
+ # TODO: lru_cache this
+ possible_classes = [cls]
+ if from_server_context:
+ return possible_classes
+ if hasattr(cls, 'discriminator') and cls.discriminator is not None:
+ possible_classes = []
+ possible_classes.extend(get_discriminated_classes(cls))
+ elif issubclass(cls, ModelComposed):
+ possible_classes.extend(composed_model_input_classes(cls))
+ return possible_classes
+
+
+def get_required_type_classes(required_types_mixed, spec_property_naming):
+ """Converts the tuple required_types into a tuple and a dict described
+ below
+
+ Args:
+ required_types_mixed (tuple/list): will contain either classes or
+ instance of list or dict
+ spec_property_naming (bool): if True these values came from the
+ server, and we use the data types in our endpoints.
+ If False, we are client side and we need to include
+ oneOf and discriminator classes inside the data types in our endpoints
+
+ Returns:
+ (valid_classes, dict_valid_class_to_child_types_mixed):
+ valid_classes (tuple): the valid classes that the current item
+ should be
+ dict_valid_class_to_child_types_mixed (dict):
+ valid_class (class): this is the key
+ child_types_mixed (list/dict/tuple): describes the valid child
+ types
+ """
+ valid_classes = []
+ child_req_types_by_current_type = {}
+ for required_type in required_types_mixed:
+ if isinstance(required_type, list):
+ valid_classes.append(list)
+ child_req_types_by_current_type[list] = required_type
+ elif isinstance(required_type, tuple):
+ valid_classes.append(tuple)
+ child_req_types_by_current_type[tuple] = required_type
+ elif isinstance(required_type, dict):
+ valid_classes.append(dict)
+ child_req_types_by_current_type[dict] = required_type[str]
+ else:
+ valid_classes.extend(get_possible_classes(required_type, spec_property_naming))
+ return tuple(valid_classes), child_req_types_by_current_type
+
+
+def change_keys_js_to_python(input_dict, model_class):
+ """
+ Converts from javascript_key keys in the input_dict to python_keys in
+ the output dict using the mapping in model_class.
+ If the input_dict contains a key which does not declared in the model_class,
+ the key is added to the output dict as is. The assumption is the model_class
+ may have undeclared properties (additionalProperties attribute in the OAS
+ document).
+ """
+
+ if getattr(model_class, 'attribute_map', None) is None:
+ return input_dict
+ output_dict = {}
+ reversed_attr_map = {value: key for key, value in
+ model_class.attribute_map.items()}
+ for javascript_key, value in input_dict.items():
+ python_key = reversed_attr_map.get(javascript_key)
+ if python_key is None:
+ # if the key is unknown, it is in error or it is an
+ # additionalProperties variable
+ python_key = javascript_key
+ output_dict[python_key] = value
+ return output_dict
+
+
+def get_type_error(var_value, path_to_item, valid_classes, key_type=False):
+ error_msg = type_error_message(
+ var_name=path_to_item[-1],
+ var_value=var_value,
+ valid_classes=valid_classes,
+ key_type=key_type
+ )
+ return ApiTypeError(
+ error_msg,
+ path_to_item=path_to_item,
+ valid_classes=valid_classes,
+ key_type=key_type
+ )
+
+
+def deserialize_primitive(data, klass, path_to_item):
+ """Deserializes string to primitive type.
+
+ :param data: str/int/float
+ :param klass: str/class the class to convert to
+
+ :return: int, float, str, bool, date, datetime
+ """
+ additional_message = ""
+ try:
+ if klass in {datetime, date}:
+ additional_message = (
+ "If you need your parameter to have a fallback "
+ "string value, please set its type as `type: {}` in your "
+ "spec. That allows the value to be any type. "
+ )
+ if klass == datetime:
+ if len(data) < 8:
+ raise ValueError("This is not a datetime")
+ # The string should be in iso8601 datetime format.
+ parsed_datetime = parse(data)
+ date_only = (
+ parsed_datetime.hour == 0 and
+ parsed_datetime.minute == 0 and
+ parsed_datetime.second == 0 and
+ parsed_datetime.tzinfo is None and
+ 8 <= len(data) <= 10
+ )
+ if date_only:
+ raise ValueError("This is a date, not a datetime")
+ return parsed_datetime
+ elif klass == date:
+ if len(data) < 8:
+ raise ValueError("This is not a date")
+ return parse(data).date()
+ else:
+ converted_value = klass(data)
+ if isinstance(data, str) and klass == float:
+ if str(converted_value) != data:
+ # '7' -> 7.0 -> '7.0' != '7'
+ raise ValueError('This is not a float')
+ return converted_value
+ except (OverflowError, ValueError) as ex:
+ # parse can raise OverflowError
+ raise ApiValueError(
+ "{0}Failed to parse {1} as {2}".format(
+ additional_message, repr(data), klass.__name__
+ ),
+ path_to_item=path_to_item
+ ) from ex
+
+
+def get_discriminator_class(model_class,
+ discr_name,
+ discr_value, cls_visited):
+ """Returns the child class specified by the discriminator.
+
+ Args:
+ model_class (OpenApiModel): the model class.
+ discr_name (string): the name of the discriminator property.
+ discr_value (any): the discriminator value.
+ cls_visited (list): list of model classes that have been visited.
+ Used to determine the discriminator class without
+ visiting circular references indefinitely.
+
+ Returns:
+ used_model_class (class/None): the chosen child class that will be used
+ to deserialize the data, for example dog.Dog.
+ If a class is not found, None is returned.
+ """
+
+ if model_class in cls_visited:
+ # The class has already been visited and no suitable class was found.
+ return None
+ cls_visited.append(model_class)
+ used_model_class = None
+ if discr_name in model_class.discriminator:
+ class_name_to_discr_class = model_class.discriminator[discr_name]
+ used_model_class = class_name_to_discr_class.get(discr_value)
+ if used_model_class is None:
+ # We didn't find a discriminated class in class_name_to_discr_class.
+ # So look in the ancestor or descendant discriminators
+ # The discriminator mapping may exist in a descendant (anyOf, oneOf)
+ # or ancestor (allOf).
+ # Ancestor example: in the GrandparentAnimal -> ParentPet -> ChildCat
+ # hierarchy, the discriminator mappings may be defined at any level
+ # in the hierarchy.
+ # Descendant example: mammal -> whale/zebra/Pig -> BasquePig/DanishPig
+ # if we try to make BasquePig from mammal, we need to travel through
+ # the oneOf descendant discriminators to find BasquePig
+ descendant_classes = model_class._composed_schemas.get('oneOf', ()) + \
+ model_class._composed_schemas.get('anyOf', ())
+ ancestor_classes = model_class._composed_schemas.get('allOf', ())
+ possible_classes = descendant_classes + ancestor_classes
+ for cls in possible_classes:
+ # Check if the schema has inherited discriminators.
+ if hasattr(cls, 'discriminator') and cls.discriminator is not None:
+ used_model_class = get_discriminator_class(
+ cls, discr_name, discr_value, cls_visited)
+ if used_model_class is not None:
+ return used_model_class
+ return used_model_class
+
+
+def deserialize_model(model_data, model_class, path_to_item, check_type,
+ configuration, spec_property_naming):
+ """Deserializes model_data to model instance.
+
+ Args:
+ model_data (int/str/float/bool/none_type/list/dict): data to instantiate the model
+ model_class (OpenApiModel): the model class
+ path_to_item (list): path to the model in the received data
+ check_type (bool): whether to check the data tupe for the values in
+ the model
+ configuration (Configuration): the instance to use to convert files
+ spec_property_naming (bool): True if the variable names in the input
+ data are serialized names as specified in the OpenAPI document.
+ False if the variables names in the input data are python
+ variable names in PEP-8 snake case.
+
+ Returns:
+ model instance
+
+ Raise:
+ ApiTypeError
+ ApiValueError
+ ApiKeyError
+ """
+
+ kw_args = dict(_check_type=check_type,
+ _path_to_item=path_to_item,
+ _configuration=configuration,
+ _spec_property_naming=spec_property_naming)
+
+ if issubclass(model_class, ModelSimple):
+ return model_class(model_data, **kw_args)
+ elif isinstance(model_data, list):
+ return model_class(*model_data, **kw_args)
+ if isinstance(model_data, dict):
+ kw_args.update(model_data)
+ return model_class(**kw_args)
+ elif isinstance(model_data, PRIMITIVE_TYPES):
+ return model_class(model_data, **kw_args)
+
+
+def deserialize_file(response_data, configuration, content_disposition=None):
+ """Deserializes body to file
+
+ Saves response body into a file in a temporary folder,
+ using the filename from the `Content-Disposition` header if provided.
+
+ Args:
+ param response_data (str): the file data to write
+ configuration (Configuration): the instance to use to convert files
+
+ Keyword Args:
+ content_disposition (str): the value of the Content-Disposition
+ header
+
+ Returns:
+ (file_type): the deserialized file which is open
+ The user is responsible for closing and reading the file
+ """
+ fd, path = tempfile.mkstemp(dir=configuration.temp_folder_path)
+ os.close(fd)
+ os.remove(path)
+
+ if content_disposition:
+ filename = re.search(r'filename=[\'"]?([^\'"\s]+)[\'"]?',
+ content_disposition).group(1)
+ path = os.path.join(os.path.dirname(path), filename)
+
+ with open(path, "wb") as f:
+ if isinstance(response_data, str):
+ # change str to bytes so we can write it
+ response_data = response_data.encode('utf-8')
+ f.write(response_data)
+
+ f = open(path, "rb")
+ return f
+
+
+def attempt_convert_item(input_value, valid_classes, path_to_item,
+ configuration, spec_property_naming, key_type=False,
+ must_convert=False, check_type=True):
+ """
+ Args:
+ input_value (any): the data to convert
+ valid_classes (any): the classes that are valid
+ path_to_item (list): the path to the item to convert
+ configuration (Configuration): the instance to use to convert files
+ spec_property_naming (bool): True if the variable names in the input
+ data are serialized names as specified in the OpenAPI document.
+ False if the variables names in the input data are python
+ variable names in PEP-8 snake case.
+ key_type (bool): if True we need to convert a key type (not supported)
+ must_convert (bool): if True we must convert
+ check_type (bool): if True we check the type or the returned data in
+ ModelComposed/ModelNormal/ModelSimple instances
+
+ Returns:
+ instance (any) the fixed item
+
+ Raises:
+ ApiTypeError
+ ApiValueError
+ ApiKeyError
+ """
+ valid_classes_ordered = order_response_types(valid_classes)
+ valid_classes_coercible = remove_uncoercible(
+ valid_classes_ordered, input_value, spec_property_naming)
+ if not valid_classes_coercible or key_type:
+ # we do not handle keytype errors, json will take care
+ # of this for us
+ if configuration is None or not configuration.discard_unknown_keys:
+ raise get_type_error(input_value, path_to_item, valid_classes,
+ key_type=key_type)
+ for valid_class in valid_classes_coercible:
+ try:
+ if issubclass(valid_class, OpenApiModel):
+ return deserialize_model(input_value, valid_class,
+ path_to_item, check_type,
+ configuration, spec_property_naming)
+ elif valid_class == file_type:
+ return deserialize_file(input_value, configuration)
+ return deserialize_primitive(input_value, valid_class,
+ path_to_item)
+ except (ApiTypeError, ApiValueError, ApiKeyError) as conversion_exc:
+ if must_convert:
+ raise conversion_exc
+ # if we have conversion errors when must_convert == False
+ # we ignore the exception and move on to the next class
+ continue
+ # we were unable to convert, must_convert == False
+ return input_value
+
+
+def is_type_nullable(input_type):
+ """
+ Returns true if None is an allowed value for the specified input_type.
+
+ A type is nullable if at least one of the following conditions is true:
+ 1. The OAS 'nullable' attribute has been specified,
+ 1. The type is the 'null' type,
+ 1. The type is a anyOf/oneOf composed schema, and a child schema is
+ the 'null' type.
+ Args:
+ input_type (type): the class of the input_value that we are
+ checking
+ Returns:
+ bool
+ """
+ if input_type is none_type:
+ return True
+ if issubclass(input_type, OpenApiModel) and input_type._nullable:
+ return True
+ if issubclass(input_type, ModelComposed):
+ # If oneOf/anyOf, check if the 'null' type is one of the allowed types.
+ for t in input_type._composed_schemas.get('oneOf', ()):
+ if is_type_nullable(t): return True
+ for t in input_type._composed_schemas.get('anyOf', ()):
+ if is_type_nullable(t): return True
+ return False
+
+
+def is_valid_type(input_class_simple, valid_classes):
+ """
+ Args:
+ input_class_simple (class): the class of the input_value that we are
+ checking
+ valid_classes (tuple): the valid classes that the current item
+ should be
+ Returns:
+ bool
+ """
+ valid_type = input_class_simple in valid_classes
+ if not valid_type and (
+ issubclass(input_class_simple, OpenApiModel) or
+ input_class_simple is none_type):
+ for valid_class in valid_classes:
+ if input_class_simple is none_type and is_type_nullable(valid_class):
+ # Schema is oneOf/anyOf and the 'null' type is one of the allowed types.
+ return True
+ if not (issubclass(valid_class, OpenApiModel) and valid_class.discriminator):
+ continue
+ discr_propertyname_py = list(valid_class.discriminator.keys())[0]
+ discriminator_classes = (
+ valid_class.discriminator[discr_propertyname_py].values()
+ )
+ valid_type = is_valid_type(input_class_simple, discriminator_classes)
+ if valid_type:
+ return True
+ return valid_type
+
+
+def validate_and_convert_types(input_value, required_types_mixed, path_to_item,
+ spec_property_naming, _check_type, configuration=None):
+ """Raises a TypeError is there is a problem, otherwise returns value
+
+ Args:
+ input_value (any): the data to validate/convert
+ required_types_mixed (list/dict/tuple): A list of
+ valid classes, or a list tuples of valid classes, or a dict where
+ the value is a tuple of value classes
+ path_to_item: (list) the path to the data being validated
+ this stores a list of keys or indices to get to the data being
+ validated
+ spec_property_naming (bool): True if the variable names in the input
+ data are serialized names as specified in the OpenAPI document.
+ False if the variables names in the input data are python
+ variable names in PEP-8 snake case.
+ _check_type: (boolean) if true, type will be checked and conversion
+ will be attempted.
+ configuration: (Configuration): the configuration class to use
+ when converting file_type items.
+ If passed, conversion will be attempted when possible
+ If not passed, no conversions will be attempted and
+ exceptions will be raised
+
+ Returns:
+ the correctly typed value
+
+ Raises:
+ ApiTypeError
+ """
+ results = get_required_type_classes(required_types_mixed, spec_property_naming)
+ valid_classes, child_req_types_by_current_type = results
+
+ input_class_simple = get_simple_class(input_value)
+ valid_type = is_valid_type(input_class_simple, valid_classes)
+ if not valid_type:
+ if configuration:
+ # if input_value is not valid_type try to convert it
+ converted_instance = attempt_convert_item(
+ input_value,
+ valid_classes,
+ path_to_item,
+ configuration,
+ spec_property_naming,
+ key_type=False,
+ must_convert=True,
+ check_type=_check_type
+ )
+ return converted_instance
+ else:
+ raise get_type_error(input_value, path_to_item, valid_classes,
+ key_type=False)
+
+ # input_value's type is in valid_classes
+ if len(valid_classes) > 1 and configuration:
+ # there are valid classes which are not the current class
+ valid_classes_coercible = remove_uncoercible(
+ valid_classes, input_value, spec_property_naming, must_convert=False)
+ if valid_classes_coercible:
+ converted_instance = attempt_convert_item(
+ input_value,
+ valid_classes_coercible,
+ path_to_item,
+ configuration,
+ spec_property_naming,
+ key_type=False,
+ must_convert=False,
+ check_type=_check_type
+ )
+ return converted_instance
+
+ if child_req_types_by_current_type == {}:
+ # all types are of the required types and there are no more inner
+ # variables left to look at
+ return input_value
+ inner_required_types = child_req_types_by_current_type.get(
+ type(input_value)
+ )
+ if inner_required_types is None:
+ # for this type, there are not more inner variables left to look at
+ return input_value
+ if isinstance(input_value, list):
+ if input_value == []:
+ # allow an empty list
+ return input_value
+ for index, inner_value in enumerate(input_value):
+ inner_path = list(path_to_item)
+ inner_path.append(index)
+ input_value[index] = validate_and_convert_types(
+ inner_value,
+ inner_required_types,
+ inner_path,
+ spec_property_naming,
+ _check_type,
+ configuration=configuration
+ )
+ elif isinstance(input_value, dict):
+ if input_value == {}:
+ # allow an empty dict
+ return input_value
+ for inner_key, inner_val in input_value.items():
+ inner_path = list(path_to_item)
+ inner_path.append(inner_key)
+ if get_simple_class(inner_key) != str:
+ raise get_type_error(inner_key, inner_path, valid_classes,
+ key_type=True)
+ input_value[inner_key] = validate_and_convert_types(
+ inner_val,
+ inner_required_types,
+ inner_path,
+ spec_property_naming,
+ _check_type,
+ configuration=configuration
+ )
+ return input_value
+
+
+def model_to_dict(model_instance, serialize=True):
+ """Returns the model properties as a dict
+
+ Args:
+ model_instance (one of your model instances): the model instance that
+ will be converted to a dict.
+
+ Keyword Args:
+ serialize (bool): if True, the keys in the dict will be values from
+ attribute_map
+ """
+ result = {}
+
+ model_instances = [model_instance]
+ if model_instance._composed_schemas:
+ model_instances.extend(model_instance._composed_instances)
+ for model_instance in model_instances:
+ for attr, value in model_instance._data_store.items():
+ if serialize:
+ # we use get here because additional property key names do not
+ # exist in attribute_map
+ attr = model_instance.attribute_map.get(attr, attr)
+ if isinstance(value, list):
+ if not value or isinstance(value[0], PRIMITIVE_TYPES):
+ # empty list or primitive types
+ result[attr] = value
+ elif isinstance(value[0], ModelSimple):
+ result[attr] = [x.value for x in value]
+ else:
+ result[attr] = [model_to_dict(x, serialize=serialize) for x in value]
+ elif isinstance(value, dict):
+ result[attr] = dict(map(
+ lambda item: (item[0],
+ model_to_dict(item[1], serialize=serialize))
+ if hasattr(item[1], '_data_store') else item,
+ value.items()
+ ))
+ elif isinstance(value, ModelSimple):
+ result[attr] = value.value
+ elif hasattr(value, '_data_store'):
+ result[attr] = model_to_dict(value, serialize=serialize)
+ else:
+ result[attr] = value
+
+ return result
+
+
+def type_error_message(var_value=None, var_name=None, valid_classes=None,
+ key_type=None):
+ """
+ Keyword Args:
+ var_value (any): the variable which has the type_error
+ var_name (str): the name of the variable which has the typ error
+ valid_classes (tuple): the accepted classes for current_item's
+ value
+ key_type (bool): False if our value is a value in a dict
+ True if it is a key in a dict
+ False if our item is an item in a list
+ """
+ key_or_value = 'value'
+ if key_type:
+ key_or_value = 'key'
+ valid_classes_phrase = get_valid_classes_phrase(valid_classes)
+ msg = (
+ "Invalid type for variable '{0}'. Required {1} type {2} and "
+ "passed type was {3}".format(
+ var_name,
+ key_or_value,
+ valid_classes_phrase,
+ type(var_value).__name__,
+ )
+ )
+ return msg
+
+
+def get_valid_classes_phrase(input_classes):
+ """Returns a string phrase describing what types are allowed
+ """
+ all_classes = list(input_classes)
+ all_classes = sorted(all_classes, key=lambda cls: cls.__name__)
+ all_class_names = [cls.__name__ for cls in all_classes]
+ if len(all_class_names) == 1:
+ return 'is {0}'.format(all_class_names[0])
+ return "is one of [{0}]".format(", ".join(all_class_names))
+
+
+def convert_js_args_to_python_args(fn):
+ from functools import wraps
+ @wraps(fn)
+ def wrapped_init(self, *args, **kwargs):
+ spec_property_naming = kwargs.get('_spec_property_naming', False)
+ if spec_property_naming:
+ kwargs = change_keys_js_to_python(kwargs, self.__class__)
+ return fn(self, *args, **kwargs)
+ return wrapped_init
+
+
+def get_allof_instances(self, model_args, constant_args):
+ """
+ Args:
+ self: the class we are handling
+ model_args (dict): var_name to var_value
+ used to make instances
+ constant_args (dict):
+ metadata arguments:
+ _check_type
+ _path_to_item
+ _spec_property_naming
+ _configuration
+ _visited_composed_classes
+
+ Returns
+ composed_instances (list)
+ """
+ composed_instances = []
+ for allof_class in self._composed_schemas['allOf']:
+
+ try:
+ allof_instance = allof_class(**model_args, **constant_args)
+ composed_instances.append(allof_instance)
+ except Exception as ex:
+ raise ApiValueError(
+ "Invalid inputs given to generate an instance of '%s'. The "
+ "input data was invalid for the allOf schema '%s' in the composed "
+ "schema '%s'. Error=%s" % (
+ allof_class.__name__,
+ allof_class.__name__,
+ self.__class__.__name__,
+ str(ex)
+ )
+ ) from ex
+ return composed_instances
+
+
+def get_oneof_instance(cls, model_kwargs, constant_kwargs, model_arg=None):
+ """
+ Find the oneOf schema that matches the input data (e.g. payload).
+ If exactly one schema matches the input data, an instance of that schema
+ is returned.
+ If zero or more than one schema match the input data, an exception is raised.
+ In OAS 3.x, the payload MUST, by validation, match exactly one of the
+ schemas described by oneOf.
+
+ Args:
+ cls: the class we are handling
+ model_kwargs (dict): var_name to var_value
+ The input data, e.g. the payload that must match a oneOf schema
+ in the OpenAPI document.
+ constant_kwargs (dict): var_name to var_value
+ args that every model requires, including configuration, server
+ and path to item.
+
+ Kwargs:
+ model_arg: (int, float, bool, str, date, datetime, ModelSimple, None):
+ the value to assign to a primitive class or ModelSimple class
+ Notes:
+ - this is only passed in when oneOf includes types which are not object
+ - None is used to suppress handling of model_arg, nullable models are handled in __new__
+
+ Returns
+ oneof_instance (instance)
+ """
+ if len(cls._composed_schemas['oneOf']) == 0:
+ return None
+
+ oneof_instances = []
+ # Iterate over each oneOf schema and determine if the input data
+ # matches the oneOf schemas.
+ for oneof_class in cls._composed_schemas['oneOf']:
+ # The composed oneOf schema allows the 'null' type and the input data
+ # is the null value. This is a OAS >= 3.1 feature.
+ if oneof_class is none_type:
+ # skip none_types because we are deserializing dict data.
+ # none_type deserialization is handled in the __new__ method
+ continue
+
+ single_value_input = allows_single_value_input(oneof_class)
+
+ try:
+ if not single_value_input:
+ oneof_instance = oneof_class(**model_kwargs, **constant_kwargs)
+ else:
+ if issubclass(oneof_class, ModelSimple):
+ oneof_instance = oneof_class(model_arg, **constant_kwargs)
+ elif oneof_class in PRIMITIVE_TYPES:
+ oneof_instance = validate_and_convert_types(
+ model_arg,
+ (oneof_class,),
+ constant_kwargs['_path_to_item'],
+ constant_kwargs['_spec_property_naming'],
+ constant_kwargs['_check_type'],
+ configuration=constant_kwargs['_configuration']
+ )
+ oneof_instances.append(oneof_instance)
+ except Exception:
+ pass
+ if len(oneof_instances) == 0:
+ raise ApiValueError(
+ "Invalid inputs given to generate an instance of %s. None "
+ "of the oneOf schemas matched the input data." %
+ cls.__name__
+ )
+ elif len(oneof_instances) > 1:
+ raise ApiValueError(
+ "Invalid inputs given to generate an instance of %s. Multiple "
+ "oneOf schemas matched the inputs, but a max of one is allowed." %
+ cls.__name__
+ )
+ return oneof_instances[0]
+
+
+def get_anyof_instances(self, model_args, constant_args):
+ """
+ Args:
+ self: the class we are handling
+ model_args (dict): var_name to var_value
+ The input data, e.g. the payload that must match at least one
+ anyOf child schema in the OpenAPI document.
+ constant_args (dict): var_name to var_value
+ args that every model requires, including configuration, server
+ and path to item.
+
+ Returns
+ anyof_instances (list)
+ """
+ anyof_instances = []
+ if len(self._composed_schemas['anyOf']) == 0:
+ return anyof_instances
+
+ for anyof_class in self._composed_schemas['anyOf']:
+ # The composed oneOf schema allows the 'null' type and the input data
+ # is the null value. This is a OAS >= 3.1 feature.
+ if anyof_class is none_type:
+ # skip none_types because we are deserializing dict data.
+ # none_type deserialization is handled in the __new__ method
+ continue
+
+ try:
+ anyof_instance = anyof_class(**model_args, **constant_args)
+ anyof_instances.append(anyof_instance)
+ except Exception:
+ pass
+ if len(anyof_instances) == 0:
+ raise ApiValueError(
+ "Invalid inputs given to generate an instance of %s. None of the "
+ "anyOf schemas matched the inputs." %
+ self.__class__.__name__
+ )
+ return anyof_instances
+
+
+def get_discarded_args(self, composed_instances, model_args):
+ """
+ Gathers the args that were discarded by configuration.discard_unknown_keys
+ """
+ model_arg_keys = model_args.keys()
+ discarded_args = set()
+ # arguments passed to self were already converted to python names
+ # before __init__ was called
+ for instance in composed_instances:
+ if instance.__class__ in self._composed_schemas['allOf']:
+ try:
+ keys = instance.to_dict().keys()
+ discarded_keys = model_args - keys
+ discarded_args.update(discarded_keys)
+ except Exception:
+ # allOf integer schema will throw exception
+ pass
+ else:
+ try:
+ all_keys = set(model_to_dict(instance, serialize=False).keys())
+ js_keys = model_to_dict(instance, serialize=True).keys()
+ all_keys.update(js_keys)
+ discarded_keys = model_arg_keys - all_keys
+ discarded_args.update(discarded_keys)
+ except Exception:
+ # allOf integer schema will throw exception
+ pass
+ return discarded_args
+
+
+def validate_get_composed_info(constant_args, model_args, self):
+ """
+ For composed schemas, generate schema instances for
+ all schemas in the oneOf/anyOf/allOf definition. If additional
+ properties are allowed, also assign those properties on
+ all matched schemas that contain additionalProperties.
+ Openapi schemas are python classes.
+
+ Exceptions are raised if:
+ - 0 or > 1 oneOf schema matches the model_args input data
+ - no anyOf schema matches the model_args input data
+ - any of the allOf schemas do not match the model_args input data
+
+ Args:
+ constant_args (dict): these are the args that every model requires
+ model_args (dict): these are the required and optional spec args that
+ were passed in to make this model
+ self (class): the class that we are instantiating
+ This class contains self._composed_schemas
+
+ Returns:
+ composed_info (list): length three
+ composed_instances (list): the composed instances which are not
+ self
+ var_name_to_model_instances (dict): a dict going from var_name
+ to the model_instance which holds that var_name
+ the model_instance may be self or an instance of one of the
+ classes in self.composed_instances()
+ additional_properties_model_instances (list): a list of the
+ model instances which have the property
+ additional_properties_type. This list can include self
+ """
+ # create composed_instances
+ composed_instances = []
+ allof_instances = get_allof_instances(self, model_args, constant_args)
+ composed_instances.extend(allof_instances)
+ oneof_instance = get_oneof_instance(self.__class__, model_args, constant_args)
+ if oneof_instance is not None:
+ composed_instances.append(oneof_instance)
+ anyof_instances = get_anyof_instances(self, model_args, constant_args)
+ composed_instances.extend(anyof_instances)
+ """
+ set additional_properties_model_instances
+ additional properties must be evaluated at the schema level
+ so self's additional properties are most important
+ If self is a composed schema with:
+ - no properties defined in self
+ - additionalProperties: False
+ Then for object payloads every property is an additional property
+ and they are not allowed, so only empty dict is allowed
+
+ Properties must be set on all matching schemas
+ so when a property is assigned toa composed instance, it must be set on all
+ composed instances regardless of additionalProperties presence
+ keeping it to prevent breaking changes in v5.0.1
+ TODO remove cls._additional_properties_model_instances in 6.0.0
+ """
+ additional_properties_model_instances = []
+ if self.additional_properties_type is not None:
+ additional_properties_model_instances = [self]
+
+ """
+ no need to set properties on self in here, they will be set in __init__
+ By here all composed schema oneOf/anyOf/allOf instances have their properties set using
+ model_args
+ """
+ discarded_args = get_discarded_args(self, composed_instances, model_args)
+
+ # map variable names to composed_instances
+ var_name_to_model_instances = {}
+ for prop_name in model_args:
+ if prop_name not in discarded_args:
+ var_name_to_model_instances[prop_name] = [self] + composed_instances
+
+ return [
+ composed_instances,
+ var_name_to_model_instances,
+ additional_properties_model_instances,
+ discarded_args
+ ]
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/models/__init__.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/models/__init__.py
new file mode 100644
index 000000000000..361e2bd9766c
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/models/__init__.py
@@ -0,0 +1,74 @@
+# flake8: noqa
+
+# import all models into this package
+# if you have many models here with many references from one model to another this may
+# raise a RecursionError
+# to avoid this, import only the models that you directly need like:
+# from from petstore_api.model.pet import Pet
+# or import this package, but before doing it, use:
+# import sys
+# sys.setrecursionlimit(n)
+
+from petstore_api.model.additional_properties_any_type import AdditionalPropertiesAnyType
+from petstore_api.model.additional_properties_array import AdditionalPropertiesArray
+from petstore_api.model.additional_properties_boolean import AdditionalPropertiesBoolean
+from petstore_api.model.additional_properties_class import AdditionalPropertiesClass
+from petstore_api.model.additional_properties_integer import AdditionalPropertiesInteger
+from petstore_api.model.additional_properties_number import AdditionalPropertiesNumber
+from petstore_api.model.additional_properties_object import AdditionalPropertiesObject
+from petstore_api.model.additional_properties_string import AdditionalPropertiesString
+from petstore_api.model.animal import Animal
+from petstore_api.model.animal_farm import AnimalFarm
+from petstore_api.model.api_response import ApiResponse
+from petstore_api.model.array_of_array_of_number_only import ArrayOfArrayOfNumberOnly
+from petstore_api.model.array_of_number_only import ArrayOfNumberOnly
+from petstore_api.model.array_test import ArrayTest
+from petstore_api.model.capitalization import Capitalization
+from petstore_api.model.cat import Cat
+from petstore_api.model.cat_all_of import CatAllOf
+from petstore_api.model.category import Category
+from petstore_api.model.child import Child
+from petstore_api.model.child_all_of import ChildAllOf
+from petstore_api.model.child_cat import ChildCat
+from petstore_api.model.child_cat_all_of import ChildCatAllOf
+from petstore_api.model.child_dog import ChildDog
+from petstore_api.model.child_dog_all_of import ChildDogAllOf
+from petstore_api.model.child_lizard import ChildLizard
+from petstore_api.model.child_lizard_all_of import ChildLizardAllOf
+from petstore_api.model.class_model import ClassModel
+from petstore_api.model.client import Client
+from petstore_api.model.dog import Dog
+from petstore_api.model.dog_all_of import DogAllOf
+from petstore_api.model.enum_arrays import EnumArrays
+from petstore_api.model.enum_class import EnumClass
+from petstore_api.model.enum_test import EnumTest
+from petstore_api.model.file import File
+from petstore_api.model.file_schema_test_class import FileSchemaTestClass
+from petstore_api.model.format_test import FormatTest
+from petstore_api.model.grandparent import Grandparent
+from petstore_api.model.grandparent_animal import GrandparentAnimal
+from petstore_api.model.has_only_read_only import HasOnlyReadOnly
+from petstore_api.model.list import List
+from petstore_api.model.map_test import MapTest
+from petstore_api.model.mixed_properties_and_additional_properties_class import MixedPropertiesAndAdditionalPropertiesClass
+from petstore_api.model.model200_response import Model200Response
+from petstore_api.model.model_return import ModelReturn
+from petstore_api.model.name import Name
+from petstore_api.model.number_only import NumberOnly
+from petstore_api.model.number_with_validations import NumberWithValidations
+from petstore_api.model.object_model_with_ref_props import ObjectModelWithRefProps
+from petstore_api.model.order import Order
+from petstore_api.model.parent import Parent
+from petstore_api.model.parent_all_of import ParentAllOf
+from petstore_api.model.parent_pet import ParentPet
+from petstore_api.model.pet import Pet
+from petstore_api.model.player import Player
+from petstore_api.model.read_only_first import ReadOnlyFirst
+from petstore_api.model.special_model_name import SpecialModelName
+from petstore_api.model.string_boolean_map import StringBooleanMap
+from petstore_api.model.string_enum import StringEnum
+from petstore_api.model.tag import Tag
+from petstore_api.model.type_holder_default import TypeHolderDefault
+from petstore_api.model.type_holder_example import TypeHolderExample
+from petstore_api.model.user import User
+from petstore_api.model.xml_item import XmlItem
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/rest.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/rest.py
new file mode 100644
index 000000000000..a1d580fbe05b
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/rest.py
@@ -0,0 +1,292 @@
+"""
+ 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: https://openapi-generator.tech
+"""
+
+
+import io
+import json
+import logging
+import re
+import ssl
+from urllib.parse import urlencode
+
+import urllib3
+
+from petstore_api.exceptions import ApiException, UnauthorizedException, ForbiddenException, NotFoundException, ServiceException, ApiValueError
+
+
+logger = logging.getLogger(__name__)
+
+
+class RESTResponse(io.IOBase):
+
+ def __init__(self, resp):
+ self.urllib3_response = resp
+ self.status = resp.status
+ self.reason = resp.reason
+ self.data = resp.data
+
+ def getheaders(self):
+ """Returns a dictionary of the response headers."""
+ return self.urllib3_response.getheaders()
+
+ def getheader(self, name, default=None):
+ """Returns a given response header."""
+ return self.urllib3_response.getheader(name, default)
+
+
+class RESTClientObject(object):
+
+ def __init__(self, configuration, pools_size=4, maxsize=None):
+ # urllib3.PoolManager will pass all kw parameters to connectionpool
+ # https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/poolmanager.py#L75 # noqa: E501
+ # https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/connectionpool.py#L680 # noqa: E501
+ # maxsize is the number of requests to host that are allowed in parallel # noqa: E501
+ # Custom SSL certificates and client certificates: http://urllib3.readthedocs.io/en/latest/advanced-usage.html # noqa: E501
+
+ # cert_reqs
+ if configuration.verify_ssl:
+ cert_reqs = ssl.CERT_REQUIRED
+ else:
+ cert_reqs = ssl.CERT_NONE
+
+ addition_pool_args = {}
+ if configuration.assert_hostname is not None:
+ addition_pool_args['assert_hostname'] = configuration.assert_hostname # noqa: E501
+
+ if configuration.retries is not None:
+ addition_pool_args['retries'] = configuration.retries
+
+ if configuration.socket_options is not None:
+ addition_pool_args['socket_options'] = configuration.socket_options
+
+ if maxsize is None:
+ if configuration.connection_pool_maxsize is not None:
+ maxsize = configuration.connection_pool_maxsize
+ else:
+ maxsize = 4
+
+ # https pool manager
+ if configuration.proxy:
+ self.pool_manager = urllib3.ProxyManager(
+ num_pools=pools_size,
+ maxsize=maxsize,
+ cert_reqs=cert_reqs,
+ ca_certs=configuration.ssl_ca_cert,
+ cert_file=configuration.cert_file,
+ key_file=configuration.key_file,
+ proxy_url=configuration.proxy,
+ proxy_headers=configuration.proxy_headers,
+ **addition_pool_args
+ )
+ else:
+ self.pool_manager = urllib3.PoolManager(
+ num_pools=pools_size,
+ maxsize=maxsize,
+ cert_reqs=cert_reqs,
+ ca_certs=configuration.ssl_ca_cert,
+ cert_file=configuration.cert_file,
+ key_file=configuration.key_file,
+ **addition_pool_args
+ )
+
+ def request(self, method, url, query_params=None, headers=None,
+ body=None, post_params=None, _preload_content=True,
+ _request_timeout=None):
+ """Perform requests.
+
+ :param method: http request method
+ :param url: http request url
+ :param query_params: query parameters in the url
+ :param headers: http request headers
+ :param body: request json body, for `application/json`
+ :param post_params: request post parameters,
+ `application/x-www-form-urlencoded`
+ and `multipart/form-data`
+ :param _preload_content: if False, the urllib3.HTTPResponse object will
+ be returned without reading/decoding response
+ data. Default is True.
+ :param _request_timeout: timeout setting for this request. If one
+ number provided, it will be total request
+ timeout. It can also be a pair (tuple) of
+ (connection, read) timeouts.
+ """
+ method = method.upper()
+ assert method in ['GET', 'HEAD', 'DELETE', 'POST', 'PUT',
+ 'PATCH', 'OPTIONS']
+
+ if post_params and body:
+ raise ApiValueError(
+ "body parameter cannot be used with post_params parameter."
+ )
+
+ post_params = post_params or {}
+ headers = headers or {}
+
+ timeout = None
+ if _request_timeout:
+ if isinstance(_request_timeout, (int, float)): # noqa: E501,F821
+ timeout = urllib3.Timeout(total=_request_timeout)
+ elif (isinstance(_request_timeout, tuple) and
+ len(_request_timeout) == 2):
+ timeout = urllib3.Timeout(
+ connect=_request_timeout[0], read=_request_timeout[1])
+
+ if 'Content-Type' not in headers:
+ headers['Content-Type'] = 'application/json'
+
+ try:
+ # For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE`
+ if method in ['POST', 'PUT', 'PATCH', 'OPTIONS', 'DELETE']:
+ if query_params:
+ url += '?' + urlencode(query_params)
+ if re.search('json', headers['Content-Type'], re.IGNORECASE):
+ request_body = None
+ if body is not None:
+ request_body = json.dumps(body)
+ r = self.pool_manager.request(
+ method, url,
+ body=request_body,
+ preload_content=_preload_content,
+ timeout=timeout,
+ headers=headers)
+ elif headers['Content-Type'] == 'application/x-www-form-urlencoded': # noqa: E501
+ r = self.pool_manager.request(
+ method, url,
+ fields=post_params,
+ encode_multipart=False,
+ preload_content=_preload_content,
+ timeout=timeout,
+ headers=headers)
+ elif headers['Content-Type'] == 'multipart/form-data':
+ # must del headers['Content-Type'], or the correct
+ # Content-Type which generated by urllib3 will be
+ # overwritten.
+ del headers['Content-Type']
+ r = self.pool_manager.request(
+ method, url,
+ fields=post_params,
+ encode_multipart=True,
+ preload_content=_preload_content,
+ timeout=timeout,
+ headers=headers)
+ # Pass a `string` parameter directly in the body to support
+ # other content types than Json when `body` argument is
+ # provided in serialized form
+ elif isinstance(body, str) or isinstance(body, bytes):
+ request_body = body
+ r = self.pool_manager.request(
+ method, url,
+ body=request_body,
+ preload_content=_preload_content,
+ timeout=timeout,
+ headers=headers)
+ else:
+ # Cannot generate the request from given parameters
+ msg = """Cannot prepare a request message for provided
+ arguments. Please check that your arguments match
+ declared content type."""
+ raise ApiException(status=0, reason=msg)
+ # For `GET`, `HEAD`
+ else:
+ r = self.pool_manager.request(method, url,
+ fields=query_params,
+ preload_content=_preload_content,
+ timeout=timeout,
+ headers=headers)
+ except urllib3.exceptions.SSLError as e:
+ msg = "{0}\n{1}".format(type(e).__name__, str(e))
+ raise ApiException(status=0, reason=msg)
+
+ if _preload_content:
+ r = RESTResponse(r)
+
+ # log response body
+ logger.debug("response body: %s", r.data)
+
+ if not 200 <= r.status <= 299:
+ if r.status == 401:
+ raise UnauthorizedException(http_resp=r)
+
+ if r.status == 403:
+ raise ForbiddenException(http_resp=r)
+
+ if r.status == 404:
+ raise NotFoundException(http_resp=r)
+
+ if 500 <= r.status <= 599:
+ raise ServiceException(http_resp=r)
+
+ raise ApiException(http_resp=r)
+
+ return r
+
+ def GET(self, url, headers=None, query_params=None, _preload_content=True,
+ _request_timeout=None):
+ return self.request("GET", url,
+ headers=headers,
+ _preload_content=_preload_content,
+ _request_timeout=_request_timeout,
+ query_params=query_params)
+
+ def HEAD(self, url, headers=None, query_params=None, _preload_content=True,
+ _request_timeout=None):
+ return self.request("HEAD", url,
+ headers=headers,
+ _preload_content=_preload_content,
+ _request_timeout=_request_timeout,
+ query_params=query_params)
+
+ def OPTIONS(self, url, headers=None, query_params=None, post_params=None,
+ body=None, _preload_content=True, _request_timeout=None):
+ return self.request("OPTIONS", url,
+ headers=headers,
+ query_params=query_params,
+ post_params=post_params,
+ _preload_content=_preload_content,
+ _request_timeout=_request_timeout,
+ body=body)
+
+ def DELETE(self, url, headers=None, query_params=None, body=None,
+ _preload_content=True, _request_timeout=None):
+ return self.request("DELETE", url,
+ headers=headers,
+ query_params=query_params,
+ _preload_content=_preload_content,
+ _request_timeout=_request_timeout,
+ body=body)
+
+ def POST(self, url, headers=None, query_params=None, post_params=None,
+ body=None, _preload_content=True, _request_timeout=None):
+ return self.request("POST", url,
+ headers=headers,
+ query_params=query_params,
+ post_params=post_params,
+ _preload_content=_preload_content,
+ _request_timeout=_request_timeout,
+ body=body)
+
+ def PUT(self, url, headers=None, query_params=None, post_params=None,
+ body=None, _preload_content=True, _request_timeout=None):
+ return self.request("PUT", url,
+ headers=headers,
+ query_params=query_params,
+ post_params=post_params,
+ _preload_content=_preload_content,
+ _request_timeout=_request_timeout,
+ body=body)
+
+ def PATCH(self, url, headers=None, query_params=None, post_params=None,
+ body=None, _preload_content=True, _request_timeout=None):
+ return self.request("PATCH", url,
+ headers=headers,
+ query_params=query_params,
+ post_params=post_params,
+ _preload_content=_preload_content,
+ _request_timeout=_request_timeout,
+ body=body)
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/pom.xml b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/pom.xml
new file mode 100644
index 000000000000..1db0285b1812
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/pom.xml
@@ -0,0 +1,46 @@
+
+ 4.0.0
+ org.openapitools
+ PythonV2PetstoreClientTestsDisallowAdditionalPropertiesIfNotPresent
+ pom
+ 1.0-SNAPSHOT
+ Python OpenAPI Petstore Client
+
+
+
+ maven-dependency-plugin
+
+
+ package
+
+ copy-dependencies
+
+
+ ${project.build.directory}
+
+
+
+
+
+ org.codehaus.mojo
+ exec-maven-plugin
+ 1.2.1
+
+
+ test
+ integration-test
+
+ exec
+
+
+ make
+
+ test
+
+
+
+
+
+
+
+
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/requirements.txt b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/requirements.txt
new file mode 100644
index 000000000000..96947f60408f
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/requirements.txt
@@ -0,0 +1,3 @@
+python_dateutil >= 2.5.3
+setuptools >= 21.0.0
+urllib3 >= 1.25.3
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/setup.cfg b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/setup.cfg
new file mode 100644
index 000000000000..11433ee875ab
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/setup.cfg
@@ -0,0 +1,2 @@
+[flake8]
+max-line-length=99
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/setup.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/setup.py
new file mode 100644
index 000000000000..c484eec94f36
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/setup.py
@@ -0,0 +1,43 @@
+"""
+ 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: https://openapi-generator.tech
+"""
+
+
+from setuptools import setup, find_packages # noqa: H301
+
+NAME = "petstore-api"
+VERSION = "1.0.0"
+# To install the library, run the following
+#
+# python setup.py install
+#
+# prerequisite: setuptools
+# http://pypi.python.org/pypi/setuptools
+
+REQUIRES = [
+ "urllib3 >= 1.25.3",
+ "python-dateutil",
+]
+
+setup(
+ name=NAME,
+ version=VERSION,
+ description="OpenAPI Petstore",
+ author="OpenAPI Generator community",
+ author_email="team@openapitools.org",
+ url="",
+ keywords=["OpenAPI", "OpenAPI-Generator", "OpenAPI Petstore"],
+ python_requires=">=3.6",
+ install_requires=REQUIRES,
+ packages=find_packages(exclude=["test", "tests"]),
+ include_package_data=True,
+ license="Apache-2.0",
+ long_description="""\
+ 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
+ """
+)
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test-requirements.txt b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test-requirements.txt
new file mode 100644
index 000000000000..bb4f22bb7a6e
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test-requirements.txt
@@ -0,0 +1 @@
+pytest-cov>=2.8.1
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/__init__.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/__init__.py
new file mode 100644
index 000000000000..e69de29bb2d1
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_additional_properties_any_type.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_additional_properties_any_type.py
new file mode 100644
index 000000000000..ce985f76ed9e
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_additional_properties_any_type.py
@@ -0,0 +1,38 @@
+# 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: https://openapi-generator.tech
+"""
+
+
+from __future__ import absolute_import
+import sys
+import unittest
+
+import petstore_api
+from petstore_api.model.additional_properties_any_type import AdditionalPropertiesAnyType
+
+
+class TestAdditionalPropertiesAnyType(unittest.TestCase):
+ """AdditionalPropertiesAnyType unit test stubs"""
+
+ def setUp(self):
+ pass
+
+ def tearDown(self):
+ pass
+
+ def testAdditionalPropertiesAnyType(self):
+ """Test AdditionalPropertiesAnyType"""
+ # FIXME: construct object with mandatory attributes with example values
+ # model = AdditionalPropertiesAnyType() # noqa: E501
+ pass
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_additional_properties_array.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_additional_properties_array.py
new file mode 100644
index 000000000000..f63ca82f6c22
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_additional_properties_array.py
@@ -0,0 +1,50 @@
+# 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: https://openapi-generator.tech
+"""
+
+
+from __future__ import absolute_import
+import sys
+import unittest
+
+import petstore_api
+from petstore_api.model.additional_properties_array import AdditionalPropertiesArray
+
+
+class TestAdditionalPropertiesArray(unittest.TestCase):
+ """AdditionalPropertiesArray unit test stubs"""
+
+ def setUp(self):
+ pass
+
+ def tearDown(self):
+ pass
+
+ def testAdditionalPropertiesArray(self):
+ """Test AdditionalPropertiesArray"""
+ # can make model without additional properties
+ model = AdditionalPropertiesArray()
+
+ # can make one with additional properties
+ import datetime
+ some_val = []
+ model = AdditionalPropertiesArray(some_key=some_val)
+ assert model['some_key'] == some_val
+ some_val = [True, datetime.date(1970,1,1), datetime.datetime(1970,1,1), {}, 3.1, 1, [], 'hello']
+ model = AdditionalPropertiesArray(some_key=some_val)
+ assert model['some_key'] == some_val
+
+ # type checking works on additional properties
+ with self.assertRaises(petstore_api.ApiTypeError) as exc:
+ model = AdditionalPropertiesArray(some_key='some string')
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_additional_properties_boolean.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_additional_properties_boolean.py
new file mode 100644
index 000000000000..e5a13891c098
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_additional_properties_boolean.py
@@ -0,0 +1,45 @@
+# 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: https://openapi-generator.tech
+"""
+
+
+from __future__ import absolute_import
+import sys
+import unittest
+
+import petstore_api
+from petstore_api.model.additional_properties_boolean import AdditionalPropertiesBoolean
+
+
+class TestAdditionalPropertiesBoolean(unittest.TestCase):
+ """AdditionalPropertiesBoolean unit test stubs"""
+
+ def setUp(self):
+ pass
+
+ def tearDown(self):
+ pass
+
+ def testAdditionalPropertiesBoolean(self):
+ """Test AdditionalPropertiesBoolean"""
+ # can make model without additional properties
+ model = AdditionalPropertiesBoolean()
+
+ # can make one with additional properties
+ model = AdditionalPropertiesBoolean(some_key=True)
+ assert model['some_key'] == True
+
+ # type checking works on additional properties
+ with self.assertRaises(petstore_api.ApiTypeError) as exc:
+ model = AdditionalPropertiesBoolean(some_key='True')
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_additional_properties_class.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_additional_properties_class.py
new file mode 100644
index 000000000000..befc14455da2
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_additional_properties_class.py
@@ -0,0 +1,38 @@
+# 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: https://openapi-generator.tech
+"""
+
+
+from __future__ import absolute_import
+import sys
+import unittest
+
+import petstore_api
+from petstore_api.model.additional_properties_class import AdditionalPropertiesClass
+
+
+class TestAdditionalPropertiesClass(unittest.TestCase):
+ """AdditionalPropertiesClass unit test stubs"""
+
+ def setUp(self):
+ pass
+
+ def tearDown(self):
+ pass
+
+ def testAdditionalPropertiesClass(self):
+ """Test AdditionalPropertiesClass"""
+ # FIXME: construct object with mandatory attributes with example values
+ # model = AdditionalPropertiesClass() # noqa: E501
+ pass
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_additional_properties_integer.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_additional_properties_integer.py
new file mode 100644
index 000000000000..0e08b8f87706
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_additional_properties_integer.py
@@ -0,0 +1,45 @@
+# 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: https://openapi-generator.tech
+"""
+
+
+from __future__ import absolute_import
+import sys
+import unittest
+
+import petstore_api
+from petstore_api.model.additional_properties_integer import AdditionalPropertiesInteger
+
+
+class TestAdditionalPropertiesInteger(unittest.TestCase):
+ """AdditionalPropertiesInteger unit test stubs"""
+
+ def setUp(self):
+ pass
+
+ def tearDown(self):
+ pass
+
+ def testAdditionalPropertiesInteger(self):
+ """Test AdditionalPropertiesInteger"""
+ # can make model without additional properties
+ model = AdditionalPropertiesInteger()
+
+ # can make one with additional properties
+ model = AdditionalPropertiesInteger(some_key=3)
+ assert model['some_key'] == 3
+
+ # type checking works on additional properties
+ with self.assertRaises(petstore_api.ApiTypeError) as exc:
+ model = AdditionalPropertiesInteger(some_key=11.3)
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_additional_properties_number.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_additional_properties_number.py
new file mode 100644
index 000000000000..90f4429e989f
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_additional_properties_number.py
@@ -0,0 +1,45 @@
+# 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: https://openapi-generator.tech
+"""
+
+
+from __future__ import absolute_import
+import sys
+import unittest
+
+import petstore_api
+from petstore_api.model.additional_properties_number import AdditionalPropertiesNumber
+
+
+class TestAdditionalPropertiesNumber(unittest.TestCase):
+ """AdditionalPropertiesNumber unit test stubs"""
+
+ def setUp(self):
+ pass
+
+ def tearDown(self):
+ pass
+
+ def testAdditionalPropertiesNumber(self):
+ """Test AdditionalPropertiesNumber"""
+ # can make model without additional properties
+ model = AdditionalPropertiesNumber()
+
+ # can make one with additional properties
+ model = AdditionalPropertiesNumber(some_key=11.3)
+ assert model['some_key'] == 11.3
+
+ # type checking works on additional properties
+ with self.assertRaises(petstore_api.ApiTypeError) as exc:
+ model = AdditionalPropertiesNumber(some_key=10)
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_additional_properties_object.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_additional_properties_object.py
new file mode 100644
index 000000000000..ded4a8e8a124
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_additional_properties_object.py
@@ -0,0 +1,50 @@
+# 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: https://openapi-generator.tech
+"""
+
+
+from __future__ import absolute_import
+import sys
+import unittest
+
+import petstore_api
+from petstore_api.model.additional_properties_object import AdditionalPropertiesObject
+
+
+class TestAdditionalPropertiesObject(unittest.TestCase):
+ """AdditionalPropertiesObject unit test stubs"""
+
+ def setUp(self):
+ pass
+
+ def tearDown(self):
+ pass
+
+ def testAdditionalPropertiesObject(self):
+ """Test AdditionalPropertiesObject"""
+ # can make model without additional properties
+ model = AdditionalPropertiesObject()
+
+ # can make one with additional properties
+ some_val = {}
+ model = AdditionalPropertiesObject(some_key=some_val)
+ assert model['some_key'] == some_val
+ import datetime
+ some_val = {'a': True, 'b': datetime.date(1970,1,1), 'c': datetime.datetime(1970,1,1), 'd': {}, 'e': 3.1, 'f': 1, 'g': [], 'h': 'hello'}
+ model = AdditionalPropertiesObject(some_key=some_val)
+ assert model['some_key'] == some_val
+
+ # type checking works on additional properties
+ with self.assertRaises(petstore_api.ApiTypeError) as exc:
+ model = AdditionalPropertiesObject(some_key='some string')
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_additional_properties_string.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_additional_properties_string.py
new file mode 100644
index 000000000000..cff2c31921fe
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_additional_properties_string.py
@@ -0,0 +1,45 @@
+# 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: https://openapi-generator.tech
+"""
+
+
+from __future__ import absolute_import
+import sys
+import unittest
+
+import petstore_api
+from petstore_api.model.additional_properties_string import AdditionalPropertiesString
+
+
+class TestAdditionalPropertiesString(unittest.TestCase):
+ """AdditionalPropertiesString unit test stubs"""
+
+ def setUp(self):
+ pass
+
+ def tearDown(self):
+ pass
+
+ def testAdditionalPropertiesString(self):
+ """Test AdditionalPropertiesString"""
+ # can make model without additional properties
+ model = AdditionalPropertiesString()
+
+ # can make one with additional properties
+ model = AdditionalPropertiesString(some_key='some_val')
+ assert model['some_key'] == 'some_val'
+
+ # type checking works on additional properties
+ with self.assertRaises(petstore_api.ApiTypeError) as exc:
+ model = AdditionalPropertiesString(some_key=True)
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_animal.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_animal.py
new file mode 100644
index 000000000000..958f303f13e3
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_animal.py
@@ -0,0 +1,48 @@
+# 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: https://openapi-generator.tech
+"""
+
+
+from __future__ import absolute_import
+import sys
+import unittest
+
+import petstore_api
+try:
+ from petstore_api.model import cat
+except ImportError:
+ cat = sys.modules[
+ 'petstore_api.model.cat']
+try:
+ from petstore_api.model import dog
+except ImportError:
+ dog = sys.modules[
+ 'petstore_api.model.dog']
+from petstore_api.model.animal import Animal
+
+
+class TestAnimal(unittest.TestCase):
+ """Animal unit test stubs"""
+
+ def setUp(self):
+ pass
+
+ def tearDown(self):
+ pass
+
+ def testAnimal(self):
+ """Test Animal"""
+ # FIXME: construct object with mandatory attributes with example values
+ # model = Animal() # noqa: E501
+ pass
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_animal_farm.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_animal_farm.py
new file mode 100644
index 000000000000..7117d42b430e
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_animal_farm.py
@@ -0,0 +1,43 @@
+# 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: https://openapi-generator.tech
+"""
+
+
+from __future__ import absolute_import
+import sys
+import unittest
+
+import petstore_api
+try:
+ from petstore_api.model import animal
+except ImportError:
+ animal = sys.modules[
+ 'petstore_api.model.animal']
+from petstore_api.model.animal_farm import AnimalFarm
+
+
+class TestAnimalFarm(unittest.TestCase):
+ """AnimalFarm unit test stubs"""
+
+ def setUp(self):
+ pass
+
+ def tearDown(self):
+ pass
+
+ def testAnimalFarm(self):
+ """Test AnimalFarm"""
+ # FIXME: construct object with mandatory attributes with example values
+ # model = AnimalFarm() # noqa: E501
+ pass
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_another_fake_api.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_another_fake_api.py
new file mode 100644
index 000000000000..f79966a26961
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_another_fake_api.py
@@ -0,0 +1,39 @@
+# 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: https://openapi-generator.tech
+"""
+
+
+from __future__ import absolute_import
+
+import unittest
+
+import petstore_api
+from petstore_api.api.another_fake_api import AnotherFakeApi # noqa: E501
+
+
+class TestAnotherFakeApi(unittest.TestCase):
+ """AnotherFakeApi unit test stubs"""
+
+ def setUp(self):
+ self.api = AnotherFakeApi() # noqa: E501
+
+ def tearDown(self):
+ pass
+
+ def test_call_123_test_special_tags(self):
+ """Test case for call_123_test_special_tags
+
+ To test special tags # noqa: E501
+ """
+ pass
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_api_response.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_api_response.py
new file mode 100644
index 000000000000..9db92633f626
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_api_response.py
@@ -0,0 +1,38 @@
+# 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: https://openapi-generator.tech
+"""
+
+
+from __future__ import absolute_import
+import sys
+import unittest
+
+import petstore_api
+from petstore_api.model.api_response import ApiResponse
+
+
+class TestApiResponse(unittest.TestCase):
+ """ApiResponse unit test stubs"""
+
+ def setUp(self):
+ pass
+
+ def tearDown(self):
+ pass
+
+ def testApiResponse(self):
+ """Test ApiResponse"""
+ # FIXME: construct object with mandatory attributes with example values
+ # model = ApiResponse() # noqa: E501
+ pass
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_array_of_array_of_number_only.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_array_of_array_of_number_only.py
new file mode 100644
index 000000000000..4980ad17afb5
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_array_of_array_of_number_only.py
@@ -0,0 +1,38 @@
+# 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: https://openapi-generator.tech
+"""
+
+
+from __future__ import absolute_import
+import sys
+import unittest
+
+import petstore_api
+from petstore_api.model.array_of_array_of_number_only import ArrayOfArrayOfNumberOnly
+
+
+class TestArrayOfArrayOfNumberOnly(unittest.TestCase):
+ """ArrayOfArrayOfNumberOnly unit test stubs"""
+
+ def setUp(self):
+ pass
+
+ def tearDown(self):
+ pass
+
+ def testArrayOfArrayOfNumberOnly(self):
+ """Test ArrayOfArrayOfNumberOnly"""
+ # FIXME: construct object with mandatory attributes with example values
+ # model = ArrayOfArrayOfNumberOnly() # noqa: E501
+ pass
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_array_of_number_only.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_array_of_number_only.py
new file mode 100644
index 000000000000..479c537cada7
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_array_of_number_only.py
@@ -0,0 +1,38 @@
+# 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: https://openapi-generator.tech
+"""
+
+
+from __future__ import absolute_import
+import sys
+import unittest
+
+import petstore_api
+from petstore_api.model.array_of_number_only import ArrayOfNumberOnly
+
+
+class TestArrayOfNumberOnly(unittest.TestCase):
+ """ArrayOfNumberOnly unit test stubs"""
+
+ def setUp(self):
+ pass
+
+ def tearDown(self):
+ pass
+
+ def testArrayOfNumberOnly(self):
+ """Test ArrayOfNumberOnly"""
+ # FIXME: construct object with mandatory attributes with example values
+ # model = ArrayOfNumberOnly() # noqa: E501
+ pass
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_array_test.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_array_test.py
new file mode 100644
index 000000000000..2426b27b7e46
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_array_test.py
@@ -0,0 +1,43 @@
+# 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: https://openapi-generator.tech
+"""
+
+
+from __future__ import absolute_import
+import sys
+import unittest
+
+import petstore_api
+try:
+ from petstore_api.model import read_only_first
+except ImportError:
+ read_only_first = sys.modules[
+ 'petstore_api.model.read_only_first']
+from petstore_api.model.array_test import ArrayTest
+
+
+class TestArrayTest(unittest.TestCase):
+ """ArrayTest unit test stubs"""
+
+ def setUp(self):
+ pass
+
+ def tearDown(self):
+ pass
+
+ def testArrayTest(self):
+ """Test ArrayTest"""
+ # FIXME: construct object with mandatory attributes with example values
+ # model = ArrayTest() # noqa: E501
+ pass
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_capitalization.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_capitalization.py
new file mode 100644
index 000000000000..20d2649c01eb
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_capitalization.py
@@ -0,0 +1,38 @@
+# 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: https://openapi-generator.tech
+"""
+
+
+from __future__ import absolute_import
+import sys
+import unittest
+
+import petstore_api
+from petstore_api.model.capitalization import Capitalization
+
+
+class TestCapitalization(unittest.TestCase):
+ """Capitalization unit test stubs"""
+
+ def setUp(self):
+ pass
+
+ def tearDown(self):
+ pass
+
+ def testCapitalization(self):
+ """Test Capitalization"""
+ # FIXME: construct object with mandatory attributes with example values
+ # model = Capitalization() # noqa: E501
+ pass
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_cat.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_cat.py
new file mode 100644
index 000000000000..64b525aaf118
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_cat.py
@@ -0,0 +1,48 @@
+# 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: https://openapi-generator.tech
+"""
+
+
+from __future__ import absolute_import
+import sys
+import unittest
+
+import petstore_api
+try:
+ from petstore_api.model import animal
+except ImportError:
+ animal = sys.modules[
+ 'petstore_api.model.animal']
+try:
+ from petstore_api.model import cat_all_of
+except ImportError:
+ cat_all_of = sys.modules[
+ 'petstore_api.model.cat_all_of']
+from petstore_api.model.cat import Cat
+
+
+class TestCat(unittest.TestCase):
+ """Cat unit test stubs"""
+
+ def setUp(self):
+ pass
+
+ def tearDown(self):
+ pass
+
+ def testCat(self):
+ """Test Cat"""
+ # FIXME: construct object with mandatory attributes with example values
+ # model = Cat() # noqa: E501
+ pass
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_cat_all_of.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_cat_all_of.py
new file mode 100644
index 000000000000..a5bb91ac864e
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_cat_all_of.py
@@ -0,0 +1,38 @@
+# 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: https://openapi-generator.tech
+"""
+
+
+from __future__ import absolute_import
+import sys
+import unittest
+
+import petstore_api
+from petstore_api.model.cat_all_of import CatAllOf
+
+
+class TestCatAllOf(unittest.TestCase):
+ """CatAllOf unit test stubs"""
+
+ def setUp(self):
+ pass
+
+ def tearDown(self):
+ pass
+
+ def testCatAllOf(self):
+ """Test CatAllOf"""
+ # FIXME: construct object with mandatory attributes with example values
+ # model = CatAllOf() # noqa: E501
+ pass
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_category.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_category.py
new file mode 100644
index 000000000000..59b64e5924a8
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_category.py
@@ -0,0 +1,38 @@
+# 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: https://openapi-generator.tech
+"""
+
+
+from __future__ import absolute_import
+import sys
+import unittest
+
+import petstore_api
+from petstore_api.model.category import Category
+
+
+class TestCategory(unittest.TestCase):
+ """Category unit test stubs"""
+
+ def setUp(self):
+ pass
+
+ def tearDown(self):
+ pass
+
+ def testCategory(self):
+ """Test Category"""
+ # FIXME: construct object with mandatory attributes with example values
+ # model = Category() # noqa: E501
+ pass
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_child.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_child.py
new file mode 100644
index 000000000000..790fc1abc8da
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_child.py
@@ -0,0 +1,57 @@
+# 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: https://openapi-generator.tech
+"""
+
+
+from __future__ import absolute_import
+import sys
+import unittest
+
+import petstore_api
+try:
+ from petstore_api.model import child_all_of
+except ImportError:
+ child_all_of = sys.modules[
+ 'petstore_api.model.child_all_of']
+try:
+ from petstore_api.model import parent
+except ImportError:
+ parent = sys.modules[
+ 'petstore_api.model.parent']
+from petstore_api.model.child import Child
+
+
+class TestChild(unittest.TestCase):
+ """Child unit test stubs"""
+
+ def setUp(self):
+ pass
+
+ def tearDown(self):
+ pass
+
+ def testChild(self):
+ """Test Child
+ This will fail because additional_properties_type is None in ChildAllOf and it must be defined as any type
+ to allow in the property radio_waves which is not defined in ChildAllOf, it is defined in Grandparent
+ """
+ # make an instance of Child, a composed schema model
+ radio_waves = True
+ tele_vision = True
+ inter_net = True
+ with self.assertRaises(petstore_api.exceptions.ApiValueError):
+ child = Child(
+ radio_waves=radio_waves,
+ tele_vision=tele_vision,
+ inter_net=inter_net
+ )
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_child_all_of.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_child_all_of.py
new file mode 100644
index 000000000000..96e479cf0796
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_child_all_of.py
@@ -0,0 +1,38 @@
+# 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: https://openapi-generator.tech
+"""
+
+
+from __future__ import absolute_import
+import sys
+import unittest
+
+import petstore_api
+from petstore_api.model.child_all_of import ChildAllOf
+
+
+class TestChildAllOf(unittest.TestCase):
+ """ChildAllOf unit test stubs"""
+
+ def setUp(self):
+ pass
+
+ def tearDown(self):
+ pass
+
+ def testChildAllOf(self):
+ """Test ChildAllOf"""
+ # FIXME: construct object with mandatory attributes with example values
+ # model = ChildAllOf() # noqa: E501
+ pass
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_child_cat.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_child_cat.py
new file mode 100644
index 000000000000..34c085515a80
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_child_cat.py
@@ -0,0 +1,48 @@
+# 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: https://openapi-generator.tech
+"""
+
+
+from __future__ import absolute_import
+import sys
+import unittest
+
+import petstore_api
+try:
+ from petstore_api.model import child_cat_all_of
+except ImportError:
+ child_cat_all_of = sys.modules[
+ 'petstore_api.model.child_cat_all_of']
+try:
+ from petstore_api.model import parent_pet
+except ImportError:
+ parent_pet = sys.modules[
+ 'petstore_api.model.parent_pet']
+from petstore_api.model.child_cat import ChildCat
+
+
+class TestChildCat(unittest.TestCase):
+ """ChildCat unit test stubs"""
+
+ def setUp(self):
+ pass
+
+ def tearDown(self):
+ pass
+
+ def testChildCat(self):
+ """Test ChildCat"""
+ # FIXME: construct object with mandatory attributes with example values
+ # model = ChildCat() # noqa: E501
+ pass
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_child_cat_all_of.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_child_cat_all_of.py
new file mode 100644
index 000000000000..2a7aab100fbf
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_child_cat_all_of.py
@@ -0,0 +1,38 @@
+# 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: https://openapi-generator.tech
+"""
+
+
+from __future__ import absolute_import
+import sys
+import unittest
+
+import petstore_api
+from petstore_api.model.child_cat_all_of import ChildCatAllOf
+
+
+class TestChildCatAllOf(unittest.TestCase):
+ """ChildCatAllOf unit test stubs"""
+
+ def setUp(self):
+ pass
+
+ def tearDown(self):
+ pass
+
+ def testChildCatAllOf(self):
+ """Test ChildCatAllOf"""
+ # FIXME: construct object with mandatory attributes with example values
+ # model = ChildCatAllOf() # noqa: E501
+ pass
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_child_dog.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_child_dog.py
new file mode 100644
index 000000000000..dfb09213e40c
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_child_dog.py
@@ -0,0 +1,48 @@
+# 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: https://openapi-generator.tech
+"""
+
+
+from __future__ import absolute_import
+import sys
+import unittest
+
+import petstore_api
+try:
+ from petstore_api.model import child_dog_all_of
+except ImportError:
+ child_dog_all_of = sys.modules[
+ 'petstore_api.model.child_dog_all_of']
+try:
+ from petstore_api.model import parent_pet
+except ImportError:
+ parent_pet = sys.modules[
+ 'petstore_api.model.parent_pet']
+from petstore_api.model.child_dog import ChildDog
+
+
+class TestChildDog(unittest.TestCase):
+ """ChildDog unit test stubs"""
+
+ def setUp(self):
+ pass
+
+ def tearDown(self):
+ pass
+
+ def testChildDog(self):
+ """Test ChildDog"""
+ # FIXME: construct object with mandatory attributes with example values
+ # model = ChildDog() # noqa: E501
+ pass
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_child_dog_all_of.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_child_dog_all_of.py
new file mode 100644
index 000000000000..ca75000c650e
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_child_dog_all_of.py
@@ -0,0 +1,38 @@
+# 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: https://openapi-generator.tech
+"""
+
+
+from __future__ import absolute_import
+import sys
+import unittest
+
+import petstore_api
+from petstore_api.model.child_dog_all_of import ChildDogAllOf
+
+
+class TestChildDogAllOf(unittest.TestCase):
+ """ChildDogAllOf unit test stubs"""
+
+ def setUp(self):
+ pass
+
+ def tearDown(self):
+ pass
+
+ def testChildDogAllOf(self):
+ """Test ChildDogAllOf"""
+ # FIXME: construct object with mandatory attributes with example values
+ # model = ChildDogAllOf() # noqa: E501
+ pass
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_child_lizard.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_child_lizard.py
new file mode 100644
index 000000000000..975dc1612a9f
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_child_lizard.py
@@ -0,0 +1,48 @@
+# 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: https://openapi-generator.tech
+"""
+
+
+from __future__ import absolute_import
+import sys
+import unittest
+
+import petstore_api
+try:
+ from petstore_api.model import child_lizard_all_of
+except ImportError:
+ child_lizard_all_of = sys.modules[
+ 'petstore_api.model.child_lizard_all_of']
+try:
+ from petstore_api.model import parent_pet
+except ImportError:
+ parent_pet = sys.modules[
+ 'petstore_api.model.parent_pet']
+from petstore_api.model.child_lizard import ChildLizard
+
+
+class TestChildLizard(unittest.TestCase):
+ """ChildLizard unit test stubs"""
+
+ def setUp(self):
+ pass
+
+ def tearDown(self):
+ pass
+
+ def testChildLizard(self):
+ """Test ChildLizard"""
+ # FIXME: construct object with mandatory attributes with example values
+ # model = ChildLizard() # noqa: E501
+ pass
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_child_lizard_all_of.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_child_lizard_all_of.py
new file mode 100644
index 000000000000..1b3bf4dba943
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_child_lizard_all_of.py
@@ -0,0 +1,38 @@
+# 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: https://openapi-generator.tech
+"""
+
+
+from __future__ import absolute_import
+import sys
+import unittest
+
+import petstore_api
+from petstore_api.model.child_lizard_all_of import ChildLizardAllOf
+
+
+class TestChildLizardAllOf(unittest.TestCase):
+ """ChildLizardAllOf unit test stubs"""
+
+ def setUp(self):
+ pass
+
+ def tearDown(self):
+ pass
+
+ def testChildLizardAllOf(self):
+ """Test ChildLizardAllOf"""
+ # FIXME: construct object with mandatory attributes with example values
+ # model = ChildLizardAllOf() # noqa: E501
+ pass
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_class_model.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_class_model.py
new file mode 100644
index 000000000000..060df39e4b5e
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_class_model.py
@@ -0,0 +1,38 @@
+# 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: https://openapi-generator.tech
+"""
+
+
+from __future__ import absolute_import
+import sys
+import unittest
+
+import petstore_api
+from petstore_api.model.class_model import ClassModel
+
+
+class TestClassModel(unittest.TestCase):
+ """ClassModel unit test stubs"""
+
+ def setUp(self):
+ pass
+
+ def tearDown(self):
+ pass
+
+ def testClassModel(self):
+ """Test ClassModel"""
+ # FIXME: construct object with mandatory attributes with example values
+ # model = ClassModel() # noqa: E501
+ pass
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_client.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_client.py
new file mode 100644
index 000000000000..ab5e3a80d377
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_client.py
@@ -0,0 +1,38 @@
+# 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: https://openapi-generator.tech
+"""
+
+
+from __future__ import absolute_import
+import sys
+import unittest
+
+import petstore_api
+from petstore_api.model.client import Client
+
+
+class TestClient(unittest.TestCase):
+ """Client unit test stubs"""
+
+ def setUp(self):
+ pass
+
+ def tearDown(self):
+ pass
+
+ def testClient(self):
+ """Test Client"""
+ # FIXME: construct object with mandatory attributes with example values
+ # model = Client() # noqa: E501
+ pass
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_dog.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_dog.py
new file mode 100644
index 000000000000..9fb96ebc6b92
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_dog.py
@@ -0,0 +1,57 @@
+# 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: https://openapi-generator.tech
+"""
+
+
+from __future__ import absolute_import
+import sys
+import unittest
+
+import petstore_api
+try:
+ from petstore_api.model import animal
+except ImportError:
+ animal = sys.modules[
+ 'petstore_api.model.animal']
+try:
+ from petstore_api.model import dog_all_of
+except ImportError:
+ dog_all_of = sys.modules[
+ 'petstore_api.model.dog_all_of']
+from petstore_api.model.dog import Dog
+
+
+class TestDog(unittest.TestCase):
+ """Dog unit test stubs"""
+
+ def setUp(self):
+ pass
+
+ def tearDown(self):
+ pass
+
+ def testDog(self):
+ """Test Dog
+ This will fail because additional_properties_type is None in Animal and it must be defined as any type
+ to allow in the property breed which is not defined in Animal, it is defined in Dog
+ """
+ # make an instance of dog, a composed schema model
+ class_name = 'Dog'
+ color = 'white'
+ breed = 'Jack Russel Terrier'
+ with self.assertRaises(petstore_api.exceptions.ApiValueError):
+ dog = Dog(
+ class_name=class_name,
+ color=color,
+ breed=breed
+ )
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_dog_all_of.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_dog_all_of.py
new file mode 100644
index 000000000000..7ab4e8ae79d8
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_dog_all_of.py
@@ -0,0 +1,38 @@
+# 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: https://openapi-generator.tech
+"""
+
+
+from __future__ import absolute_import
+import sys
+import unittest
+
+import petstore_api
+from petstore_api.model.dog_all_of import DogAllOf
+
+
+class TestDogAllOf(unittest.TestCase):
+ """DogAllOf unit test stubs"""
+
+ def setUp(self):
+ pass
+
+ def tearDown(self):
+ pass
+
+ def testDogAllOf(self):
+ """Test DogAllOf"""
+ # FIXME: construct object with mandatory attributes with example values
+ # model = DogAllOf() # noqa: E501
+ pass
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_enum_arrays.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_enum_arrays.py
new file mode 100644
index 000000000000..64ad5fd7dc08
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_enum_arrays.py
@@ -0,0 +1,162 @@
+# 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: https://openapi-generator.tech
+"""
+
+
+from __future__ import absolute_import
+import sys
+import unittest
+
+import petstore_api
+from petstore_api.model.enum_arrays import EnumArrays
+
+
+class TestEnumArrays(unittest.TestCase):
+ """EnumArrays unit test stubs"""
+
+ def setUp(self):
+ pass
+
+ def tearDown(self):
+ pass
+
+ def test_enumarrays_init(self):
+ #
+ # Check various combinations of valid values.
+ #
+ fish_or_crab = EnumArrays(just_symbol=">=")
+ self.assertEqual(fish_or_crab.just_symbol, ">=")
+ # if optional property is unset we raise an exception
+ with self.assertRaises(petstore_api.ApiAttributeError) as exc:
+ self.assertEqual(fish_or_crab.array_enum, None)
+
+ fish_or_crab = EnumArrays(just_symbol="$", array_enum=["fish"])
+ self.assertEqual(fish_or_crab.just_symbol, "$")
+ self.assertEqual(fish_or_crab.array_enum, ["fish"])
+
+ fish_or_crab = EnumArrays(just_symbol=">=", array_enum=["fish"])
+ self.assertEqual(fish_or_crab.just_symbol, ">=")
+ self.assertEqual(fish_or_crab.array_enum, ["fish"])
+
+ fish_or_crab = EnumArrays(just_symbol="$", array_enum=["crab"])
+ self.assertEqual(fish_or_crab.just_symbol, "$")
+ self.assertEqual(fish_or_crab.array_enum, ["crab"])
+
+
+ #
+ # Check if setting invalid values fails
+ #
+ with self.assertRaises(petstore_api.ApiValueError) as exc:
+ fish_or_crab = EnumArrays(just_symbol="<=")
+
+ with self.assertRaises(petstore_api.ApiValueError) as exc:
+ fish_or_crab = EnumArrays(just_symbol="$", array_enum=["dog"])
+
+ with self.assertRaises(petstore_api.ApiTypeError) as exc:
+ fish_or_crab = EnumArrays(just_symbol=["$"], array_enum=["crab"])
+
+
+ def test_enumarrays_setter(self):
+
+ #
+ # Check various combinations of valid values
+ #
+ fish_or_crab = EnumArrays()
+
+ fish_or_crab.just_symbol = ">="
+ self.assertEqual(fish_or_crab.just_symbol, ">=")
+
+ fish_or_crab.just_symbol = "$"
+ self.assertEqual(fish_or_crab.just_symbol, "$")
+
+ fish_or_crab.array_enum = []
+ self.assertEqual(fish_or_crab.array_enum, [])
+
+ fish_or_crab.array_enum = ["fish"]
+ self.assertEqual(fish_or_crab.array_enum, ["fish"])
+
+ fish_or_crab.array_enum = ["fish", "fish", "fish"]
+ self.assertEqual(fish_or_crab.array_enum, ["fish", "fish", "fish"])
+
+ fish_or_crab.array_enum = ["crab"]
+ self.assertEqual(fish_or_crab.array_enum, ["crab"])
+
+ fish_or_crab.array_enum = ["crab", "fish"]
+ self.assertEqual(fish_or_crab.array_enum, ["crab", "fish"])
+
+ fish_or_crab.array_enum = ["crab", "fish", "crab", "fish"]
+ self.assertEqual(fish_or_crab.array_enum, ["crab", "fish", "crab", "fish"])
+
+ #
+ # Check if setting invalid values fails
+ #
+ fish_or_crab = EnumArrays()
+ with self.assertRaises(petstore_api.ApiValueError) as exc:
+ fish_or_crab.just_symbol = "!="
+
+ with self.assertRaises(petstore_api.ApiTypeError) as exc:
+ fish_or_crab.just_symbol = ["fish"]
+
+ with self.assertRaises(petstore_api.ApiValueError) as exc:
+ fish_or_crab.array_enum = ["cat"]
+
+ with self.assertRaises(petstore_api.ApiValueError) as exc:
+ fish_or_crab.array_enum = ["fish", "crab", "dog"]
+
+ with self.assertRaises(petstore_api.ApiTypeError) as exc:
+ fish_or_crab.array_enum = "fish"
+
+
+ def test_todict(self):
+ #
+ # Check if dictionary serialization works
+ #
+ dollar_fish_crab_dict = {
+ 'just_symbol': "$",
+ 'array_enum': ["fish", "crab"]
+ }
+
+ dollar_fish_crab = EnumArrays(
+ just_symbol="$", array_enum=["fish", "crab"])
+
+ self.assertEqual(dollar_fish_crab_dict, dollar_fish_crab.to_dict())
+
+ #
+ # Sanity check for different arrays
+ #
+ dollar_crab_fish_dict = {
+ 'just_symbol': "$",
+ 'array_enum': ["crab", "fish"]
+ }
+
+ dollar_fish_crab = EnumArrays(
+ just_symbol="$", array_enum=["fish", "crab"])
+
+ self.assertNotEqual(dollar_crab_fish_dict, dollar_fish_crab.to_dict())
+
+
+ def test_equals(self):
+ #
+ # Check if object comparison works
+ #
+ fish1 = EnumArrays(just_symbol="$", array_enum=["fish"])
+ fish2 = EnumArrays(just_symbol="$", array_enum=["fish"])
+ self.assertEqual(fish1, fish2)
+
+ fish = EnumArrays(just_symbol="$", array_enum=["fish"])
+ crab = EnumArrays(just_symbol="$", array_enum=["crab"])
+ self.assertNotEqual(fish, crab)
+
+ dollar = EnumArrays(just_symbol="$")
+ greater = EnumArrays(just_symbol=">=")
+ self.assertNotEqual(dollar, greater)
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_enum_class.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_enum_class.py
new file mode 100644
index 000000000000..f910231c9d02
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_enum_class.py
@@ -0,0 +1,38 @@
+# 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: https://openapi-generator.tech
+"""
+
+
+from __future__ import absolute_import
+import sys
+import unittest
+
+import petstore_api
+from petstore_api.model.enum_class import EnumClass
+
+
+class TestEnumClass(unittest.TestCase):
+ """EnumClass unit test stubs"""
+
+ def setUp(self):
+ pass
+
+ def tearDown(self):
+ pass
+
+ def testEnumClass(self):
+ """Test EnumClass"""
+ # FIXME: construct object with mandatory attributes with example values
+ # model = EnumClass() # noqa: E501
+ pass
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_enum_test.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_enum_test.py
new file mode 100644
index 000000000000..7b4c1b6b66ac
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_enum_test.py
@@ -0,0 +1,43 @@
+# 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: https://openapi-generator.tech
+"""
+
+
+from __future__ import absolute_import
+import sys
+import unittest
+
+import petstore_api
+try:
+ from petstore_api.model import string_enum
+except ImportError:
+ string_enum = sys.modules[
+ 'petstore_api.model.string_enum']
+from petstore_api.model.enum_test import EnumTest
+
+
+class TestEnumTest(unittest.TestCase):
+ """EnumTest unit test stubs"""
+
+ def setUp(self):
+ pass
+
+ def tearDown(self):
+ pass
+
+ def testEnumTest(self):
+ """Test EnumTest"""
+ # FIXME: construct object with mandatory attributes with example values
+ # model = EnumTest() # noqa: E501
+ pass
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_fake_api.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_fake_api.py
new file mode 100644
index 000000000000..34d207f3c71d
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_fake_api.py
@@ -0,0 +1,197 @@
+# 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: https://openapi-generator.tech
+"""
+
+
+from __future__ import absolute_import
+
+import unittest
+
+import petstore_api
+from petstore_api.api.fake_api import FakeApi # noqa: E501
+
+
+class TestFakeApi(unittest.TestCase):
+ """FakeApi unit test stubs"""
+
+ def setUp(self):
+ self.api = FakeApi() # noqa: E501
+
+ def tearDown(self):
+ pass
+
+ def test_create_xml_item(self):
+ """Test case for create_xml_item
+
+ creates an XmlItem # noqa: E501
+ """
+ pass
+
+ def test_boolean(self):
+ """Test case for boolean
+
+ """
+ endpoint = self.api.boolean
+ assert endpoint.openapi_types['body'] == (bool,)
+ assert endpoint.settings['response_type'] == (bool,)
+
+ def test_string(self):
+ """Test case for string
+
+ """
+ endpoint = self.api.string
+ assert endpoint.openapi_types['body'] == (str,)
+ assert endpoint.settings['response_type'] == (str,)
+
+ def test_object_model_with_ref_props(self):
+ """Test case for object_model_with_ref_props
+
+ """
+ from petstore_api.model import object_model_with_ref_props
+ endpoint = self.api.object_model_with_ref_props
+ assert endpoint.openapi_types['body'] == (object_model_with_ref_props.ObjectModelWithRefProps,)
+ assert endpoint.settings['response_type'] == (object_model_with_ref_props.ObjectModelWithRefProps,)
+
+ def test_string_enum(self):
+ """Test case for string_enum
+
+ """
+ from petstore_api.model import string_enum
+ endpoint = self.api.string_enum
+ assert endpoint.openapi_types['body'] == (string_enum.StringEnum,)
+ assert endpoint.settings['response_type'] == (string_enum.StringEnum,)
+
+ def test_array_model(self):
+ """Test case for array_model
+
+ """
+ from petstore_api.model import animal_farm
+ endpoint = self.api.array_model
+ assert endpoint.openapi_types['body'] == (animal_farm.AnimalFarm,)
+ assert endpoint.settings['response_type'] == (animal_farm.AnimalFarm,)
+
+ def test_number_with_validations(self):
+ """Test case for number_with_validations
+
+ """
+ from petstore_api.model import number_with_validations
+ endpoint = self.api.number_with_validations
+ assert endpoint.openapi_types['body'] == (number_with_validations.NumberWithValidations,)
+ assert endpoint.settings['response_type'] == (number_with_validations.NumberWithValidations,)
+
+ def test_test_body_with_file_schema(self):
+ """Test case for test_body_with_file_schema
+
+ """
+ pass
+
+ def test_test_body_with_query_params(self):
+ """Test case for test_body_with_query_params
+
+ """
+ pass
+
+ def test_test_client_model(self):
+ """Test case for test_client_model
+
+ To test \"client\" model # noqa: E501
+ """
+ pass
+
+ def test_test_endpoint_enums_length_one(self):
+ """Test case for test_endpoint_enums_length_one
+
+ """
+ # when we omit the required enums of length one, they are still set
+ endpoint = self.api.test_endpoint_enums_length_one
+ import six
+ if six.PY3:
+ from unittest.mock import patch
+ else:
+ from mock import patch
+ with patch.object(endpoint, 'call_with_http_info') as call_with_http_info:
+ endpoint()
+ call_with_http_info.assert_called_with(
+ _check_input_type=True,
+ _check_return_type=True,
+ _host_index=None,
+ _preload_content=True,
+ _request_timeout=None,
+ _return_http_data_only=True,
+ async_req=False,
+ header_number=1.234,
+ path_integer=34,
+ path_string='hello',
+ query_integer=3,
+ query_string='brillig'
+ )
+
+ def test_test_endpoint_parameters(self):
+ """Test case for test_endpoint_parameters
+
+ Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 # noqa: E501
+ """
+ # check that we can access the endpoint's validations
+ endpoint = self.api.test_endpoint_parameters
+ assert endpoint.validations[('number',)] == {
+ 'inclusive_maximum': 543.2,
+ 'inclusive_minimum': 32.1,
+ }
+ # make sure that an exception is thrown on an invalid value
+ keyword_args = dict(
+ number=544, # invalid
+ double=100,
+ pattern_without_delimiter="abc",
+ byte='sample string'
+ )
+ with self.assertRaises(petstore_api.ApiValueError):
+ self.api.test_endpoint_parameters(**keyword_args)
+
+ def test_test_enum_parameters(self):
+ """Test case for test_enum_parameters
+
+ To test enum parameters # noqa: E501
+ """
+ # check that we can access the endpoint's allowed_values
+ endpoint = self.api.test_enum_parameters
+ assert endpoint.allowed_values[('enum_query_string',)] == {
+ "_ABC": "_abc",
+ "-EFG": "-efg",
+ "(XYZ)": "(xyz)"
+ }
+ # make sure that an exception is thrown on an invalid value
+ keyword_args = dict(enum_query_string="bad value")
+ with self.assertRaises(petstore_api.ApiValueError):
+ self.api.test_enum_parameters(**keyword_args)
+
+ def test_test_group_parameters(self):
+ """Test case for test_group_parameters
+
+ Fake endpoint to test group parameters (optional) # noqa: E501
+ """
+ pass
+
+ def test_test_inline_additional_properties(self):
+ """Test case for test_inline_additional_properties
+
+ test inline additionalProperties # noqa: E501
+ """
+ pass
+
+ def test_test_json_form_data(self):
+ """Test case for test_json_form_data
+
+ test json serialization of form data # noqa: E501
+ """
+ pass
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_fake_classname_tags_123_api.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_fake_classname_tags_123_api.py
new file mode 100644
index 000000000000..1ade31405a62
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_fake_classname_tags_123_api.py
@@ -0,0 +1,39 @@
+# 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: https://openapi-generator.tech
+"""
+
+
+from __future__ import absolute_import
+import sys
+import unittest
+
+import petstore_api
+from petstore_api.api.fake_classname_tags_123_api import FakeClassnameTags123Api # noqa: E501
+
+
+class TestFakeClassnameTags123Api(unittest.TestCase):
+ """FakeClassnameTags123Api unit test stubs"""
+
+ def setUp(self):
+ self.api = FakeClassnameTags123Api() # noqa: E501
+
+ def tearDown(self):
+ pass
+
+ def test_test_classname(self):
+ """Test case for test_classname
+
+ To test class name in snake case # noqa: E501
+ """
+ pass
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_file.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_file.py
new file mode 100644
index 000000000000..8d60f64e01cc
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_file.py
@@ -0,0 +1,38 @@
+# 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: https://openapi-generator.tech
+"""
+
+
+from __future__ import absolute_import
+import sys
+import unittest
+
+import petstore_api
+from petstore_api.model.file import File
+
+
+class TestFile(unittest.TestCase):
+ """File unit test stubs"""
+
+ def setUp(self):
+ pass
+
+ def tearDown(self):
+ pass
+
+ def testFile(self):
+ """Test File"""
+ # FIXME: construct object with mandatory attributes with example values
+ # model = File() # noqa: E501
+ pass
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_file_schema_test_class.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_file_schema_test_class.py
new file mode 100644
index 000000000000..9a4f6d38dfef
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_file_schema_test_class.py
@@ -0,0 +1,43 @@
+# 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: https://openapi-generator.tech
+"""
+
+
+from __future__ import absolute_import
+import sys
+import unittest
+
+import petstore_api
+try:
+ from petstore_api.model import file
+except ImportError:
+ file = sys.modules[
+ 'petstore_api.model.file']
+from petstore_api.model.file_schema_test_class import FileSchemaTestClass
+
+
+class TestFileSchemaTestClass(unittest.TestCase):
+ """FileSchemaTestClass unit test stubs"""
+
+ def setUp(self):
+ pass
+
+ def tearDown(self):
+ pass
+
+ def testFileSchemaTestClass(self):
+ """Test FileSchemaTestClass"""
+ # FIXME: construct object with mandatory attributes with example values
+ # model = FileSchemaTestClass() # noqa: E501
+ pass
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_format_test.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_format_test.py
new file mode 100644
index 000000000000..ca37b005fd96
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_format_test.py
@@ -0,0 +1,153 @@
+# 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: https://openapi-generator.tech
+"""
+
+
+from __future__ import absolute_import
+import sys
+import unittest
+
+import petstore_api
+from petstore_api.model.format_test import FormatTest
+
+
+class TestFormatTest(unittest.TestCase):
+ """FormatTest unit test stubs"""
+
+ def setUp(self):
+ import datetime
+ self.required_named_args = dict(
+ number=40.1,
+ byte='what',
+ date=datetime.date(2019, 3, 23),
+ password='rainbowtable'
+ )
+
+ def test_integer(self):
+ var_name = 'integer'
+ validations = FormatTest.validations[(var_name,)]
+ keyword_args = {}
+ keyword_args.update(self.required_named_args)
+ key_adder_pairs = [('inclusive_maximum', 1), ('inclusive_minimum', -1)]
+ for key, adder in key_adder_pairs:
+ # value outside the bounds throws an error
+ with self.assertRaises(petstore_api.ApiValueError):
+ keyword_args[var_name] = validations[key] + adder
+ FormatTest(**keyword_args)
+
+ # value inside the bounds works
+ keyword_args[var_name] = validations[key]
+ assert (getattr(FormatTest(**keyword_args), var_name) ==
+ validations[key])
+
+ def test_int32(self):
+ var_name = 'int32'
+ validations = FormatTest.validations[(var_name,)]
+ keyword_args = {}
+ keyword_args.update(self.required_named_args)
+ key_adder_pairs = [('inclusive_maximum', 1), ('inclusive_minimum', -1)]
+ for key, adder in key_adder_pairs:
+ # value outside the bounds throws an error
+ with self.assertRaises(petstore_api.ApiValueError):
+ keyword_args[var_name] = validations[key] + adder
+ FormatTest(**keyword_args)
+
+ # value inside the bounds works
+ keyword_args[var_name] = validations[key]
+ assert (getattr(FormatTest(**keyword_args), var_name) ==
+ validations[key])
+
+ def test_number(self):
+ var_name = 'number'
+ validations = FormatTest.validations[(var_name,)]
+ keyword_args = {}
+ keyword_args.update(self.required_named_args)
+ key_adder_pairs = [('inclusive_maximum', 1), ('inclusive_minimum', -1)]
+ for key, adder in key_adder_pairs:
+ # value outside the bounds throws an error
+ with self.assertRaises(petstore_api.ApiValueError):
+ keyword_args[var_name] = validations[key] + adder
+ FormatTest(**keyword_args)
+
+ # value inside the bounds works
+ keyword_args[var_name] = validations[key]
+ assert (getattr(FormatTest(**keyword_args), var_name) ==
+ validations[key])
+
+ def test_float(self):
+ var_name = 'float'
+ validations = FormatTest.validations[(var_name,)]
+ keyword_args = {}
+ keyword_args.update(self.required_named_args)
+ key_adder_pairs = [('inclusive_maximum', 1), ('inclusive_minimum', -1)]
+ for key, adder in key_adder_pairs:
+ # value outside the bounds throws an error
+ with self.assertRaises(petstore_api.ApiValueError):
+ keyword_args[var_name] = validations[key] + adder
+ FormatTest(**keyword_args)
+
+ # value inside the bounds works
+ keyword_args[var_name] = validations[key]
+ assert (getattr(FormatTest(**keyword_args), var_name) ==
+ validations[key])
+
+ def test_double(self):
+ var_name = 'double'
+ validations = FormatTest.validations[(var_name,)]
+ keyword_args = {}
+ keyword_args.update(self.required_named_args)
+ key_adder_pairs = [('inclusive_maximum', 1), ('inclusive_minimum', -1)]
+ for key, adder in key_adder_pairs:
+ # value outside the bounds throws an error
+ with self.assertRaises(petstore_api.ApiValueError):
+ keyword_args[var_name] = validations[key] + adder
+ FormatTest(**keyword_args)
+
+ # value inside the bounds works
+ keyword_args[var_name] = validations[key]
+ assert (getattr(FormatTest(**keyword_args), var_name) ==
+ validations[key])
+
+ def test_password(self):
+ var_name = 'password'
+ validations = FormatTest.validations[(var_name,)]
+ keyword_args = {}
+ keyword_args.update(self.required_named_args)
+ key_adder_pairs = [('max_length', 1), ('min_length', -1)]
+ for key, adder in key_adder_pairs:
+ # value outside the bounds throws an error
+ with self.assertRaises(petstore_api.ApiValueError):
+ keyword_args[var_name] = 'a'*(validations[key] + adder)
+ FormatTest(**keyword_args)
+
+ # value inside the bounds works
+ keyword_args[var_name] = 'a'*validations[key]
+ assert (getattr(FormatTest(**keyword_args), var_name) ==
+ 'a'*validations[key])
+
+ def test_string(self):
+ var_name = 'string'
+ validations = FormatTest.validations[(var_name,)]
+ keyword_args = {}
+ keyword_args.update(self.required_named_args)
+ values_invalid = ['abc3', '1', '.', ' ', 'مرحبا', '']
+ for value_invalid in values_invalid:
+ # invalid values throw exceptions
+ with self.assertRaises(petstore_api.ApiValueError):
+ keyword_args[var_name] = value_invalid
+ FormatTest(**keyword_args)
+
+ # valid value works
+ value_valid = 'abcdz'
+ keyword_args[var_name] = value_valid
+ assert getattr(FormatTest(**keyword_args), var_name) == value_valid
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_grandparent.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_grandparent.py
new file mode 100644
index 000000000000..2972d01161cd
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_grandparent.py
@@ -0,0 +1,38 @@
+# 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: https://openapi-generator.tech
+"""
+
+
+from __future__ import absolute_import
+import sys
+import unittest
+
+import petstore_api
+from petstore_api.model.grandparent import Grandparent
+
+
+class TestGrandparent(unittest.TestCase):
+ """Grandparent unit test stubs"""
+
+ def setUp(self):
+ pass
+
+ def tearDown(self):
+ pass
+
+ def testGrandparent(self):
+ """Test Grandparent"""
+ # FIXME: construct object with mandatory attributes with example values
+ # model = Grandparent() # noqa: E501
+ pass
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_grandparent_animal.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_grandparent_animal.py
new file mode 100644
index 000000000000..cabe4d81f98e
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_grandparent_animal.py
@@ -0,0 +1,58 @@
+# 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: https://openapi-generator.tech
+"""
+
+
+from __future__ import absolute_import
+import sys
+import unittest
+
+import petstore_api
+try:
+ from petstore_api.model import child_cat
+except ImportError:
+ child_cat = sys.modules[
+ 'petstore_api.model.child_cat']
+try:
+ from petstore_api.model import child_dog
+except ImportError:
+ child_dog = sys.modules[
+ 'petstore_api.model.child_dog']
+try:
+ from petstore_api.model import child_lizard
+except ImportError:
+ child_lizard = sys.modules[
+ 'petstore_api.model.child_lizard']
+try:
+ from petstore_api.model import parent_pet
+except ImportError:
+ parent_pet = sys.modules[
+ 'petstore_api.model.parent_pet']
+from petstore_api.model.grandparent_animal import GrandparentAnimal
+
+
+class TestGrandparentAnimal(unittest.TestCase):
+ """GrandparentAnimal unit test stubs"""
+
+ def setUp(self):
+ pass
+
+ def tearDown(self):
+ pass
+
+ def testGrandparentAnimal(self):
+ """Test GrandparentAnimal"""
+ # FIXME: construct object with mandatory attributes with example values
+ # model = GrandparentAnimal() # noqa: E501
+ pass
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_has_only_read_only.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_has_only_read_only.py
new file mode 100644
index 000000000000..9ebd7683b398
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_has_only_read_only.py
@@ -0,0 +1,38 @@
+# 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: https://openapi-generator.tech
+"""
+
+
+from __future__ import absolute_import
+import sys
+import unittest
+
+import petstore_api
+from petstore_api.model.has_only_read_only import HasOnlyReadOnly
+
+
+class TestHasOnlyReadOnly(unittest.TestCase):
+ """HasOnlyReadOnly unit test stubs"""
+
+ def setUp(self):
+ pass
+
+ def tearDown(self):
+ pass
+
+ def testHasOnlyReadOnly(self):
+ """Test HasOnlyReadOnly"""
+ # FIXME: construct object with mandatory attributes with example values
+ # model = HasOnlyReadOnly() # noqa: E501
+ pass
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_list.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_list.py
new file mode 100644
index 000000000000..52156adfed2e
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_list.py
@@ -0,0 +1,38 @@
+# 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: https://openapi-generator.tech
+"""
+
+
+from __future__ import absolute_import
+import sys
+import unittest
+
+import petstore_api
+from petstore_api.model.list import List
+
+
+class TestList(unittest.TestCase):
+ """List unit test stubs"""
+
+ def setUp(self):
+ pass
+
+ def tearDown(self):
+ pass
+
+ def testList(self):
+ """Test List"""
+ # FIXME: construct object with mandatory attributes with example values
+ # model = List() # noqa: E501
+ pass
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_map_test.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_map_test.py
new file mode 100644
index 000000000000..3feda0f688df
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_map_test.py
@@ -0,0 +1,125 @@
+# 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: https://openapi-generator.tech
+"""
+
+
+from __future__ import absolute_import
+import sys
+import unittest
+
+import petstore_api
+try:
+ from petstore_api.model import string_boolean_map
+except ImportError:
+ string_boolean_map = sys.modules[
+ 'petstore_api.model.string_boolean_map']
+from petstore_api.model.map_test import MapTest
+
+
+class TestMapTest(unittest.TestCase):
+ """MapTest unit test stubs"""
+
+ def setUp(self):
+ pass
+
+ def tearDown(self):
+ pass
+
+ def test_maptest_init(self):
+ #
+ # Test MapTest construction with valid values
+ #
+ up_or_low_dict = {
+ 'UPPER': "UP",
+ 'lower': "low"
+ }
+ map_enum_test = MapTest(map_of_enum_string=up_or_low_dict)
+
+ self.assertEqual(map_enum_test.map_of_enum_string, up_or_low_dict)
+
+ map_of_map_of_strings = {
+ 'valueDict': up_or_low_dict
+ }
+ map_enum_test = MapTest(map_map_of_string=map_of_map_of_strings)
+
+ self.assertEqual(map_enum_test.map_map_of_string, map_of_map_of_strings)
+
+ #
+ # Make sure that the init fails for invalid enum values
+ #
+ black_or_white_dict = {
+ 'black': "UP",
+ 'white': "low"
+ }
+ with self.assertRaises(petstore_api.ApiValueError):
+ MapTest(map_of_enum_string=black_or_white_dict)
+
+ def test_maptest_setter(self):
+ #
+ # Check with some valid values
+ #
+ map_enum_test = MapTest()
+ up_or_low_dict = {
+ 'UPPER': "UP",
+ 'lower': "low"
+ }
+ map_enum_test.map_of_enum_string = up_or_low_dict
+ self.assertEqual(map_enum_test.map_of_enum_string, up_or_low_dict)
+
+ #
+ # Check if the setter fails for invalid enum values
+ #
+ map_enum_test = MapTest()
+ black_or_white_dict = {
+ 'black': "UP",
+ 'white': "low"
+ }
+ with self.assertRaises(petstore_api.ApiValueError):
+ map_enum_test.map_of_enum_string = black_or_white_dict
+
+ def test_todict(self):
+ #
+ # Check dictionary serialization
+ #
+ map_enum_test = MapTest()
+ up_or_low_dict = {
+ 'UPPER': "UP",
+ 'lower': "low"
+ }
+ map_of_map_of_strings = {
+ 'valueDict': up_or_low_dict
+ }
+ indirect_map = string_boolean_map.StringBooleanMap(**{
+ 'option1': True
+ })
+ direct_map = {
+ 'option2': False
+ }
+ map_enum_test.map_of_enum_string = up_or_low_dict
+ map_enum_test.map_map_of_string = map_of_map_of_strings
+ map_enum_test.indirect_map = indirect_map
+ map_enum_test.direct_map = direct_map
+
+ self.assertEqual(map_enum_test.map_of_enum_string, up_or_low_dict)
+ self.assertEqual(map_enum_test.map_map_of_string, map_of_map_of_strings)
+ self.assertEqual(map_enum_test.indirect_map, indirect_map)
+ self.assertEqual(map_enum_test.direct_map, direct_map)
+
+ expected_dict = {
+ 'map_of_enum_string': up_or_low_dict,
+ 'map_map_of_string': map_of_map_of_strings,
+ 'indirect_map': indirect_map.to_dict(),
+ 'direct_map': direct_map
+ }
+
+ self.assertEqual(map_enum_test.to_dict(), expected_dict)
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_mixed_properties_and_additional_properties_class.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_mixed_properties_and_additional_properties_class.py
new file mode 100644
index 000000000000..4dcb5ad4268c
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_mixed_properties_and_additional_properties_class.py
@@ -0,0 +1,43 @@
+# 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: https://openapi-generator.tech
+"""
+
+
+from __future__ import absolute_import
+import sys
+import unittest
+
+import petstore_api
+try:
+ from petstore_api.model import animal
+except ImportError:
+ animal = sys.modules[
+ 'petstore_api.model.animal']
+from petstore_api.model.mixed_properties_and_additional_properties_class import MixedPropertiesAndAdditionalPropertiesClass
+
+
+class TestMixedPropertiesAndAdditionalPropertiesClass(unittest.TestCase):
+ """MixedPropertiesAndAdditionalPropertiesClass unit test stubs"""
+
+ def setUp(self):
+ pass
+
+ def tearDown(self):
+ pass
+
+ def testMixedPropertiesAndAdditionalPropertiesClass(self):
+ """Test MixedPropertiesAndAdditionalPropertiesClass"""
+ # FIXME: construct object with mandatory attributes with example values
+ # model = MixedPropertiesAndAdditionalPropertiesClass() # noqa: E501
+ pass
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_model200_response.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_model200_response.py
new file mode 100644
index 000000000000..4012eaae3362
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_model200_response.py
@@ -0,0 +1,38 @@
+# 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: https://openapi-generator.tech
+"""
+
+
+from __future__ import absolute_import
+import sys
+import unittest
+
+import petstore_api
+from petstore_api.model.model200_response import Model200Response
+
+
+class TestModel200Response(unittest.TestCase):
+ """Model200Response unit test stubs"""
+
+ def setUp(self):
+ pass
+
+ def tearDown(self):
+ pass
+
+ def testModel200Response(self):
+ """Test Model200Response"""
+ # FIXME: construct object with mandatory attributes with example values
+ # model = Model200Response() # noqa: E501
+ pass
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_model_return.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_model_return.py
new file mode 100644
index 000000000000..54c98b33cd66
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_model_return.py
@@ -0,0 +1,38 @@
+# 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: https://openapi-generator.tech
+"""
+
+
+from __future__ import absolute_import
+import sys
+import unittest
+
+import petstore_api
+from petstore_api.model.model_return import ModelReturn
+
+
+class TestModelReturn(unittest.TestCase):
+ """ModelReturn unit test stubs"""
+
+ def setUp(self):
+ pass
+
+ def tearDown(self):
+ pass
+
+ def testModelReturn(self):
+ """Test ModelReturn"""
+ # FIXME: construct object with mandatory attributes with example values
+ # model = ModelReturn() # noqa: E501
+ pass
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_name.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_name.py
new file mode 100644
index 000000000000..6a9be99d1a57
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_name.py
@@ -0,0 +1,38 @@
+# 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: https://openapi-generator.tech
+"""
+
+
+from __future__ import absolute_import
+import sys
+import unittest
+
+import petstore_api
+from petstore_api.model.name import Name
+
+
+class TestName(unittest.TestCase):
+ """Name unit test stubs"""
+
+ def setUp(self):
+ pass
+
+ def tearDown(self):
+ pass
+
+ def testName(self):
+ """Test Name"""
+ # FIXME: construct object with mandatory attributes with example values
+ # model = Name() # noqa: E501
+ pass
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_number_only.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_number_only.py
new file mode 100644
index 000000000000..07aab1d78af7
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_number_only.py
@@ -0,0 +1,38 @@
+# 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: https://openapi-generator.tech
+"""
+
+
+from __future__ import absolute_import
+import sys
+import unittest
+
+import petstore_api
+from petstore_api.model.number_only import NumberOnly
+
+
+class TestNumberOnly(unittest.TestCase):
+ """NumberOnly unit test stubs"""
+
+ def setUp(self):
+ pass
+
+ def tearDown(self):
+ pass
+
+ def testNumberOnly(self):
+ """Test NumberOnly"""
+ # FIXME: construct object with mandatory attributes with example values
+ # model = NumberOnly() # noqa: E501
+ pass
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_number_with_validations.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_number_with_validations.py
new file mode 100644
index 000000000000..3f0b78835d4b
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_number_with_validations.py
@@ -0,0 +1,45 @@
+# 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: https://openapi-generator.tech
+"""
+
+
+from __future__ import absolute_import
+import sys
+import unittest
+
+import petstore_api
+from petstore_api.model.number_with_validations import NumberWithValidations
+
+
+class TestNumberWithValidations(unittest.TestCase):
+ """NumberWithValidations unit test stubs"""
+
+ def setUp(self):
+ pass
+
+ def tearDown(self):
+ pass
+
+ def testNumberWithValidations(self):
+ """Test NumberWithValidations"""
+ valid_values = [10.0, 15.0, 20.0]
+ for valid_value in valid_values:
+ model = NumberWithValidations(valid_value)
+ assert model.value == valid_value
+
+ invalid_values = [9.0, 21.0]
+ for invalid_value in invalid_values:
+ with self.assertRaises(petstore_api.ApiValueError):
+ NumberWithValidations(invalid_value)
+
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_object_model_with_ref_props.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_object_model_with_ref_props.py
new file mode 100644
index 000000000000..35bd3b6d8ec7
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_object_model_with_ref_props.py
@@ -0,0 +1,49 @@
+# 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: https://openapi-generator.tech
+"""
+
+
+from __future__ import absolute_import
+import sys
+import unittest
+
+import petstore_api
+try:
+ from petstore_api.model import number_with_validations
+except ImportError:
+ number_with_validations = sys.modules[
+ 'petstore_api.model.number_with_validations']
+from petstore_api.model.object_model_with_ref_props import ObjectModelWithRefProps
+
+
+class TestObjectModelWithRefProps(unittest.TestCase):
+ """ObjectModelWithRefProps unit test stubs"""
+
+ def setUp(self):
+ pass
+
+ def tearDown(self):
+ pass
+
+ def testObjectModelWithRefProps(self):
+ """Test ObjectModelWithRefProps"""
+ from petstore_api.model.number_with_validations import NumberWithValidations
+ self.assertEqual(
+ ObjectModelWithRefProps.openapi_types,
+ {
+ 'my_number': (NumberWithValidations,),
+ 'my_string': (str,),
+ 'my_boolean': (bool,),
+ }
+ )
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_order.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_order.py
new file mode 100644
index 000000000000..ee6988e28ccd
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_order.py
@@ -0,0 +1,41 @@
+# 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: https://openapi-generator.tech
+"""
+
+
+from __future__ import absolute_import
+import sys
+import unittest
+
+import petstore_api
+from petstore_api.model.order import Order
+
+
+class TestOrder(unittest.TestCase):
+ """Order unit test stubs"""
+
+ def setUp(self):
+ pass
+
+ def tearDown(self):
+ pass
+
+ def testOrder(self):
+ """Test Order"""
+ order = Order()
+ order.status = "placed"
+ self.assertEqual("placed", order.status)
+ with self.assertRaises(petstore_api.ApiValueError):
+ order.status = "invalid"
+
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_parent.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_parent.py
new file mode 100644
index 000000000000..20282dfb41ea
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_parent.py
@@ -0,0 +1,48 @@
+# 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: https://openapi-generator.tech
+"""
+
+
+from __future__ import absolute_import
+import sys
+import unittest
+
+import petstore_api
+try:
+ from petstore_api.model import grandparent
+except ImportError:
+ grandparent = sys.modules[
+ 'petstore_api.model.grandparent']
+try:
+ from petstore_api.model import parent_all_of
+except ImportError:
+ parent_all_of = sys.modules[
+ 'petstore_api.model.parent_all_of']
+from petstore_api.model.parent import Parent
+
+
+class TestParent(unittest.TestCase):
+ """Parent unit test stubs"""
+
+ def setUp(self):
+ pass
+
+ def tearDown(self):
+ pass
+
+ def testParent(self):
+ """Test Parent"""
+ # FIXME: construct object with mandatory attributes with example values
+ # model = Parent() # noqa: E501
+ pass
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_parent_all_of.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_parent_all_of.py
new file mode 100644
index 000000000000..ca87189bba50
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_parent_all_of.py
@@ -0,0 +1,38 @@
+# 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: https://openapi-generator.tech
+"""
+
+
+from __future__ import absolute_import
+import sys
+import unittest
+
+import petstore_api
+from petstore_api.model.parent_all_of import ParentAllOf
+
+
+class TestParentAllOf(unittest.TestCase):
+ """ParentAllOf unit test stubs"""
+
+ def setUp(self):
+ pass
+
+ def tearDown(self):
+ pass
+
+ def testParentAllOf(self):
+ """Test ParentAllOf"""
+ # FIXME: construct object with mandatory attributes with example values
+ # model = ParentAllOf() # noqa: E501
+ pass
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_parent_pet.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_parent_pet.py
new file mode 100644
index 000000000000..17a4d60e75dc
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_parent_pet.py
@@ -0,0 +1,58 @@
+# 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: https://openapi-generator.tech
+"""
+
+
+from __future__ import absolute_import
+import sys
+import unittest
+
+import petstore_api
+try:
+ from petstore_api.model import child_cat
+except ImportError:
+ child_cat = sys.modules[
+ 'petstore_api.model.child_cat']
+try:
+ from petstore_api.model import child_dog
+except ImportError:
+ child_dog = sys.modules[
+ 'petstore_api.model.child_dog']
+try:
+ from petstore_api.model import child_lizard
+except ImportError:
+ child_lizard = sys.modules[
+ 'petstore_api.model.child_lizard']
+try:
+ from petstore_api.model import grandparent_animal
+except ImportError:
+ grandparent_animal = sys.modules[
+ 'petstore_api.model.grandparent_animal']
+from petstore_api.model.parent_pet import ParentPet
+
+
+class TestParentPet(unittest.TestCase):
+ """ParentPet unit test stubs"""
+
+ def setUp(self):
+ pass
+
+ def tearDown(self):
+ pass
+
+ def testParentPet(self):
+ """Test ParentPet"""
+ # FIXME: construct object with mandatory attributes with example values
+ # model = ParentPet() # noqa: E501
+ pass
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_pet.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_pet.py
new file mode 100644
index 000000000000..b072cff5e9ad
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_pet.py
@@ -0,0 +1,89 @@
+# 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: https://openapi-generator.tech
+"""
+
+
+from __future__ import absolute_import
+import sys
+import unittest
+
+import petstore_api
+try:
+ from petstore_api.model import category
+except ImportError:
+ category = sys.modules[
+ 'petstore_api.model.category']
+try:
+ from petstore_api.models import tag
+except ImportError:
+ tag = sys.modules[
+ 'petstore_api.model.tag']
+from petstore_api.model.pet import Pet
+
+
+class TestPet(unittest.TestCase):
+ """Pet unit test stubs"""
+
+ def setUp(self):
+ pass
+
+ def tearDown(self):
+ pass
+
+ def test_to_str(self):
+ pet = Pet(name="test name", photo_urls=["string"])
+ pet.id = 1
+ pet.status = "available"
+ cate = category.Category()
+ cate.id = 1
+ cate.name = "dog"
+ pet.category = cate
+ tag1 = tag.Tag()
+ tag1.id = 1
+ pet.tags = [tag1]
+
+ data = ("{'category': {'id': 1, 'name': 'dog'},\n"
+ " 'id': 1,\n"
+ " 'name': 'test name',\n"
+ " 'photo_urls': ['string'],\n"
+ " 'status': 'available',\n"
+ " 'tags': [{'id': 1}]}")
+ self.assertEqual(data, pet.to_str())
+
+ def test_equal(self):
+ pet1 = Pet(name="test name", photo_urls=["string"])
+ pet1.id = 1
+ pet1.status = "available"
+ cate1 = category.Category()
+ cate1.id = 1
+ cate1.name = "dog"
+ tag1 = tag.Tag()
+ tag1.id = 1
+ pet1.tags = [tag1]
+
+ pet2 = Pet(name="test name", photo_urls=["string"])
+ pet2.id = 1
+ pet2.status = "available"
+ cate2 = category.Category()
+ cate2.id = 1
+ cate2.name = "dog"
+ tag2 = tag.Tag()
+ tag2.id = 1
+ pet2.tags = [tag2]
+
+ self.assertTrue(pet1 == pet2)
+
+ # reset pet1 tags to empty array so that object comparison returns false
+ pet1.tags = []
+ self.assertFalse(pet1 == pet2)
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_pet_api.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_pet_api.py
new file mode 100644
index 000000000000..091b30cf8ac0
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_pet_api.py
@@ -0,0 +1,95 @@
+# 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: https://openapi-generator.tech
+"""
+
+
+from __future__ import absolute_import
+import sys
+import unittest
+
+import petstore_api
+from petstore_api.api.pet_api import PetApi # noqa: E501
+
+
+class TestPetApi(unittest.TestCase):
+ """PetApi unit test stubs"""
+
+ def setUp(self):
+ self.api = PetApi() # noqa: E501
+
+ def tearDown(self):
+ pass
+
+ def test_add_pet(self):
+ """Test case for add_pet
+
+ Add a new pet to the store # noqa: E501
+ """
+ pass
+
+ def test_delete_pet(self):
+ """Test case for delete_pet
+
+ Deletes a pet # noqa: E501
+ """
+ pass
+
+ def test_find_pets_by_status(self):
+ """Test case for find_pets_by_status
+
+ Finds Pets by status # noqa: E501
+ """
+ pass
+
+ def test_find_pets_by_tags(self):
+ """Test case for find_pets_by_tags
+
+ Finds Pets by tags # noqa: E501
+ """
+ pass
+
+ def test_get_pet_by_id(self):
+ """Test case for get_pet_by_id
+
+ Find pet by ID # noqa: E501
+ """
+ pass
+
+ def test_update_pet(self):
+ """Test case for update_pet
+
+ Update an existing pet # noqa: E501
+ """
+ pass
+
+ def test_update_pet_with_form(self):
+ """Test case for update_pet_with_form
+
+ Updates a pet in the store with form data # noqa: E501
+ """
+ pass
+
+ def test_upload_file(self):
+ """Test case for upload_file
+
+ uploads an image # noqa: E501
+ """
+ pass
+
+ def test_upload_file_with_required_file(self):
+ """Test case for upload_file_with_required_file
+
+ uploads an image (required) # noqa: E501
+ """
+ pass
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_player.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_player.py
new file mode 100644
index 000000000000..ee7b95a677f1
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_player.py
@@ -0,0 +1,44 @@
+# 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: https://openapi-generator.tech
+"""
+
+
+from __future__ import absolute_import
+import sys
+import unittest
+
+import petstore_api
+from petstore_api.model.player import Player
+
+
+class TestPlayer(unittest.TestCase):
+ """Player unit test stubs"""
+
+ def setUp(self):
+ pass
+
+ def tearDown(self):
+ pass
+
+ def testPlayer(self):
+ """Test Player"""
+ # we can make a player without an enemy_player property
+ jane = Player(name="Jane")
+ # we can make a player with an enemy_player
+ sally = Player(name="Sally", enemy_player=jane)
+ # we can make a player with an inline enemy_player
+ jim = Player(
+ name="Jim",
+ enemy_player=Player(name="Sam")
+ )
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_read_only_first.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_read_only_first.py
new file mode 100644
index 000000000000..c2dcde240e77
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_read_only_first.py
@@ -0,0 +1,38 @@
+# 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: https://openapi-generator.tech
+"""
+
+
+from __future__ import absolute_import
+import sys
+import unittest
+
+import petstore_api
+from petstore_api.model.read_only_first import ReadOnlyFirst
+
+
+class TestReadOnlyFirst(unittest.TestCase):
+ """ReadOnlyFirst unit test stubs"""
+
+ def setUp(self):
+ pass
+
+ def tearDown(self):
+ pass
+
+ def testReadOnlyFirst(self):
+ """Test ReadOnlyFirst"""
+ # FIXME: construct object with mandatory attributes with example values
+ # model = ReadOnlyFirst() # noqa: E501
+ pass
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_special_model_name.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_special_model_name.py
new file mode 100644
index 000000000000..6124525f5170
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_special_model_name.py
@@ -0,0 +1,38 @@
+# 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: https://openapi-generator.tech
+"""
+
+
+from __future__ import absolute_import
+import sys
+import unittest
+
+import petstore_api
+from petstore_api.model.special_model_name import SpecialModelName
+
+
+class TestSpecialModelName(unittest.TestCase):
+ """SpecialModelName unit test stubs"""
+
+ def setUp(self):
+ pass
+
+ def tearDown(self):
+ pass
+
+ def testSpecialModelName(self):
+ """Test SpecialModelName"""
+ # FIXME: construct object with mandatory attributes with example values
+ # model = SpecialModelName() # noqa: E501
+ pass
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_store_api.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_store_api.py
new file mode 100644
index 000000000000..0d9cc3dd36ea
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_store_api.py
@@ -0,0 +1,60 @@
+# 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: https://openapi-generator.tech
+"""
+
+
+from __future__ import absolute_import
+
+import unittest
+
+import petstore_api
+from petstore_api.api.store_api import StoreApi # noqa: E501
+
+
+class TestStoreApi(unittest.TestCase):
+ """StoreApi unit test stubs"""
+
+ def setUp(self):
+ self.api = StoreApi() # noqa: E501
+
+ def tearDown(self):
+ pass
+
+ def test_delete_order(self):
+ """Test case for delete_order
+
+ Delete purchase order by ID # noqa: E501
+ """
+ pass
+
+ def test_get_inventory(self):
+ """Test case for get_inventory
+
+ Returns pet inventories by status # noqa: E501
+ """
+ pass
+
+ def test_get_order_by_id(self):
+ """Test case for get_order_by_id
+
+ Find purchase order by ID # noqa: E501
+ """
+ pass
+
+ def test_place_order(self):
+ """Test case for place_order
+
+ Place an order for a pet # noqa: E501
+ """
+ pass
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_string_boolean_map.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_string_boolean_map.py
new file mode 100644
index 000000000000..e2e9d8b420b8
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_string_boolean_map.py
@@ -0,0 +1,38 @@
+# 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: https://openapi-generator.tech
+"""
+
+
+from __future__ import absolute_import
+import sys
+import unittest
+
+import petstore_api
+from petstore_api.model.string_boolean_map import StringBooleanMap
+
+
+class TestStringBooleanMap(unittest.TestCase):
+ """StringBooleanMap unit test stubs"""
+
+ def setUp(self):
+ pass
+
+ def tearDown(self):
+ pass
+
+ def testStringBooleanMap(self):
+ """Test StringBooleanMap"""
+ # FIXME: construct object with mandatory attributes with example values
+ # model = StringBooleanMap() # noqa: E501
+ pass
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_string_enum.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_string_enum.py
new file mode 100644
index 000000000000..5eed0ad6f0e9
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_string_enum.py
@@ -0,0 +1,49 @@
+# 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: https://openapi-generator.tech
+"""
+
+
+from __future__ import absolute_import
+import sys
+import unittest
+
+import petstore_api
+from petstore_api.model.string_enum import StringEnum
+
+
+class TestStringEnum(unittest.TestCase):
+ """StringEnum unit test stubs"""
+
+ def setUp(self):
+ pass
+
+ def tearDown(self):
+ pass
+
+ def testStringEnum(self):
+ """Test StringEnum"""
+
+ """Test OuterEnum"""
+ # make sure that we can access its allowed_values
+ assert StringEnum.allowed_values[('value',)] == {
+ 'PLACED': "placed",
+ 'APPROVED': "approved",
+ 'DELIVERED': "delivered"
+ }
+ # make sure that an exception is thrown on an invalid value
+ with self.assertRaises(petstore_api.ApiValueError):
+ StringEnum('bad_value')
+ # make sure valid value works
+ valid_value = StringEnum.allowed_values[('value',)]['PLACED']
+ assert valid_value == StringEnum(valid_value).value
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_tag.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_tag.py
new file mode 100644
index 000000000000..68a3b9046bf4
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_tag.py
@@ -0,0 +1,38 @@
+# 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: https://openapi-generator.tech
+"""
+
+
+from __future__ import absolute_import
+import sys
+import unittest
+
+import petstore_api
+from petstore_api.model.tag import Tag
+
+
+class TestTag(unittest.TestCase):
+ """Tag unit test stubs"""
+
+ def setUp(self):
+ pass
+
+ def tearDown(self):
+ pass
+
+ def testTag(self):
+ """Test Tag"""
+ # FIXME: construct object with mandatory attributes with example values
+ # model = Tag() # noqa: E501
+ pass
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_type_holder_default.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_type_holder_default.py
new file mode 100644
index 000000000000..f9c050b81a82
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_type_holder_default.py
@@ -0,0 +1,41 @@
+# 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: https://openapi-generator.tech
+"""
+
+
+from __future__ import absolute_import
+import sys
+import unittest
+
+import petstore_api
+from petstore_api.model.type_holder_default import TypeHolderDefault
+
+
+class TestTypeHolderDefault(unittest.TestCase):
+ """TypeHolderDefault unit test stubs"""
+
+ def setUp(self):
+ pass
+
+ def tearDown(self):
+ pass
+
+ def testTypeHolderDefault(self):
+ """Test TypeHolderDefault"""
+ # required_vars are set to None now until swagger-parser/swagger-core fixes
+ # https://github.com/swagger-api/swagger-parser/issues/971
+ array_item = [1, 2, 3]
+ model = TypeHolderDefault(array_item=array_item)
+ self.assertEqual(model.string_item, 'what')
+ self.assertEqual(model.bool_item, True)
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_type_holder_example.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_type_holder_example.py
new file mode 100644
index 000000000000..e1ee7c368628
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_type_holder_example.py
@@ -0,0 +1,38 @@
+# 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: https://openapi-generator.tech
+"""
+
+
+from __future__ import absolute_import
+import sys
+import unittest
+
+import petstore_api
+from petstore_api.model.type_holder_example import TypeHolderExample
+
+
+class TestTypeHolderExample(unittest.TestCase):
+ """TypeHolderExample unit test stubs"""
+
+ def setUp(self):
+ pass
+
+ def tearDown(self):
+ pass
+
+ def testTypeHolderExample(self):
+ """Test TypeHolderExample"""
+ # FIXME: construct object with mandatory attributes with example values
+ # model = TypeHolderExample() # noqa: E501
+ pass
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_user.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_user.py
new file mode 100644
index 000000000000..7241bb589c52
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_user.py
@@ -0,0 +1,38 @@
+# 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: https://openapi-generator.tech
+"""
+
+
+from __future__ import absolute_import
+import sys
+import unittest
+
+import petstore_api
+from petstore_api.model.user import User
+
+
+class TestUser(unittest.TestCase):
+ """User unit test stubs"""
+
+ def setUp(self):
+ pass
+
+ def tearDown(self):
+ pass
+
+ def testUser(self):
+ """Test User"""
+ # FIXME: construct object with mandatory attributes with example values
+ # model = User() # noqa: E501
+ pass
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_user_api.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_user_api.py
new file mode 100644
index 000000000000..df306da07761
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_user_api.py
@@ -0,0 +1,88 @@
+# 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: https://openapi-generator.tech
+"""
+
+
+from __future__ import absolute_import
+
+import unittest
+
+import petstore_api
+from petstore_api.api.user_api import UserApi # noqa: E501
+
+
+class TestUserApi(unittest.TestCase):
+ """UserApi unit test stubs"""
+
+ def setUp(self):
+ self.api = UserApi() # noqa: E501
+
+ def tearDown(self):
+ pass
+
+ def test_create_user(self):
+ """Test case for create_user
+
+ Create user # noqa: E501
+ """
+ pass
+
+ def test_create_users_with_array_input(self):
+ """Test case for create_users_with_array_input
+
+ Creates list of users with given input array # noqa: E501
+ """
+ pass
+
+ def test_create_users_with_list_input(self):
+ """Test case for create_users_with_list_input
+
+ Creates list of users with given input array # noqa: E501
+ """
+ pass
+
+ def test_delete_user(self):
+ """Test case for delete_user
+
+ Delete user # noqa: E501
+ """
+ pass
+
+ def test_get_user_by_name(self):
+ """Test case for get_user_by_name
+
+ Get user by user name # noqa: E501
+ """
+ pass
+
+ def test_login_user(self):
+ """Test case for login_user
+
+ Logs user into the system # noqa: E501
+ """
+ pass
+
+ def test_logout_user(self):
+ """Test case for logout_user
+
+ Logs out current logged in user session # noqa: E501
+ """
+ pass
+
+ def test_update_user(self):
+ """Test case for update_user
+
+ Updated user # noqa: E501
+ """
+ pass
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_xml_item.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_xml_item.py
new file mode 100644
index 000000000000..4354664815ff
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_xml_item.py
@@ -0,0 +1,38 @@
+# 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: https://openapi-generator.tech
+"""
+
+
+from __future__ import absolute_import
+import sys
+import unittest
+
+import petstore_api
+from petstore_api.model.xml_item import XmlItem
+
+
+class TestXmlItem(unittest.TestCase):
+ """XmlItem unit test stubs"""
+
+ def setUp(self):
+ pass
+
+ def tearDown(self):
+ pass
+
+ def testXmlItem(self):
+ """Test XmlItem"""
+ # FIXME: construct object with mandatory attributes with example values
+ # model = XmlItem() # noqa: E501
+ pass
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test_python.sh b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test_python.sh
new file mode 100644
index 000000000000..6f5e2c41d3a6
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test_python.sh
@@ -0,0 +1,31 @@
+#!/bin/bash
+
+REQUIREMENTS_FILE=dev-requirements.txt
+REQUIREMENTS_OUT=dev-requirements.txt.log
+SETUP_OUT=*.egg-info
+VENV=venv
+DEACTIVE=false
+
+export LC_ALL=en_US.UTF-8
+export LANG=en_US.UTF-8
+
+### set virtualenv
+if [ -z "$VIRTUAL_ENV" ]; then
+ virtualenv $VENV --no-site-packages --always-copy
+ source $VENV/bin/activate
+ DEACTIVE=true
+fi
+
+### install dependencies
+pip install -r $REQUIREMENTS_FILE | tee -a $REQUIREMENTS_OUT
+
+### run tests
+tox || exit 1
+
+### static analysis of code
+#flake8 --show-source petstore_api/
+
+### deactivate virtualenv
+#if [ $DEACTIVE == true ]; then
+# deactivate
+#fi
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/testfiles/1px_pic1.png b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/testfiles/1px_pic1.png
new file mode 100644
index 000000000000..7d3a386a2102
Binary files /dev/null and b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/testfiles/1px_pic1.png differ
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/testfiles/1px_pic2.png b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/testfiles/1px_pic2.png
new file mode 100644
index 000000000000..7d3a386a2102
Binary files /dev/null and b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/testfiles/1px_pic2.png differ
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/testfiles/foo.png b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/testfiles/foo.png
new file mode 100644
index 000000000000..a9b12cf5927a
Binary files /dev/null and b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/testfiles/foo.png differ
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/tests/__init__.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/tests/__init__.py
new file mode 100644
index 000000000000..e69de29bb2d1
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/tests/test_api_client.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/tests/test_api_client.py
new file mode 100644
index 000000000000..c249bf1fc5e8
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/tests/test_api_client.py
@@ -0,0 +1,221 @@
+# coding: utf-8
+
+# flake8: noqa
+
+"""
+Run the tests.
+$ pip install nose (optional)
+$ cd OpenAPIetstore-python
+$ nosetests -v
+"""
+
+import os
+import time
+import atexit
+import weakref
+import unittest
+from dateutil.parser import parse
+
+import petstore_api
+import petstore_api.configuration
+
+HOST = 'http://petstore.swagger.io/v2'
+
+
+class ApiClientTests(unittest.TestCase):
+
+ def setUp(self):
+ self.api_client = petstore_api.ApiClient()
+
+ def test_configuration(self):
+ config = petstore_api.Configuration()
+ config.host = 'http://localhost/'
+
+ config.api_key['api_key'] = '123456'
+ config.api_key_prefix['api_key'] = 'PREFIX'
+ config.username = 'test_username'
+ config.password = 'test_password'
+
+ header_params = {'test1': 'value1'}
+ query_params = {'test2': 'value2'}
+ auth_settings = ['api_key', 'unknown']
+
+ client = petstore_api.ApiClient(config)
+
+ # test prefix
+ self.assertEqual('PREFIX', client.configuration.api_key_prefix['api_key'])
+
+ # update parameters based on auth setting
+ client.update_params_for_auth(header_params, query_params, auth_settings, resource_path=None, method=None, body=None)
+
+ # test api key auth
+ self.assertEqual(header_params['test1'], 'value1')
+ self.assertEqual(header_params['api_key'], 'PREFIX 123456')
+ self.assertEqual(query_params['test2'], 'value2')
+
+ # test basic auth
+ self.assertEqual('test_username', client.configuration.username)
+ self.assertEqual('test_password', client.configuration.password)
+
+ # test api key without prefix
+ config.api_key['api_key'] = '123456'
+ config.api_key_prefix['api_key'] = None
+ # update parameters based on auth setting
+ client.update_params_for_auth(header_params, query_params, auth_settings, resource_path=None, method=None, body=None)
+ self.assertEqual(header_params['api_key'], '123456')
+
+ # test api key with empty prefix
+ config.api_key['api_key'] = '123456'
+ config.api_key_prefix['api_key'] = ''
+ # update parameters based on auth setting
+ client.update_params_for_auth(header_params, query_params, auth_settings, resource_path=None, method=None, body=None)
+ self.assertEqual(header_params['api_key'], '123456')
+
+ # test api key with prefix specified in the api_key, useful when the prefix
+ # must include '=' sign followed by the API key secret without space.
+ config.api_key['api_key'] = 'PREFIX=123456'
+ config.api_key_prefix['api_key'] = None
+ # update parameters based on auth setting
+ client.update_params_for_auth(header_params, query_params, auth_settings, resource_path=None, method=None, body=None)
+ self.assertEqual(header_params['api_key'], 'PREFIX=123456')
+
+
+ def test_select_header_accept(self):
+ accepts = ['APPLICATION/JSON', 'APPLICATION/XML']
+ accept = self.api_client.select_header_accept(accepts)
+ self.assertEqual(accept, 'application/json')
+
+ accepts = ['application/json', 'application/xml']
+ accept = self.api_client.select_header_accept(accepts)
+ self.assertEqual(accept, 'application/json')
+
+ accepts = ['application/xml', 'application/json']
+ accept = self.api_client.select_header_accept(accepts)
+ self.assertEqual(accept, 'application/json')
+
+ accepts = ['text/plain', 'application/xml']
+ accept = self.api_client.select_header_accept(accepts)
+ self.assertEqual(accept, 'text/plain, application/xml')
+
+ accepts = []
+ accept = self.api_client.select_header_accept(accepts)
+ self.assertEqual(accept, None)
+
+ def test_select_header_content_type(self):
+ content_types = ['APPLICATION/JSON', 'APPLICATION/XML']
+ content_type = self.api_client.select_header_content_type(content_types)
+ self.assertEqual(content_type, 'application/json')
+
+ content_types = ['application/json', 'application/xml']
+ content_type = self.api_client.select_header_content_type(content_types)
+ self.assertEqual(content_type, 'application/json')
+
+ content_types = ['application/xml', 'application/json']
+ content_type = self.api_client.select_header_content_type(content_types)
+ self.assertEqual(content_type, 'application/json')
+
+ content_types = ['text/plain', 'application/xml']
+ content_type = self.api_client.select_header_content_type(content_types)
+ self.assertEqual(content_type, 'text/plain')
+
+ content_types = []
+ content_type = self.api_client.select_header_content_type(content_types)
+ self.assertEqual(content_type, 'application/json')
+
+ def test_sanitize_for_serialization(self):
+ # None
+ data = None
+ result = self.api_client.sanitize_for_serialization(None)
+ self.assertEqual(result, data)
+
+ # str
+ data = "test string"
+ result = self.api_client.sanitize_for_serialization(data)
+ self.assertEqual(result, data)
+
+ # int
+ data = 1
+ result = self.api_client.sanitize_for_serialization(data)
+ self.assertEqual(result, data)
+
+ # bool
+ data = True
+ result = self.api_client.sanitize_for_serialization(data)
+ self.assertEqual(result, data)
+
+ # date
+ data = parse("1997-07-16").date() # date
+ result = self.api_client.sanitize_for_serialization(data)
+ self.assertEqual(result, "1997-07-16")
+
+ # datetime
+ data = parse("1997-07-16T19:20:30.45+01:00") # datetime
+ result = self.api_client.sanitize_for_serialization(data)
+ self.assertEqual(result, "1997-07-16T19:20:30.450000+01:00")
+
+ # list
+ data = [1]
+ result = self.api_client.sanitize_for_serialization(data)
+ self.assertEqual(result, data)
+
+ # dict
+ data = {"test key": "test value"}
+ result = self.api_client.sanitize_for_serialization(data)
+ self.assertEqual(result, data)
+
+ # model
+ pet_dict = {"id": 1, "name": "monkey",
+ "category": {"id": 1, "name": "test category"},
+ "tags": [{"id": 1, "fullName": "test tag1"},
+ {"id": 2, "fullName": "test tag2"}],
+ "status": "available",
+ "photoUrls": ["http://foo.bar.com/3",
+ "http://foo.bar.com/4"]}
+ from petstore_api.model.pet import Pet
+ from petstore_api.model.category import Category
+ from petstore_api.model.tag import Tag
+ from petstore_api.model.string_boolean_map import StringBooleanMap
+ pet = Pet(name=pet_dict["name"], photo_urls=pet_dict["photoUrls"])
+ pet.id = pet_dict["id"]
+ cate = Category()
+ cate.id = pet_dict["category"]["id"]
+ cate.name = pet_dict["category"]["name"]
+ pet.category = cate
+ tag1 = Tag()
+ tag1.id = pet_dict["tags"][0]["id"]
+ tag1.full_name = pet_dict["tags"][0]["fullName"]
+ tag2 = Tag()
+ tag2.id = pet_dict["tags"][1]["id"]
+ tag2.full_name = pet_dict["tags"][1]["fullName"]
+ pet.tags = [tag1, tag2]
+ pet.status = pet_dict["status"]
+
+ data = pet
+ result = self.api_client.sanitize_for_serialization(data)
+ self.assertEqual(result, pet_dict)
+
+ # list of models
+ list_of_pet_dict = [pet_dict]
+ data = [pet]
+ result = self.api_client.sanitize_for_serialization(data)
+ self.assertEqual(result, list_of_pet_dict)
+
+ # model with additional proerties
+ model_dict = {'some_key': True}
+ model = StringBooleanMap(**model_dict)
+ result = self.api_client.sanitize_for_serialization(model)
+ self.assertEqual(result, model_dict)
+
+ def test_context_manager_closes_threadpool(self):
+ with petstore_api.ApiClient() as client:
+ self.assertIsNotNone(client.pool)
+ pool_ref = weakref.ref(client._pool)
+ self.assertIsNotNone(pool_ref())
+ self.assertIsNone(pool_ref())
+
+ def test_atexit_closes_threadpool(self):
+ client = petstore_api.ApiClient()
+ self.assertIsNotNone(client.pool)
+ self.assertIsNotNone(client._pool)
+ atexit._run_exitfuncs()
+ self.assertIsNone(client._pool)
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/tests/test_api_exception.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/tests/test_api_exception.py
new file mode 100644
index 000000000000..0d0771b57850
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/tests/test_api_exception.py
@@ -0,0 +1,86 @@
+# coding: utf-8
+
+# flake8: noqa
+
+"""
+Run the tests.
+$ pip install nose (optional)
+$ cd petstore_api-python
+$ nosetests -v
+"""
+
+import os
+import six
+import sys
+import unittest
+
+import petstore_api
+
+from .util import id_gen
+
+class ApiExceptionTests(unittest.TestCase):
+
+ def setUp(self):
+ self.api_client = petstore_api.ApiClient()
+ from petstore_api.api.pet_api import PetApi
+ self.pet_api = PetApi(self.api_client)
+ self.setUpModels()
+
+ def setUpModels(self):
+ from petstore_api.model import category, tag, pet
+ self.category = category.Category()
+ self.category.id = id_gen()
+ self.category.name = "dog"
+ self.tag = tag.Tag()
+ self.tag.id = id_gen()
+ self.tag.full_name = "blank"
+ self.pet = pet.Pet(name="hello kity", photo_urls=["http://foo.bar.com/1", "http://foo.bar.com/2"])
+ self.pet.id = id_gen()
+ self.pet.status = "sold"
+ self.pet.category = self.category
+ self.pet.tags = [self.tag]
+
+ def test_404_error(self):
+ self.pet_api.add_pet(self.pet)
+ self.pet_api.delete_pet(pet_id=self.pet.id)
+
+ with self.checkRaiseRegex(petstore_api.ApiException, "Pet not found"):
+ self.pet_api.get_pet_by_id(pet_id=self.pet.id)
+
+ try:
+ self.pet_api.get_pet_by_id(pet_id=self.pet.id)
+ except petstore_api.ApiException as e:
+ self.assertEqual(e.status, 404)
+ self.assertEqual(e.reason, "Not Found")
+ self.checkRegex(e.body, "Pet not found")
+
+ def test_500_error(self):
+ self.pet_api.add_pet(self.pet)
+
+ with self.checkRaiseRegex(petstore_api.ApiException, "Internal Server Error"):
+ self.pet_api.upload_file(
+ pet_id=self.pet.id,
+ additional_metadata="special"
+ )
+
+ try:
+ self.pet_api.upload_file(
+ pet_id=self.pet.id,
+ additional_metadata="special"
+ )
+ except petstore_api.ApiException as e:
+ self.assertEqual(e.status, 500)
+ self.assertEqual(e.reason, "Internal Server Error")
+ self.checkRegex(e.body, "Error 500 Internal Server Error")
+
+ def checkRaiseRegex(self, expected_exception, expected_regex):
+ if sys.version_info < (3, 0):
+ return self.assertRaisesRegexp(expected_exception, expected_regex)
+
+ return self.assertRaisesRegex(expected_exception, expected_regex)
+
+ def checkRegex(self, text, expected_regex):
+ if sys.version_info < (3, 0):
+ return self.assertRegexpMatches(text, expected_regex)
+
+ return self.assertRegex(text, expected_regex)
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/tests/test_deserialization.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/tests/test_deserialization.py
new file mode 100644
index 000000000000..92903bb232dd
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/tests/test_deserialization.py
@@ -0,0 +1,442 @@
+# coding: utf-8
+
+# flake8: noqa
+
+"""
+Run the tests.
+$ pip install nose (optional)
+$ cd OpenAPIPetstore-python
+$ nosetests -v
+"""
+from collections import namedtuple
+import json
+import os
+import time
+import unittest
+import datetime
+
+import six
+
+import petstore_api
+
+from petstore_api.exceptions import (
+ ApiTypeError,
+ ApiKeyError,
+ ApiValueError,
+)
+from petstore_api.model import (
+ enum_test,
+ pet,
+ animal,
+ dog,
+ parent_pet,
+ child_lizard,
+ category,
+ string_enum,
+ number_with_validations,
+ string_boolean_map,
+)
+from petstore_api.model_utils import (
+ file_type,
+ model_to_dict,
+)
+
+from petstore_api.rest import RESTResponse
+
+MockResponse = namedtuple('MockResponse', 'data')
+
+class DeserializationTests(unittest.TestCase):
+
+ def setUp(self):
+ self.api_client = petstore_api.ApiClient()
+ self.deserialize = self.api_client.deserialize
+
+ def test_enum_test(self):
+ """ deserialize dict(str, Enum_Test) """
+ data = {
+ 'enum_test': {
+ "enum_string": "UPPER",
+ "enum_string_required": "lower",
+ "enum_integer": 1,
+ "enum_number": 1.1,
+ "stringEnum": "placed"
+ }
+ }
+ response = MockResponse(data=json.dumps(data))
+
+ deserialized = self.deserialize(response,
+ ({str: (enum_test.EnumTest,)},), True)
+ self.assertTrue(isinstance(deserialized, dict))
+ self.assertTrue(
+ isinstance(deserialized['enum_test'], enum_test.EnumTest))
+ value = (
+ string_enum.StringEnum.allowed_values[('value',)]["PLACED"])
+ string_enum_val = string_enum.StringEnum(value)
+ sample_instance = enum_test.EnumTest(
+ enum_string="UPPER",
+ enum_string_required="lower",
+ enum_integer=1,
+ enum_number=1.1,
+ string_enum=string_enum_val
+ )
+ self.assertEqual(deserialized['enum_test'], sample_instance)
+
+ def test_deserialize_dict_str_pet(self):
+ """ deserialize dict(str, Pet) """
+ data = {
+ 'pet': {
+ "id": 0,
+ "category": {
+ "id": 0,
+ "name": "string"
+ },
+ "name": "doggie",
+ "photoUrls": [
+ "string"
+ ],
+ "tags": [
+ {
+ "id": 0,
+ "fullName": "string"
+ }
+ ],
+ "status": "available"
+ }
+ }
+ response = MockResponse(data=json.dumps(data))
+
+ deserialized = self.deserialize(response,
+ ({str: (pet.Pet,)},), True)
+ self.assertTrue(isinstance(deserialized, dict))
+ self.assertTrue(isinstance(deserialized['pet'], pet.Pet))
+
+ def test_deserialize_dict_str_dog(self):
+ """ deserialize dict(str, Dog), use discriminator
+ This will fail because additional_properties_type is None in Animal and it must be defined as any type
+ to allow in the property breed which is not defined in Animal, it is defined in Dog
+ """
+ with self.assertRaises(petstore_api.exceptions.ApiValueError):
+ data = {
+ 'dog': {
+ "className": "Dog",
+ "color": "white",
+ "breed": "Jack Russel Terrier"
+ }
+ }
+ response = MockResponse(data=json.dumps(data))
+
+ deserialized = self.deserialize(response,
+ ({str: (animal.Animal,)},), True)
+
+ def test_deserialize_lizard(self):
+ """ deserialize ChildLizard, use discriminator
+ because additional_properties_type is None in ChildLizardAllOf
+ we are unable to use the discriminator
+ For this to work correctly, additional_properties_type must allow in any type
+ Then in ChildLizardAllOf defines the property pet_type and allows in lovesRocks as an additionalProperty
+ """
+ with self.assertRaises(petstore_api.exceptions.ApiValueError):
+ data = {
+ "pet_type": "ChildLizard",
+ "lovesRocks": True
+ }
+ response = MockResponse(data=json.dumps(data))
+
+ lizard = self.deserialize(response,
+ (parent_pet.ParentPet,), True)
+
+ def test_deserialize_dict_str_int(self):
+ """ deserialize dict(str, int) """
+ data = {
+ 'integer': 1
+ }
+ response = MockResponse(data=json.dumps(data))
+
+ deserialized = self.deserialize(response, ({str: (int,)},), True)
+ self.assertTrue(isinstance(deserialized, dict))
+ self.assertTrue(isinstance(deserialized['integer'], int))
+
+ def test_deserialize_str(self):
+ """ deserialize str """
+ data = "test str"
+ response = MockResponse(data=json.dumps(data))
+
+ deserialized = self.deserialize(response, (str,), True)
+ self.assertTrue(isinstance(deserialized, str))
+
+ def test_deserialize_date(self):
+ """ deserialize date """
+ data = "1997-07-16"
+ response = MockResponse(data=json.dumps(data))
+
+ deserialized = self.deserialize(response, (datetime.date,), True)
+ self.assertTrue(isinstance(deserialized, datetime.date))
+
+ def test_deserialize_datetime(self):
+ """ deserialize datetime """
+ data = "1997-07-16T19:20:30.45+01:00"
+ response = MockResponse(data=json.dumps(data))
+
+ deserialized = self.deserialize(response, (datetime.datetime,), True)
+ self.assertTrue(isinstance(deserialized, datetime.datetime))
+
+ def test_deserialize_pet(self):
+ """ deserialize pet """
+ data = {
+ "id": 0,
+ "category": {
+ "id": 0,
+ "name": "string"
+ },
+ "name": "doggie",
+ "photoUrls": [
+ "string"
+ ],
+ "tags": [
+ {
+ "id": 0,
+ "fullName": "string"
+ }
+ ],
+ "status": "available"
+ }
+ response = MockResponse(data=json.dumps(data))
+
+ deserialized = self.deserialize(response, (pet.Pet,), True)
+ self.assertTrue(isinstance(deserialized, pet.Pet))
+ self.assertEqual(deserialized.id, 0)
+ self.assertEqual(deserialized.name, "doggie")
+ self.assertTrue(isinstance(deserialized.category, category.Category))
+ self.assertEqual(deserialized.category.name, "string")
+ self.assertTrue(isinstance(deserialized.tags, list))
+ self.assertEqual(deserialized.tags[0].full_name, "string")
+
+ def test_deserialize_list_of_pet(self):
+ """ deserialize list[Pet] """
+ data = [
+ {
+ "id": 0,
+ "category": {
+ "id": 0,
+ "name": "string"
+ },
+ "name": "doggie0",
+ "photoUrls": [
+ "string"
+ ],
+ "tags": [
+ {
+ "id": 0,
+ "fullName": "string"
+ }
+ ],
+ "status": "available"
+ },
+ {
+ "id": 1,
+ "category": {
+ "id": 0,
+ "name": "string"
+ },
+ "name": "doggie1",
+ "photoUrls": [
+ "string"
+ ],
+ "tags": [
+ {
+ "id": 0,
+ "fullName": "string"
+ }
+ ],
+ "status": "available"
+ }]
+ response = MockResponse(data=json.dumps(data))
+
+ deserialized = self.deserialize(response,
+ ([pet.Pet],), True)
+ self.assertTrue(isinstance(deserialized, list))
+ self.assertTrue(isinstance(deserialized[0], pet.Pet))
+ self.assertEqual(deserialized[0].id, 0)
+ self.assertEqual(deserialized[1].id, 1)
+ self.assertEqual(deserialized[0].name, "doggie0")
+ self.assertEqual(deserialized[1].name, "doggie1")
+
+ def test_deserialize_nested_dict(self):
+ """ deserialize dict(str, dict(str, int)) """
+ data = {
+ "foo": {
+ "bar": 1
+ }
+ }
+ response = MockResponse(data=json.dumps(data))
+
+ deserialized = self.deserialize(response,
+ ({str: ({str: (int,)},)},), True)
+ self.assertTrue(isinstance(deserialized, dict))
+ self.assertTrue(isinstance(deserialized["foo"], dict))
+ self.assertTrue(isinstance(deserialized["foo"]["bar"], int))
+
+ def test_deserialize_nested_list(self):
+ """ deserialize list[list[str]] """
+ data = [["foo"]]
+ response = MockResponse(data=json.dumps(data))
+
+ deserialized = self.deserialize(response, ([[str]],), True)
+ self.assertTrue(isinstance(deserialized, list))
+ self.assertTrue(isinstance(deserialized[0], list))
+ self.assertTrue(isinstance(deserialized[0][0], str))
+
+ def test_deserialize_none(self):
+ """ deserialize None """
+ response = MockResponse(data=json.dumps(None))
+
+ error_msg = (
+ "Invalid type for variable 'received_data'. Required value type is "
+ "datetime and passed type was NoneType at ['received_data']"
+ )
+ with self.assertRaises(ApiTypeError) as exc:
+ deserialized = self.deserialize(response, (datetime.datetime,), True)
+ self.assertEqual(str(exc.exception), error_msg)
+
+ def test_deserialize_OuterEnum(self):
+ """ deserialize OuterEnum """
+ # make sure that an exception is thrown on an invalid value
+ with self.assertRaises(ApiValueError):
+ self.deserialize(
+ MockResponse(data=json.dumps("test str")),
+ (string_enum.StringEnum,),
+ True
+ )
+
+ # valid value works
+ placed_str = (
+ string_enum.StringEnum.allowed_values[('value',)]["PLACED"]
+ )
+ response = MockResponse(data=json.dumps(placed_str))
+ deserialized = self.deserialize(response,
+ (string_enum.StringEnum,), True)
+ self.assertTrue(isinstance(deserialized, string_enum.StringEnum))
+ self.assertTrue(deserialized.value == placed_str)
+
+ def test_deserialize_NumberWithValidations(self):
+ """ deserialize NumberWithValidations """
+ # make sure that an exception is thrown on an invalid type value
+ with self.assertRaises(ApiTypeError):
+ deserialized = self.deserialize(
+ MockResponse(data=json.dumps("test str")),
+ (number_with_validations.NumberWithValidations,),
+ True
+ )
+
+ # make sure that an exception is thrown on an invalid value
+ with self.assertRaises(ApiValueError):
+ deserialized = self.deserialize(
+ MockResponse(data=json.dumps(21.0)),
+ (number_with_validations.NumberWithValidations,),
+ True
+ )
+
+ # valid value works
+ number_val = 11.0
+ response = MockResponse(data=json.dumps(number_val))
+ number = self.deserialize(response,
+ (number_with_validations.NumberWithValidations,), True)
+ self.assertTrue(isinstance(number, number_with_validations.NumberWithValidations))
+ self.assertTrue(number.value == number_val)
+
+ def test_deserialize_file(self):
+ """Ensures that file deserialization works"""
+ response_types_mixed = (file_type,)
+
+ # sample from http://www.jtricks.com/download-text
+ HTTPResponse = namedtuple(
+ 'urllib3_response_HTTPResponse',
+ ['status', 'reason', 'data', 'getheaders', 'getheader']
+ )
+ headers = {'Content-Disposition': 'attachment; filename=content.txt'}
+ def get_headers():
+ return headers
+ def get_header(name, default=None):
+ return headers.get(name, default)
+ file_data = (
+ "You are reading text file that was supposed to be downloaded\r\n"
+ "to your hard disk. If your browser offered to save you the file,"
+ "\r\nthen it handled the Content-Disposition header correctly."
+ )
+ http_response = HTTPResponse(
+ status=200,
+ reason='OK',
+ data=file_data,
+ getheaders=get_headers,
+ getheader=get_header
+ )
+ # response which is deserialized to a file
+ mock_response = RESTResponse(http_response)
+ file_path = None
+ try:
+ file_object = self.deserialize(
+ mock_response, response_types_mixed, True)
+ self.assertTrue(isinstance(file_object, file_type))
+ file_path = file_object.name
+ self.assertFalse(file_object.closed)
+ file_object.close()
+ if six.PY3:
+ file_data = file_data.encode('utf-8')
+ with open(file_path, 'rb') as other_file_object:
+ self.assertEqual(other_file_object.read(), file_data)
+ finally:
+ os.unlink(file_path)
+
+ def test_deserialize_binary_to_str(self):
+ """Ensures that bytes deserialization works"""
+ response_types_mixed = (str,)
+
+ # sample from http://www.jtricks.com/download-text
+ HTTPResponse = namedtuple(
+ 'urllib3_response_HTTPResponse',
+ ['status', 'reason', 'data', 'getheaders', 'getheader']
+ )
+ headers = {}
+ def get_headers():
+ return headers
+ def get_header(name, default=None):
+ return headers.get(name, default)
+ data = "str"
+
+ http_response = HTTPResponse(
+ status=200,
+ reason='OK',
+ data=json.dumps(data).encode("utf-8") if six.PY3 else json.dumps(data),
+ getheaders=get_headers,
+ getheader=get_header
+ )
+
+ mock_response = RESTResponse(http_response)
+
+ result = self.deserialize(mock_response, response_types_mixed, True)
+ self.assertEqual(isinstance(result, str), True)
+ self.assertEqual(result, data)
+
+ def test_deserialize_string_boolean_map(self):
+ """
+ Ensures that string boolean (additional properties)
+ deserialization works
+ """
+ # make sure that an exception is thrown on an invalid type
+ with self.assertRaises(ApiTypeError):
+ deserialized = self.deserialize(
+ MockResponse(data=json.dumps("test str")),
+ (string_boolean_map.StringBooleanMap,),
+ True
+ )
+
+ # valid value works
+ item_val = {'some_key': True}
+ response = MockResponse(data=json.dumps(item_val))
+ model = string_boolean_map.StringBooleanMap(**item_val)
+ deserialized = self.deserialize(response,
+ (string_boolean_map.StringBooleanMap,), True)
+ self.assertTrue(isinstance(deserialized, string_boolean_map.StringBooleanMap))
+ self.assertTrue(deserialized['some_key'] == True)
+ self.assertTrue(deserialized == model)
+
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/tests/test_pet_api.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/tests/test_pet_api.py
new file mode 100644
index 000000000000..38d7a1cc0b82
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/tests/test_pet_api.py
@@ -0,0 +1,406 @@
+# coding: utf-8
+
+# flake8: noqa
+
+"""
+Run the tests.
+$ docker pull swaggerapi/petstore
+$ docker run -d -e SWAGGER_HOST=http://petstore.swagger.io -e SWAGGER_BASE_PATH=/v2 -p 80:8080 swaggerapi/petstore
+$ pip install nose (optional)
+$ cd petstore_api-python
+$ nosetests -v
+"""
+
+from collections import namedtuple
+import json
+import os
+import unittest
+
+import petstore_api
+from petstore_api import Configuration
+from petstore_api.rest import (
+ RESTClientObject,
+ RESTResponse
+)
+
+import six
+
+from petstore_api.exceptions import (
+ ApiException,
+ ApiValueError,
+ ApiTypeError,
+)
+from petstore_api.api.pet_api import PetApi
+from petstore_api.model import pet
+from .util import id_gen
+
+import urllib3
+
+if six.PY3:
+ from unittest.mock import patch
+else:
+ from mock import patch
+
+HOST = 'http://localhost/v2'
+
+
+class TimeoutWithEqual(urllib3.Timeout):
+ def __init__(self, *arg, **kwargs):
+ super(TimeoutWithEqual, self).__init__(*arg, **kwargs)
+
+ def __eq__(self, other):
+ return self._read == other._read and self._connect == other._connect and self.total == other.total
+
+
+class MockPoolManager(object):
+ def __init__(self, tc):
+ self._tc = tc
+ self._reqs = []
+
+ def expect_request(self, *args, **kwargs):
+ self._reqs.append((args, kwargs))
+
+ def request(self, *args, **kwargs):
+ self._tc.assertTrue(len(self._reqs) > 0)
+ r = self._reqs.pop(0)
+ self._tc.maxDiff = None
+ self._tc.assertEqual(r[0], args)
+ self._tc.assertEqual(r[1], kwargs)
+ return urllib3.HTTPResponse(status=200, body=b'test')
+
+
+class PetApiTests(unittest.TestCase):
+
+ def setUp(self):
+ config = Configuration()
+ config.host = HOST
+ config.access_token = 'ACCESS_TOKEN'
+ self.api_client = petstore_api.ApiClient(config)
+ self.pet_api = PetApi(self.api_client)
+ self.setUpModels()
+ self.setUpFiles()
+
+ def setUpModels(self):
+ from petstore_api.model import category, tag
+ self.category = category.Category()
+ self.category.id = id_gen()
+ self.category.name = "dog"
+ self.tag = tag.Tag()
+ self.tag.id = id_gen()
+ self.tag.name = "python-pet-tag"
+ self.pet = pet.Pet(name="hello kity", photo_urls=["http://foo.bar.com/1", "http://foo.bar.com/2"])
+ self.pet.id = id_gen()
+ self.pet.status = "sold"
+ self.pet.category = self.category
+ self.pet.tags = [self.tag]
+
+ def setUpFiles(self):
+ self.test_file_dir = os.path.join(os.path.dirname(__file__), "..", "testfiles")
+ self.test_file_dir = os.path.realpath(self.test_file_dir)
+
+ def test_preload_content_flag(self):
+ self.pet_api.add_pet(self.pet)
+
+ resp = self.pet_api.find_pets_by_status(status=[self.pet.status], _preload_content=False)
+
+ # return response should at least have read and close methods.
+ self.assertTrue(hasattr(resp, 'read'))
+ self.assertTrue(hasattr(resp, 'close'))
+
+ # Also we need to make sure we can release the connection to a pool (if exists) when we are done with it.
+ self.assertTrue(hasattr(resp, 'release_conn'))
+
+ # Right now, the client returns urllib3.HTTPResponse. If that changed in future, it is probably a breaking
+ # change, however supporting above methods should be enough for most usecases. Remove this test case if
+ # we followed the breaking change procedure for python client (e.g. increasing major version).
+ self.assertTrue(resp.__class__, 'urllib3.response.HTTPResponse')
+
+ resp.close()
+ resp.release_conn()
+
+ def test_config(self):
+ config = Configuration(host=HOST)
+ self.assertIsNotNone(config.get_host_settings())
+ self.assertEqual(config.get_basic_auth_token(),
+ urllib3.util.make_headers(basic_auth=":").get('authorization'))
+ # No authentication scheme has been configured at this point, so auth_settings()
+ # should return an empty list.
+ self.assertEqual(len(config.auth_settings()), 0)
+ # Configure OAuth2 access token and verify the auth_settings have OAuth2 parameters.
+ config.access_token = 'MY-ACCESS_TOKEN'
+ self.assertEqual(len(config.auth_settings()), 1)
+ self.assertIn("petstore_auth", config.auth_settings().keys())
+ config.username = "user"
+ config.password = "password"
+ self.assertEqual(
+ config.get_basic_auth_token(),
+ urllib3.util.make_headers(basic_auth="user:password").get('authorization'))
+ self.assertEqual(len(config.auth_settings()), 2)
+ self.assertIn("petstore_auth", config.auth_settings().keys())
+ self.assertIn("http_basic_test", config.auth_settings().keys())
+ config.username = None
+ config.password = None
+ self.assertEqual(len(config.auth_settings()), 1)
+ self.assertIn("petstore_auth", config.auth_settings().keys())
+
+ def test_timeout(self):
+ mock_pool = MockPoolManager(self)
+ self.api_client.rest_client.pool_manager = mock_pool
+
+ mock_pool.expect_request('POST', 'http://localhost/v2/pet',
+ body=json.dumps(self.api_client.sanitize_for_serialization(self.pet)),
+ headers={'Content-Type': 'application/json',
+ 'Authorization': 'Bearer ACCESS_TOKEN',
+ 'User-Agent': 'OpenAPI-Generator/1.0.0/python'},
+ preload_content=True, timeout=TimeoutWithEqual(total=5))
+ mock_pool.expect_request('POST', 'http://localhost/v2/pet',
+ body=json.dumps(self.api_client.sanitize_for_serialization(self.pet)),
+ headers={'Content-Type': 'application/json',
+ 'Authorization': 'Bearer ACCESS_TOKEN',
+ 'User-Agent': 'OpenAPI-Generator/1.0.0/python'},
+ preload_content=True, timeout=TimeoutWithEqual(connect=1, read=2))
+
+ self.pet_api.add_pet(self.pet, _request_timeout=5)
+ self.pet_api.add_pet(self.pet, _request_timeout=(1, 2))
+
+ def test_separate_default_client_instances(self):
+ pet_api = PetApi()
+ pet_api2 = PetApi()
+ self.assertNotEqual(pet_api.api_client, pet_api2.api_client)
+
+ pet_api.api_client.user_agent = 'api client 3'
+ pet_api2.api_client.user_agent = 'api client 4'
+
+ self.assertNotEqual(pet_api.api_client.user_agent, pet_api2.api_client.user_agent)
+
+ def test_separate_default_config_instances(self):
+ pet_api = PetApi()
+ pet_api2 = PetApi()
+ self.assertNotEqual(pet_api.api_client.configuration, pet_api2.api_client.configuration)
+
+ pet_api.api_client.configuration.host = 'somehost'
+ pet_api2.api_client.configuration.host = 'someotherhost'
+ self.assertNotEqual(pet_api.api_client.configuration.host, pet_api2.api_client.configuration.host)
+
+ def test_async_request(self):
+ thread = self.pet_api.add_pet(self.pet, async_req=True)
+ response = thread.get()
+ self.assertIsNone(response)
+
+ thread = self.pet_api.get_pet_by_id(self.pet.id, async_req=True)
+ result = thread.get()
+ self.assertIsInstance(result, pet.Pet)
+
+ def test_async_with_result(self):
+ self.pet_api.add_pet(self.pet, async_req=False)
+
+ thread = self.pet_api.get_pet_by_id(self.pet.id, async_req=True)
+ thread2 = self.pet_api.get_pet_by_id(self.pet.id, async_req=True)
+
+ response = thread.get()
+ response2 = thread2.get()
+
+ self.assertEqual(response.id, self.pet.id)
+ self.assertIsNotNone(response2.id, self.pet.id)
+
+ def test_async_with_http_info(self):
+ self.pet_api.add_pet(self.pet)
+
+ thread = self.pet_api.get_pet_by_id(self.pet.id, async_req=True,
+ _return_http_data_only=False)
+ data, status, headers = thread.get()
+
+ self.assertIsInstance(data, pet.Pet)
+ self.assertEqual(status, 200)
+
+ def test_async_exception(self):
+ self.pet_api.add_pet(self.pet)
+
+ thread = self.pet_api.get_pet_by_id(-9999999999999, async_req=True)
+
+ exception = None
+ try:
+ thread.get()
+ except ApiException as e:
+ exception = e
+
+ self.assertIsInstance(exception, ApiException)
+ self.assertEqual(exception.status, 404)
+
+ def test_add_pet_and_get_pet_by_id(self):
+ self.pet_api.add_pet(self.pet)
+
+ fetched = self.pet_api.get_pet_by_id(pet_id=self.pet.id)
+ self.assertIsNotNone(fetched)
+ self.assertEqual(self.pet.id, fetched.id)
+ self.assertIsNotNone(fetched.category)
+ self.assertEqual(self.pet.category.name, fetched.category.name)
+
+ def test_add_pet_and_get_pet_by_id_with_http_info(self):
+ self.pet_api.add_pet(self.pet)
+
+ fetched = self.pet_api.get_pet_by_id(
+ pet_id=self.pet.id,
+ _return_http_data_only=False
+ )
+ self.assertIsNotNone(fetched)
+ self.assertEqual(self.pet.id, fetched[0].id)
+ self.assertIsNotNone(fetched[0].category)
+ self.assertEqual(self.pet.category.name, fetched[0].category.name)
+
+ def test_update_pet(self):
+ self.pet.name = "hello kity with updated"
+ self.pet_api.update_pet(self.pet)
+
+ fetched = self.pet_api.get_pet_by_id(pet_id=self.pet.id)
+ self.assertIsNotNone(fetched)
+ self.assertEqual(self.pet.id, fetched.id)
+ self.assertEqual(self.pet.name, fetched.name)
+ self.assertIsNotNone(fetched.category)
+ self.assertEqual(fetched.category.name, self.pet.category.name)
+
+ def test_find_pets_by_status(self):
+ self.pet_api.add_pet(self.pet)
+
+ self.assertIn(
+ self.pet.id,
+ list(map(lambda x: getattr(x, 'id'), self.pet_api.find_pets_by_status(status=[self.pet.status])))
+ )
+
+ def test_find_pets_by_tags(self):
+ self.pet_api.add_pet(self.pet)
+
+ self.assertIn(
+ self.pet.id,
+ list(map(lambda x: getattr(x, 'id'), self.pet_api.find_pets_by_tags(tags=[self.tag.name])))
+ )
+
+ def test_update_pet_with_form(self):
+ self.pet_api.add_pet(self.pet)
+
+ name = "hello kity with form updated"
+ status = "pending"
+ self.pet_api.update_pet_with_form(pet_id=self.pet.id, name=name, status=status)
+
+ fetched = self.pet_api.get_pet_by_id(pet_id=self.pet.id)
+ self.assertEqual(self.pet.id, fetched.id)
+ self.assertEqual(name, fetched.name)
+ self.assertEqual(status, fetched.status)
+
+ def test_upload_file(self):
+ # upload file with form parameter
+ file_path1 = os.path.join(self.test_file_dir, "1px_pic1.png")
+ file_path2 = os.path.join(self.test_file_dir, "1px_pic2.png")
+ try:
+ file = open(file_path1, "rb")
+ additional_metadata = "special"
+ self.pet_api.upload_file(
+ pet_id=self.pet.id,
+ additional_metadata=additional_metadata,
+ file=file
+ )
+ except ApiException as e:
+ self.fail("upload_file() raised {0} unexpectedly".format(type(e)))
+ finally:
+ file.close()
+
+ # upload only one file
+ try:
+ file = open(file_path1, "rb")
+ self.pet_api.upload_file(pet_id=self.pet.id, file=file)
+ except ApiException as e:
+ self.fail("upload_file() raised {0} unexpectedly".format(type(e)))
+ finally:
+ file.close()
+
+ # upload multiple files
+ HTTPResponse = namedtuple(
+ 'urllib3_response_HTTPResponse',
+ ['status', 'reason', 'data', 'getheaders', 'getheader']
+ )
+ headers = {}
+ def get_headers():
+ return headers
+ def get_header(name, default=None):
+ return headers.get(name, default)
+ api_respponse = {
+ 'code': 200,
+ 'type': 'blah',
+ 'message': 'file upload succeeded'
+ }
+ http_response = HTTPResponse(
+ status=200,
+ reason='OK',
+ data=json.dumps(api_respponse).encode('utf-8'),
+ getheaders=get_headers,
+ getheader=get_header
+ )
+ mock_response = RESTResponse(http_response)
+ try:
+ file1 = open(file_path1, "rb")
+ file2 = open(file_path2, "rb")
+ with patch.object(RESTClientObject, 'request') as mock_method:
+ mock_method.return_value = mock_response
+ res = self.pet_api.upload_file(
+ pet_id=684696917, files=[file1, file2])
+ mock_method.assert_called_with(
+ 'POST',
+ 'http://localhost/v2/pet/684696917/uploadImage',
+ _preload_content=True,
+ _request_timeout=None,
+ body=None,
+ headers={
+ 'Accept': 'application/json',
+ 'Content-Type': 'multipart/form-data',
+ 'User-Agent': 'OpenAPI-Generator/1.0.0/python',
+ 'Authorization': 'Bearer ACCESS_TOKEN'
+ },
+ post_params=[
+ ('files', ('1px_pic1.png', b'\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x00\x01\x00\x00\x00\x01\x08\x00\x00\x00\x00:~\x9bU\x00\x00\x00\nIDATx\x9cc\xfa\x0f\x00\x01\x05\x01\x02\xcf\xa0.\xcd\x00\x00\x00\x00IEND\xaeB`\x82', 'image/png')),
+ ('files', ('1px_pic2.png', b'\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x00\x01\x00\x00\x00\x01\x08\x00\x00\x00\x00:~\x9bU\x00\x00\x00\nIDATx\x9cc\xfa\x0f\x00\x01\x05\x01\x02\xcf\xa0.\xcd\x00\x00\x00\x00IEND\xaeB`\x82', 'image/png'))
+ ],
+ query_params=[]
+ )
+ except ApiException as e:
+ self.fail("upload_file() raised {0} unexpectedly".format(type(e)))
+ finally:
+ file1.close()
+ file2.close()
+
+ # passing in an array of files to when file only allows one
+ # raises an exceptions
+ try:
+ file = open(file_path1, "rb")
+ with self.assertRaises(ApiTypeError) as exc:
+ self.pet_api.upload_file(pet_id=self.pet.id, file=[file])
+ finally:
+ file.close()
+
+ # passing in a single file when an array of file is required
+ # raises an exception
+ try:
+ file = open(file_path1, "rb")
+ with self.assertRaises(ApiTypeError) as exc:
+ self.pet_api.upload_file(pet_id=self.pet.id, files=file)
+ finally:
+ file.close()
+
+ # passing in a closed file raises an exception
+ with self.assertRaises(ApiValueError) as exc:
+ file = open(file_path1, "rb")
+ file.close()
+ self.pet_api.upload_file(pet_id=self.pet.id, file=file)
+
+
+ def test_delete_pet(self):
+ self.pet_api.add_pet(self.pet)
+ self.pet_api.delete_pet(pet_id=self.pet.id, api_key="special-key")
+
+ try:
+ self.pet_api.get_pet_by_id(pet_id=self.pet.id)
+ raise Exception("expected an error")
+ except ApiException as e:
+ self.assertEqual(404, e.status)
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/tests/test_serialization.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/tests/test_serialization.py
new file mode 100644
index 000000000000..1f718ecca6b5
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/tests/test_serialization.py
@@ -0,0 +1,78 @@
+# coding: utf-8
+
+# flake8: noqa
+
+"""
+Run the tests.
+$ pip install nose (optional)
+$ cd OpenAPIPetstore-python
+$ nosetests -v
+"""
+from collections import namedtuple
+import json
+import os
+import time
+import unittest
+import datetime
+
+import six
+
+import petstore_api
+
+from petstore_api.exceptions import (
+ ApiTypeError,
+ ApiKeyError,
+ ApiValueError,
+)
+from petstore_api.model import (
+ enum_test,
+ pet,
+ animal,
+ dog,
+ parent_pet,
+ child_lizard,
+ category,
+ string_enum,
+ string_boolean_map,
+)
+from petstore_api.model_utils import (
+ file_type,
+ model_to_dict,
+)
+
+from petstore_api.rest import RESTResponse
+
+MockResponse = namedtuple('MockResponse', 'data')
+
+class SerializationTests(unittest.TestCase):
+
+ def setUp(self):
+ self.api_client = petstore_api.ApiClient()
+ self.serialize = self.api_client.sanitize_for_serialization
+
+ def test_enum_test(self):
+ """ serialize dict(str, Enum_Test) """
+ value = (
+ string_enum.StringEnum.allowed_values[('value',)]["PLACED"])
+ string_enum_val = string_enum.StringEnum(value)
+
+ source = enum_test.EnumTest(
+ enum_string="UPPER",
+ enum_string_required="lower",
+ enum_integer=1,
+ enum_number=1.1,
+ string_enum=string_enum_val
+ )
+
+ result = {
+ 'enum_test': {
+ "enum_string": "UPPER",
+ "enum_string_required": "lower",
+ "enum_integer": 1,
+ "enum_number": 1.1,
+ "stringEnum": "placed"
+ }
+ }
+ serialized = self.serialize({"enum_test": source})
+
+ self.assertEqual(result, serialized)
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/tests/test_store_api.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/tests/test_store_api.py
new file mode 100644
index 000000000000..a7c1d5dd6670
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/tests/test_store_api.py
@@ -0,0 +1,32 @@
+# coding: utf-8
+
+# flake8: noqa
+
+"""
+Run the tests.
+$ pip install nose (optional)
+$ cd OpenAP/Petstore-python
+$ nosetests -v
+"""
+
+import os
+import time
+import unittest
+
+import petstore_api
+from petstore_api.api.store_api import StoreApi
+
+
+class StoreApiTests(unittest.TestCase):
+
+ def setUp(self):
+ self.store_api = StoreApi()
+
+ def tearDown(self):
+ # sleep 1 sec between two every 2 tests
+ time.sleep(1)
+
+ def test_get_inventory(self):
+ data = self.store_api.get_inventory()
+ self.assertIsNotNone(data)
+ self.assertTrue(isinstance(data, dict))
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/tests/util.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/tests/util.py
new file mode 100644
index 000000000000..113d7dcc5478
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/tests/util.py
@@ -0,0 +1,8 @@
+# flake8: noqa
+
+import random
+
+
+def id_gen(bits=32):
+ """ Returns a n-bit randomly generated int """
+ return int(random.getrandbits(bits))
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/tox.ini b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/tox.ini
new file mode 100644
index 000000000000..8989fc3c4d96
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/tox.ini
@@ -0,0 +1,9 @@
+[tox]
+envlist = py3
+
+[testenv]
+deps=-r{toxinidir}/requirements.txt
+ -r{toxinidir}/test-requirements.txt
+
+commands=
+ pytest --cov=petstore_api
diff --git a/samples/openapi3/client/extensions/x-auth-id-alias/python/x_auth_id_alias/model_utils.py b/samples/openapi3/client/extensions/x-auth-id-alias/python/x_auth_id_alias/model_utils.py
index 3276615fd49a..1746d5c1a90d 100644
--- a/samples/openapi3/client/extensions/x-auth-id-alias/python/x_auth_id_alias/model_utils.py
+++ b/samples/openapi3/client/extensions/x-auth-id-alias/python/x_auth_id_alias/model_utils.py
@@ -434,27 +434,43 @@ def __setitem__(self, name, value):
self.__dict__[name] = value
return
- # set the attribute on the correct instance
- model_instances = self._var_name_to_model_instances.get(
- name, self._additional_properties_model_instances)
- if model_instances:
- for model_instance in model_instances:
- if model_instance == self:
- self.set_attribute(name, value)
- else:
- setattr(model_instance, name, value)
- if name not in self._var_name_to_model_instances:
- # we assigned an additional property
- self.__dict__['_var_name_to_model_instances'][name] = (
- model_instance
- )
- return None
-
- raise ApiAttributeError(
- "{0} has no attribute '{1}'".format(
- type(self).__name__, name),
- [e for e in [self._path_to_item, name] if e]
- )
+ """
+ Use cases:
+ 1. additional_properties_type is None (additionalProperties == False in spec)
+ Check for property presence in self.openapi_types
+ if not present then throw an error
+ if present set in self, set attribute
+ always set on composed schemas
+ 2. additional_properties_type exists
+ set attribute on self
+ always set on composed schemas
+ """
+ if self.additional_properties_type is None:
+ """
+ For an attribute to exist on a composed schema it must:
+ - fulfill schema_requirements in the self composed schema not considering oneOf/anyOf/allOf schemas AND
+ - fulfill schema_requirements in each oneOf/anyOf/allOf schemas
+
+ schema_requirements:
+ For an attribute to exist on a schema it must:
+ - be present in properties at the schema OR
+ - have additionalProperties unset (defaults additionalProperties = any type) OR
+ - have additionalProperties set
+ """
+ if name not in self.openapi_types:
+ raise ApiAttributeError(
+ "{0} has no attribute '{1}'".format(
+ type(self).__name__, name),
+ [e for e in [self._path_to_item, name] if e]
+ )
+ # attribute must be set on self and composed instances
+ self.set_attribute(name, value)
+ for model_instance in self._composed_instances:
+ setattr(model_instance, name, value)
+ if name not in self._var_name_to_model_instances:
+ # we assigned an additional property
+ self.__dict__['_var_name_to_model_instances'][name] = self._composed_instances + [self]
+ return None
__unset_attribute_value__ = object()
@@ -464,13 +480,12 @@ def get(self, name, default=None):
return self.__dict__[name]
# get the attribute from the correct instance
- model_instances = self._var_name_to_model_instances.get(
- name, self._additional_properties_model_instances)
+ model_instances = self._var_name_to_model_instances.get(name)
values = []
- # A composed model stores child (oneof/anyOf/allOf) models under
- # self._var_name_to_model_instances. A named property can exist in
- # multiple child models. If the property is present in more than one
- # child model, the value must be the same across all the child models.
+ # A composed model stores self and child (oneof/anyOf/allOf) models under
+ # self._var_name_to_model_instances.
+ # Any property must exist in self and all model instances
+ # The value stored in all model instances must be the same
if model_instances:
for model_instance in model_instances:
if name in model_instance._data_store:
@@ -1573,8 +1588,13 @@ def get_allof_instances(self, model_args, constant_args):
self: the class we are handling
model_args (dict): var_name to var_value
used to make instances
- constant_args (dict): var_name to var_value
- used to make instances
+ constant_args (dict):
+ metadata arguments:
+ _check_type
+ _path_to_item
+ _spec_property_naming
+ _configuration
+ _visited_composed_classes
Returns
composed_instances (list)
@@ -1582,20 +1602,8 @@ def get_allof_instances(self, model_args, constant_args):
composed_instances = []
for allof_class in self._composed_schemas['allOf']:
- # no need to handle changing js keys to python because
- # for composed schemas, allof parameters are included in the
- # composed schema and were changed to python keys in __new__
- # extract a dict of only required keys from fixed_model_args
- kwargs = {}
- var_names = set(allof_class.openapi_types.keys())
- for var_name in var_names:
- if var_name in model_args:
- kwargs[var_name] = model_args[var_name]
-
- # and use it to make the instance
- kwargs.update(constant_args)
try:
- allof_instance = allof_class(**kwargs)
+ allof_instance = allof_class(**model_args, **constant_args)
composed_instances.append(allof_instance)
except Exception as ex:
raise ApiValueError(
@@ -1655,31 +1663,9 @@ def get_oneof_instance(cls, model_kwargs, constant_kwargs, model_arg=None):
single_value_input = allows_single_value_input(oneof_class)
- if not single_value_input:
- # transform js keys from input data to python keys in fixed_model_args
- fixed_model_args = change_keys_js_to_python(
- model_kwargs, oneof_class)
-
- # Extract a dict with the properties that are declared in the oneOf schema.
- # Undeclared properties (e.g. properties that are allowed because of the
- # additionalProperties attribute in the OAS document) are not added to
- # the dict.
- kwargs = {}
- var_names = set(oneof_class.openapi_types.keys())
- for var_name in var_names:
- if var_name in fixed_model_args:
- kwargs[var_name] = fixed_model_args[var_name]
-
- # do not try to make a model with no input args
- if len(kwargs) == 0:
- continue
-
- # and use it to make the instance
- kwargs.update(constant_kwargs)
-
try:
if not single_value_input:
- oneof_instance = oneof_class(**kwargs)
+ oneof_instance = oneof_class(**model_kwargs, **constant_kwargs)
else:
if issubclass(oneof_class, ModelSimple):
oneof_instance = oneof_class(model_arg, **constant_kwargs)
@@ -1736,24 +1722,8 @@ def get_anyof_instances(self, model_args, constant_args):
# none_type deserialization is handled in the __new__ method
continue
- # transform js keys to python keys in fixed_model_args
- fixed_model_args = change_keys_js_to_python(model_args, anyof_class)
-
- # extract a dict of only required keys from these_model_vars
- kwargs = {}
- var_names = set(anyof_class.openapi_types.keys())
- for var_name in var_names:
- if var_name in fixed_model_args:
- kwargs[var_name] = fixed_model_args[var_name]
-
- # do not try to make a model with no input args
- if len(kwargs) == 0:
- continue
-
- # and use it to make the instance
- kwargs.update(constant_args)
try:
- anyof_instance = anyof_class(**kwargs)
+ anyof_instance = anyof_class(**model_args, **constant_args)
anyof_instances.append(anyof_instance)
except Exception:
pass
@@ -1766,47 +1736,34 @@ def get_anyof_instances(self, model_args, constant_args):
return anyof_instances
-def get_additional_properties_model_instances(
- composed_instances, self):
- additional_properties_model_instances = []
- all_instances = [self]
- all_instances.extend(composed_instances)
- for instance in all_instances:
- if instance.additional_properties_type is not None:
- additional_properties_model_instances.append(instance)
- return additional_properties_model_instances
-
-
-def get_var_name_to_model_instances(self, composed_instances):
- var_name_to_model_instances = {}
- all_instances = [self]
- all_instances.extend(composed_instances)
- for instance in all_instances:
- for var_name in instance.openapi_types:
- if var_name not in var_name_to_model_instances:
- var_name_to_model_instances[var_name] = [instance]
- else:
- var_name_to_model_instances[var_name].append(instance)
- return var_name_to_model_instances
-
-
-def get_unused_args(self, composed_instances, model_args):
- unused_args = dict(model_args)
- # arguments apssed to self were already converted to python names
+def get_discarded_args(self, composed_instances, model_args):
+ """
+ Gathers the args that were discarded by configuration.discard_unknown_keys
+ """
+ model_arg_keys = model_args.keys()
+ discarded_args = set()
+ # arguments passed to self were already converted to python names
# before __init__ was called
- for var_name_py in self.attribute_map:
- if var_name_py in unused_args:
- del unused_args[var_name_py]
for instance in composed_instances:
if instance.__class__ in self._composed_schemas['allOf']:
- for var_name_py in instance.attribute_map:
- if var_name_py in unused_args:
- del unused_args[var_name_py]
+ try:
+ keys = instance.to_dict().keys()
+ discarded_keys = model_args - keys
+ discarded_args.update(discarded_keys)
+ except Exception:
+ # allOf integer schema will throw exception
+ pass
else:
- for var_name_js in instance.attribute_map.values():
- if var_name_js in unused_args:
- del unused_args[var_name_js]
- return unused_args
+ try:
+ all_keys = set(model_to_dict(instance, serialize=False).keys())
+ js_keys = model_to_dict(instance, serialize=True).keys()
+ all_keys.update(js_keys)
+ discarded_keys = model_arg_keys - all_keys
+ discarded_args.update(discarded_keys)
+ except Exception:
+ # allOf integer schema will throw exception
+ pass
+ return discarded_args
def validate_get_composed_info(constant_args, model_args, self):
@@ -1850,36 +1807,42 @@ def validate_get_composed_info(constant_args, model_args, self):
composed_instances.append(oneof_instance)
anyof_instances = get_anyof_instances(self, model_args, constant_args)
composed_instances.extend(anyof_instances)
+ """
+ set additional_properties_model_instances
+ additional properties must be evaluated at the schema level
+ so self's additional properties are most important
+ If self is a composed schema with:
+ - no properties defined in self
+ - additionalProperties: False
+ Then for object payloads every property is an additional property
+ and they are not allowed, so only empty dict is allowed
+
+ Properties must be set on all matching schemas
+ so when a property is assigned toa composed instance, it must be set on all
+ composed instances regardless of additionalProperties presence
+ keeping it to prevent breaking changes in v5.0.1
+ TODO remove cls._additional_properties_model_instances in 6.0.0
+ """
+ additional_properties_model_instances = []
+ if self.additional_properties_type is not None:
+ additional_properties_model_instances = [self]
- # map variable names to composed_instances
- var_name_to_model_instances = get_var_name_to_model_instances(
- self, composed_instances)
-
- # set additional_properties_model_instances
- additional_properties_model_instances = (
- get_additional_properties_model_instances(composed_instances, self)
- )
-
- # set any remaining values
- unused_args = get_unused_args(self, composed_instances, model_args)
- if len(unused_args) > 0 and \
- len(additional_properties_model_instances) == 0 and \
- (self._configuration is None or
- not self._configuration.discard_unknown_keys):
- raise ApiValueError(
- "Invalid input arguments input when making an instance of "
- "class %s. Not all inputs were used. The unused input data "
- "is %s" % (self.__class__.__name__, unused_args)
- )
+ """
+ no need to set properties on self in here, they will be set in __init__
+ By here all composed schema oneOf/anyOf/allOf instances have their properties set using
+ model_args
+ """
+ discarded_args = get_discarded_args(self, composed_instances, model_args)
- # no need to add additional_properties to var_name_to_model_instances here
- # because additional_properties_model_instances will direct us to that
- # instance when we use getattr or setattr
- # and we update var_name_to_model_instances in setattr
+ # map variable names to composed_instances
+ var_name_to_model_instances = {}
+ for prop_name in model_args:
+ if prop_name not in discarded_args:
+ var_name_to_model_instances[prop_name] = [self] + composed_instances
return [
composed_instances,
var_name_to_model_instances,
additional_properties_model_instances,
- unused_args
+ discarded_args
]
diff --git a/samples/openapi3/client/features/dynamic-servers/python/dynamic_servers/model_utils.py b/samples/openapi3/client/features/dynamic-servers/python/dynamic_servers/model_utils.py
index 7edd9487c370..3dc0d4e47e29 100644
--- a/samples/openapi3/client/features/dynamic-servers/python/dynamic_servers/model_utils.py
+++ b/samples/openapi3/client/features/dynamic-servers/python/dynamic_servers/model_utils.py
@@ -434,27 +434,43 @@ def __setitem__(self, name, value):
self.__dict__[name] = value
return
- # set the attribute on the correct instance
- model_instances = self._var_name_to_model_instances.get(
- name, self._additional_properties_model_instances)
- if model_instances:
- for model_instance in model_instances:
- if model_instance == self:
- self.set_attribute(name, value)
- else:
- setattr(model_instance, name, value)
- if name not in self._var_name_to_model_instances:
- # we assigned an additional property
- self.__dict__['_var_name_to_model_instances'][name] = (
- model_instance
- )
- return None
-
- raise ApiAttributeError(
- "{0} has no attribute '{1}'".format(
- type(self).__name__, name),
- [e for e in [self._path_to_item, name] if e]
- )
+ """
+ Use cases:
+ 1. additional_properties_type is None (additionalProperties == False in spec)
+ Check for property presence in self.openapi_types
+ if not present then throw an error
+ if present set in self, set attribute
+ always set on composed schemas
+ 2. additional_properties_type exists
+ set attribute on self
+ always set on composed schemas
+ """
+ if self.additional_properties_type is None:
+ """
+ For an attribute to exist on a composed schema it must:
+ - fulfill schema_requirements in the self composed schema not considering oneOf/anyOf/allOf schemas AND
+ - fulfill schema_requirements in each oneOf/anyOf/allOf schemas
+
+ schema_requirements:
+ For an attribute to exist on a schema it must:
+ - be present in properties at the schema OR
+ - have additionalProperties unset (defaults additionalProperties = any type) OR
+ - have additionalProperties set
+ """
+ if name not in self.openapi_types:
+ raise ApiAttributeError(
+ "{0} has no attribute '{1}'".format(
+ type(self).__name__, name),
+ [e for e in [self._path_to_item, name] if e]
+ )
+ # attribute must be set on self and composed instances
+ self.set_attribute(name, value)
+ for model_instance in self._composed_instances:
+ setattr(model_instance, name, value)
+ if name not in self._var_name_to_model_instances:
+ # we assigned an additional property
+ self.__dict__['_var_name_to_model_instances'][name] = self._composed_instances + [self]
+ return None
__unset_attribute_value__ = object()
@@ -464,13 +480,12 @@ def get(self, name, default=None):
return self.__dict__[name]
# get the attribute from the correct instance
- model_instances = self._var_name_to_model_instances.get(
- name, self._additional_properties_model_instances)
+ model_instances = self._var_name_to_model_instances.get(name)
values = []
- # A composed model stores child (oneof/anyOf/allOf) models under
- # self._var_name_to_model_instances. A named property can exist in
- # multiple child models. If the property is present in more than one
- # child model, the value must be the same across all the child models.
+ # A composed model stores self and child (oneof/anyOf/allOf) models under
+ # self._var_name_to_model_instances.
+ # Any property must exist in self and all model instances
+ # The value stored in all model instances must be the same
if model_instances:
for model_instance in model_instances:
if name in model_instance._data_store:
@@ -1573,8 +1588,13 @@ def get_allof_instances(self, model_args, constant_args):
self: the class we are handling
model_args (dict): var_name to var_value
used to make instances
- constant_args (dict): var_name to var_value
- used to make instances
+ constant_args (dict):
+ metadata arguments:
+ _check_type
+ _path_to_item
+ _spec_property_naming
+ _configuration
+ _visited_composed_classes
Returns
composed_instances (list)
@@ -1582,20 +1602,8 @@ def get_allof_instances(self, model_args, constant_args):
composed_instances = []
for allof_class in self._composed_schemas['allOf']:
- # no need to handle changing js keys to python because
- # for composed schemas, allof parameters are included in the
- # composed schema and were changed to python keys in __new__
- # extract a dict of only required keys from fixed_model_args
- kwargs = {}
- var_names = set(allof_class.openapi_types.keys())
- for var_name in var_names:
- if var_name in model_args:
- kwargs[var_name] = model_args[var_name]
-
- # and use it to make the instance
- kwargs.update(constant_args)
try:
- allof_instance = allof_class(**kwargs)
+ allof_instance = allof_class(**model_args, **constant_args)
composed_instances.append(allof_instance)
except Exception as ex:
raise ApiValueError(
@@ -1655,31 +1663,9 @@ def get_oneof_instance(cls, model_kwargs, constant_kwargs, model_arg=None):
single_value_input = allows_single_value_input(oneof_class)
- if not single_value_input:
- # transform js keys from input data to python keys in fixed_model_args
- fixed_model_args = change_keys_js_to_python(
- model_kwargs, oneof_class)
-
- # Extract a dict with the properties that are declared in the oneOf schema.
- # Undeclared properties (e.g. properties that are allowed because of the
- # additionalProperties attribute in the OAS document) are not added to
- # the dict.
- kwargs = {}
- var_names = set(oneof_class.openapi_types.keys())
- for var_name in var_names:
- if var_name in fixed_model_args:
- kwargs[var_name] = fixed_model_args[var_name]
-
- # do not try to make a model with no input args
- if len(kwargs) == 0:
- continue
-
- # and use it to make the instance
- kwargs.update(constant_kwargs)
-
try:
if not single_value_input:
- oneof_instance = oneof_class(**kwargs)
+ oneof_instance = oneof_class(**model_kwargs, **constant_kwargs)
else:
if issubclass(oneof_class, ModelSimple):
oneof_instance = oneof_class(model_arg, **constant_kwargs)
@@ -1736,24 +1722,8 @@ def get_anyof_instances(self, model_args, constant_args):
# none_type deserialization is handled in the __new__ method
continue
- # transform js keys to python keys in fixed_model_args
- fixed_model_args = change_keys_js_to_python(model_args, anyof_class)
-
- # extract a dict of only required keys from these_model_vars
- kwargs = {}
- var_names = set(anyof_class.openapi_types.keys())
- for var_name in var_names:
- if var_name in fixed_model_args:
- kwargs[var_name] = fixed_model_args[var_name]
-
- # do not try to make a model with no input args
- if len(kwargs) == 0:
- continue
-
- # and use it to make the instance
- kwargs.update(constant_args)
try:
- anyof_instance = anyof_class(**kwargs)
+ anyof_instance = anyof_class(**model_args, **constant_args)
anyof_instances.append(anyof_instance)
except Exception:
pass
@@ -1766,47 +1736,34 @@ def get_anyof_instances(self, model_args, constant_args):
return anyof_instances
-def get_additional_properties_model_instances(
- composed_instances, self):
- additional_properties_model_instances = []
- all_instances = [self]
- all_instances.extend(composed_instances)
- for instance in all_instances:
- if instance.additional_properties_type is not None:
- additional_properties_model_instances.append(instance)
- return additional_properties_model_instances
-
-
-def get_var_name_to_model_instances(self, composed_instances):
- var_name_to_model_instances = {}
- all_instances = [self]
- all_instances.extend(composed_instances)
- for instance in all_instances:
- for var_name in instance.openapi_types:
- if var_name not in var_name_to_model_instances:
- var_name_to_model_instances[var_name] = [instance]
- else:
- var_name_to_model_instances[var_name].append(instance)
- return var_name_to_model_instances
-
-
-def get_unused_args(self, composed_instances, model_args):
- unused_args = dict(model_args)
- # arguments apssed to self were already converted to python names
+def get_discarded_args(self, composed_instances, model_args):
+ """
+ Gathers the args that were discarded by configuration.discard_unknown_keys
+ """
+ model_arg_keys = model_args.keys()
+ discarded_args = set()
+ # arguments passed to self were already converted to python names
# before __init__ was called
- for var_name_py in self.attribute_map:
- if var_name_py in unused_args:
- del unused_args[var_name_py]
for instance in composed_instances:
if instance.__class__ in self._composed_schemas['allOf']:
- for var_name_py in instance.attribute_map:
- if var_name_py in unused_args:
- del unused_args[var_name_py]
+ try:
+ keys = instance.to_dict().keys()
+ discarded_keys = model_args - keys
+ discarded_args.update(discarded_keys)
+ except Exception:
+ # allOf integer schema will throw exception
+ pass
else:
- for var_name_js in instance.attribute_map.values():
- if var_name_js in unused_args:
- del unused_args[var_name_js]
- return unused_args
+ try:
+ all_keys = set(model_to_dict(instance, serialize=False).keys())
+ js_keys = model_to_dict(instance, serialize=True).keys()
+ all_keys.update(js_keys)
+ discarded_keys = model_arg_keys - all_keys
+ discarded_args.update(discarded_keys)
+ except Exception:
+ # allOf integer schema will throw exception
+ pass
+ return discarded_args
def validate_get_composed_info(constant_args, model_args, self):
@@ -1850,36 +1807,42 @@ def validate_get_composed_info(constant_args, model_args, self):
composed_instances.append(oneof_instance)
anyof_instances = get_anyof_instances(self, model_args, constant_args)
composed_instances.extend(anyof_instances)
+ """
+ set additional_properties_model_instances
+ additional properties must be evaluated at the schema level
+ so self's additional properties are most important
+ If self is a composed schema with:
+ - no properties defined in self
+ - additionalProperties: False
+ Then for object payloads every property is an additional property
+ and they are not allowed, so only empty dict is allowed
+
+ Properties must be set on all matching schemas
+ so when a property is assigned toa composed instance, it must be set on all
+ composed instances regardless of additionalProperties presence
+ keeping it to prevent breaking changes in v5.0.1
+ TODO remove cls._additional_properties_model_instances in 6.0.0
+ """
+ additional_properties_model_instances = []
+ if self.additional_properties_type is not None:
+ additional_properties_model_instances = [self]
- # map variable names to composed_instances
- var_name_to_model_instances = get_var_name_to_model_instances(
- self, composed_instances)
-
- # set additional_properties_model_instances
- additional_properties_model_instances = (
- get_additional_properties_model_instances(composed_instances, self)
- )
-
- # set any remaining values
- unused_args = get_unused_args(self, composed_instances, model_args)
- if len(unused_args) > 0 and \
- len(additional_properties_model_instances) == 0 and \
- (self._configuration is None or
- not self._configuration.discard_unknown_keys):
- raise ApiValueError(
- "Invalid input arguments input when making an instance of "
- "class %s. Not all inputs were used. The unused input data "
- "is %s" % (self.__class__.__name__, unused_args)
- )
+ """
+ no need to set properties on self in here, they will be set in __init__
+ By here all composed schema oneOf/anyOf/allOf instances have their properties set using
+ model_args
+ """
+ discarded_args = get_discarded_args(self, composed_instances, model_args)
- # no need to add additional_properties to var_name_to_model_instances here
- # because additional_properties_model_instances will direct us to that
- # instance when we use getattr or setattr
- # and we update var_name_to_model_instances in setattr
+ # map variable names to composed_instances
+ var_name_to_model_instances = {}
+ for prop_name in model_args:
+ if prop_name not in discarded_args:
+ var_name_to_model_instances[prop_name] = [self] + composed_instances
return [
composed_instances,
var_name_to_model_instances,
additional_properties_model_instances,
- unused_args
+ discarded_args
]
diff --git a/samples/openapi3/client/petstore/python-experimental/.coverage b/samples/openapi3/client/petstore/python-experimental/.coverage
new file mode 100644
index 000000000000..9e8563e13450
Binary files /dev/null and b/samples/openapi3/client/petstore/python-experimental/.coverage differ
diff --git a/samples/openapi3/client/petstore/python-legacy/pom.xml b/samples/openapi3/client/petstore/python-legacy/pom.xml
index 98955483eb8f..3a9cf7273065 100755
--- a/samples/openapi3/client/petstore/python-legacy/pom.xml
+++ b/samples/openapi3/client/petstore/python-legacy/pom.xml
@@ -1,7 +1,7 @@
4.0.0
org.openapitools
- PythonOAS3PetstoreTests
+ PythonLegacyOAS3PetstoreTests
pom
1.0-SNAPSHOT
Python OpenAPI3 Petstore Client
diff --git a/samples/openapi3/client/petstore/python/.openapi-generator/FILES b/samples/openapi3/client/petstore/python/.openapi-generator/FILES
index 34b36c49f8b3..c8c31c14ca6b 100644
--- a/samples/openapi3/client/petstore/python/.openapi-generator/FILES
+++ b/samples/openapi3/client/petstore/python/.openapi-generator/FILES
@@ -28,6 +28,7 @@ docs/ClassModel.md
docs/Client.md
docs/ComplexQuadrilateral.md
docs/ComposedOneOfNumberWithValidations.md
+docs/ComposedSchemaWithPropsAndNoAddProps.md
docs/DanishPig.md
docs/DefaultApi.md
docs/Dog.md
@@ -134,6 +135,7 @@ petstore_api/model/class_model.py
petstore_api/model/client.py
petstore_api/model/complex_quadrilateral.py
petstore_api/model/composed_one_of_number_with_validations.py
+petstore_api/model/composed_schema_with_props_and_no_add_props.py
petstore_api/model/danish_pig.py
petstore_api/model/dog.py
petstore_api/model/dog_all_of.py
diff --git a/samples/openapi3/client/petstore/python/README.md b/samples/openapi3/client/petstore/python/README.md
index 61aebac0aa19..266472605a21 100644
--- a/samples/openapi3/client/petstore/python/README.md
+++ b/samples/openapi3/client/petstore/python/README.md
@@ -157,6 +157,7 @@ Class | Method | HTTP request | Description
- [Client](docs/Client.md)
- [ComplexQuadrilateral](docs/ComplexQuadrilateral.md)
- [ComposedOneOfNumberWithValidations](docs/ComposedOneOfNumberWithValidations.md)
+ - [ComposedSchemaWithPropsAndNoAddProps](docs/ComposedSchemaWithPropsAndNoAddProps.md)
- [DanishPig](docs/DanishPig.md)
- [Dog](docs/Dog.md)
- [DogAllOf](docs/DogAllOf.md)
diff --git a/samples/openapi3/client/petstore/python/docs/AdditionalPropertiesClass.md b/samples/openapi3/client/petstore/python/docs/AdditionalPropertiesClass.md
index 460813c12231..b8d54e3c9bf1 100644
--- a/samples/openapi3/client/petstore/python/docs/AdditionalPropertiesClass.md
+++ b/samples/openapi3/client/petstore/python/docs/AdditionalPropertiesClass.md
@@ -10,8 +10,9 @@ Name | Type | Description | Notes
**map_with_undeclared_properties_anytype_1** | **{str: (bool, date, datetime, dict, float, int, list, str, none_type)}** | | [optional]
**map_with_undeclared_properties_anytype_2** | **{str: (bool, date, datetime, dict, float, int, list, str, none_type)}** | | [optional]
**map_with_undeclared_properties_anytype_3** | **{str: (bool, date, datetime, dict, float, int, list, str, none_type)}** | | [optional]
-**empty_map** | **bool, date, datetime, dict, float, int, list, str** | an object with no declared properties and no undeclared properties, hence it's an empty map. | [optional]
+**empty_map** | **dict** | an object with no declared properties and no undeclared properties, hence it's an empty map. | [optional]
**map_with_undeclared_properties_string** | **{str: (str,)}** | | [optional]
+**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/openapi3/client/petstore/python/docs/AdditionalPropertiesWithArrayOfEnums.md b/samples/openapi3/client/petstore/python/docs/AdditionalPropertiesWithArrayOfEnums.md
index 49ca7b3d7540..5cdb2f4c9221 100644
--- a/samples/openapi3/client/petstore/python/docs/AdditionalPropertiesWithArrayOfEnums.md
+++ b/samples/openapi3/client/petstore/python/docs/AdditionalPropertiesWithArrayOfEnums.md
@@ -4,7 +4,7 @@
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
-**any string name** | **[EnumClass]** | any string name can be used but the value must be the correct type | [optional]
+**any string name** | [**[EnumClass]**](EnumClass.md) | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/openapi3/client/petstore/python/docs/Animal.md b/samples/openapi3/client/petstore/python/docs/Animal.md
index 1d1c77c01abc..d36c66a5d882 100644
--- a/samples/openapi3/client/petstore/python/docs/Animal.md
+++ b/samples/openapi3/client/petstore/python/docs/Animal.md
@@ -6,6 +6,7 @@ Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**class_name** | **str** | |
**color** | **str** | | [optional] if omitted the server will use the default value of "red"
+**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/openapi3/client/petstore/python/docs/AnimalFarm.md b/samples/openapi3/client/petstore/python/docs/AnimalFarm.md
index fc299cf27d34..fb3b33c9c9c2 100644
--- a/samples/openapi3/client/petstore/python/docs/AnimalFarm.md
+++ b/samples/openapi3/client/petstore/python/docs/AnimalFarm.md
@@ -5,6 +5,7 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**value** | [**[Animal]**](Animal.md) | |
+**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/openapi3/client/petstore/python/docs/ApiResponse.md b/samples/openapi3/client/petstore/python/docs/ApiResponse.md
index 81a7d0d85227..bedefea9a9cb 100644
--- a/samples/openapi3/client/petstore/python/docs/ApiResponse.md
+++ b/samples/openapi3/client/petstore/python/docs/ApiResponse.md
@@ -7,6 +7,7 @@ Name | Type | Description | Notes
**code** | **int** | | [optional]
**type** | **str** | | [optional]
**message** | **str** | | [optional]
+**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/openapi3/client/petstore/python/docs/Apple.md b/samples/openapi3/client/petstore/python/docs/Apple.md
index d8ba5ec0711b..d7634278906b 100644
--- a/samples/openapi3/client/petstore/python/docs/Apple.md
+++ b/samples/openapi3/client/petstore/python/docs/Apple.md
@@ -4,8 +4,9 @@
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
-**cultivar** | **str** | | [optional]
+**cultivar** | **str** | |
**origin** | **str** | | [optional]
+**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/openapi3/client/petstore/python/docs/ArrayOfArrayOfNumberOnly.md b/samples/openapi3/client/petstore/python/docs/ArrayOfArrayOfNumberOnly.md
index 6ab77963788b..11cd25c98ee4 100644
--- a/samples/openapi3/client/petstore/python/docs/ArrayOfArrayOfNumberOnly.md
+++ b/samples/openapi3/client/petstore/python/docs/ArrayOfArrayOfNumberOnly.md
@@ -5,6 +5,7 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**array_array_number** | **[[float]]** | | [optional]
+**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/openapi3/client/petstore/python/docs/ArrayOfEnums.md b/samples/openapi3/client/petstore/python/docs/ArrayOfEnums.md
index d2f8ea80a3d9..f1593c10afd0 100644
--- a/samples/openapi3/client/petstore/python/docs/ArrayOfEnums.md
+++ b/samples/openapi3/client/petstore/python/docs/ArrayOfEnums.md
@@ -5,6 +5,7 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**value** | [**[StringEnum]**](StringEnum.md) | |
+**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/openapi3/client/petstore/python/docs/ArrayOfNumberOnly.md b/samples/openapi3/client/petstore/python/docs/ArrayOfNumberOnly.md
index ebc65a54ba7e..1e9bb12e4e8b 100644
--- a/samples/openapi3/client/petstore/python/docs/ArrayOfNumberOnly.md
+++ b/samples/openapi3/client/petstore/python/docs/ArrayOfNumberOnly.md
@@ -5,6 +5,7 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**array_number** | **[float]** | | [optional]
+**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/openapi3/client/petstore/python/docs/ArrayTest.md b/samples/openapi3/client/petstore/python/docs/ArrayTest.md
index 4e1bda8fc3af..9eac1f8874c4 100644
--- a/samples/openapi3/client/petstore/python/docs/ArrayTest.md
+++ b/samples/openapi3/client/petstore/python/docs/ArrayTest.md
@@ -7,6 +7,7 @@ Name | Type | Description | Notes
**array_of_string** | **[str]** | | [optional]
**array_array_of_integer** | **[[int]]** | | [optional]
**array_array_of_model** | [**[[ReadOnlyFirst]]**](ReadOnlyFirst.md) | | [optional]
+**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/openapi3/client/petstore/python/docs/Banana.md b/samples/openapi3/client/petstore/python/docs/Banana.md
index 54e06a1de596..2e38614e0f83 100644
--- a/samples/openapi3/client/petstore/python/docs/Banana.md
+++ b/samples/openapi3/client/petstore/python/docs/Banana.md
@@ -4,7 +4,8 @@
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
-**length_cm** | **float** | | [optional]
+**length_cm** | **float** | |
+**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/openapi3/client/petstore/python/docs/BasquePig.md b/samples/openapi3/client/petstore/python/docs/BasquePig.md
index 6c583c5bc9f5..0d92ecbe02bb 100644
--- a/samples/openapi3/client/petstore/python/docs/BasquePig.md
+++ b/samples/openapi3/client/petstore/python/docs/BasquePig.md
@@ -5,6 +5,7 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**class_name** | **str** | |
+**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/openapi3/client/petstore/python/docs/Capitalization.md b/samples/openapi3/client/petstore/python/docs/Capitalization.md
index 1ddeadeb3f46..df9989f8db57 100644
--- a/samples/openapi3/client/petstore/python/docs/Capitalization.md
+++ b/samples/openapi3/client/petstore/python/docs/Capitalization.md
@@ -10,6 +10,7 @@ Name | Type | Description | Notes
**capital_snake** | **str** | | [optional]
**sca_eth_flow_points** | **str** | | [optional]
**att_name** | **str** | Name of the pet | [optional]
+**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/openapi3/client/petstore/python/docs/CatAllOf.md b/samples/openapi3/client/petstore/python/docs/CatAllOf.md
index 0ff7809a99ac..6fd1390a749b 100644
--- a/samples/openapi3/client/petstore/python/docs/CatAllOf.md
+++ b/samples/openapi3/client/petstore/python/docs/CatAllOf.md
@@ -5,6 +5,7 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**declawed** | **bool** | | [optional]
+**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/openapi3/client/petstore/python/docs/Category.md b/samples/openapi3/client/petstore/python/docs/Category.md
index 940f6a45e641..7650eccafba5 100644
--- a/samples/openapi3/client/petstore/python/docs/Category.md
+++ b/samples/openapi3/client/petstore/python/docs/Category.md
@@ -6,6 +6,7 @@ Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**name** | **str** | | defaults to "default-name"
**id** | **int** | | [optional]
+**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/openapi3/client/petstore/python/docs/ChildCatAllOf.md b/samples/openapi3/client/petstore/python/docs/ChildCatAllOf.md
index c5883b9a87c8..c5b2f58f28ce 100644
--- a/samples/openapi3/client/petstore/python/docs/ChildCatAllOf.md
+++ b/samples/openapi3/client/petstore/python/docs/ChildCatAllOf.md
@@ -5,6 +5,7 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**name** | **str** | | [optional]
+**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/openapi3/client/petstore/python/docs/ClassModel.md b/samples/openapi3/client/petstore/python/docs/ClassModel.md
index 48ed7cbf2ff0..6605a16d74a9 100644
--- a/samples/openapi3/client/petstore/python/docs/ClassModel.md
+++ b/samples/openapi3/client/petstore/python/docs/ClassModel.md
@@ -6,6 +6,7 @@ Model for testing model with \"_class\" property
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**_class** | **str** | | [optional]
+**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/openapi3/client/petstore/python/docs/Client.md b/samples/openapi3/client/petstore/python/docs/Client.md
index c3986008d6c3..1b293140f348 100644
--- a/samples/openapi3/client/petstore/python/docs/Client.md
+++ b/samples/openapi3/client/petstore/python/docs/Client.md
@@ -5,6 +5,7 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**client** | **str** | | [optional]
+**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/openapi3/client/petstore/python/docs/ComposedSchemaWithPropsAndNoAddProps.md b/samples/openapi3/client/petstore/python/docs/ComposedSchemaWithPropsAndNoAddProps.md
new file mode 100644
index 000000000000..5930b762b0c2
--- /dev/null
+++ b/samples/openapi3/client/petstore/python/docs/ComposedSchemaWithPropsAndNoAddProps.md
@@ -0,0 +1,13 @@
+# ComposedSchemaWithPropsAndNoAddProps
+
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**color** | **str** | | [optional]
+**id** | **int** | | [optional]
+**name** | **str** | | [optional]
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/openapi3/client/petstore/python/docs/DanishPig.md b/samples/openapi3/client/petstore/python/docs/DanishPig.md
index dd7fe16ea4a9..4d1ebe4f68a0 100644
--- a/samples/openapi3/client/petstore/python/docs/DanishPig.md
+++ b/samples/openapi3/client/petstore/python/docs/DanishPig.md
@@ -5,6 +5,7 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**class_name** | **str** | |
+**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/openapi3/client/petstore/python/docs/DogAllOf.md b/samples/openapi3/client/petstore/python/docs/DogAllOf.md
index 6382bbd80671..2907a9fd5c43 100644
--- a/samples/openapi3/client/petstore/python/docs/DogAllOf.md
+++ b/samples/openapi3/client/petstore/python/docs/DogAllOf.md
@@ -5,6 +5,7 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**breed** | **str** | | [optional]
+**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/openapi3/client/petstore/python/docs/Drawing.md b/samples/openapi3/client/petstore/python/docs/Drawing.md
index 0f0390a3f720..a4fc4830562f 100644
--- a/samples/openapi3/client/petstore/python/docs/Drawing.md
+++ b/samples/openapi3/client/petstore/python/docs/Drawing.md
@@ -8,7 +8,7 @@ Name | Type | Description | Notes
**shape_or_null** | [**ShapeOrNull**](ShapeOrNull.md) | | [optional]
**nullable_shape** | [**NullableShape**](NullableShape.md) | | [optional]
**shapes** | [**[Shape]**](Shape.md) | | [optional]
-**any string name** | **Fruit** | any string name can be used but the value must be the correct type | [optional]
+**any string name** | [**Fruit**](Fruit.md) | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/openapi3/client/petstore/python/docs/EnumArrays.md b/samples/openapi3/client/petstore/python/docs/EnumArrays.md
index 9be5c645a809..ad4e9d2fcb7c 100644
--- a/samples/openapi3/client/petstore/python/docs/EnumArrays.md
+++ b/samples/openapi3/client/petstore/python/docs/EnumArrays.md
@@ -6,6 +6,7 @@ Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**just_symbol** | **str** | | [optional]
**array_enum** | **[str]** | | [optional]
+**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/openapi3/client/petstore/python/docs/EnumClass.md b/samples/openapi3/client/petstore/python/docs/EnumClass.md
index a1f9aae58190..39bb0e1644c5 100644
--- a/samples/openapi3/client/petstore/python/docs/EnumClass.md
+++ b/samples/openapi3/client/petstore/python/docs/EnumClass.md
@@ -5,6 +5,7 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**value** | **str** | | defaults to "-efg", must be one of ["_abc", "-efg", "(xyz)", ]
+**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/openapi3/client/petstore/python/docs/EnumTest.md b/samples/openapi3/client/petstore/python/docs/EnumTest.md
index b9181858434c..27b6997e695d 100644
--- a/samples/openapi3/client/petstore/python/docs/EnumTest.md
+++ b/samples/openapi3/client/petstore/python/docs/EnumTest.md
@@ -15,6 +15,7 @@ Name | Type | Description | Notes
**integer_enum_one_value** | [**IntegerEnumOneValue**](IntegerEnumOneValue.md) | | [optional]
**inline_array_of_str_enum** | [**[StringEnum]**](StringEnum.md) | | [optional]
**array_of_str_enum** | [**ArrayOfEnums**](ArrayOfEnums.md) | | [optional]
+**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/openapi3/client/petstore/python/docs/File.md b/samples/openapi3/client/petstore/python/docs/File.md
index 63b1d1a65186..f84547d19331 100644
--- a/samples/openapi3/client/petstore/python/docs/File.md
+++ b/samples/openapi3/client/petstore/python/docs/File.md
@@ -6,6 +6,7 @@ Must be named `File` for test.
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**source_uri** | **str** | Test capitalization | [optional]
+**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/openapi3/client/petstore/python/docs/FileSchemaTestClass.md b/samples/openapi3/client/petstore/python/docs/FileSchemaTestClass.md
index caf2440821da..4572aa0905b3 100644
--- a/samples/openapi3/client/petstore/python/docs/FileSchemaTestClass.md
+++ b/samples/openapi3/client/petstore/python/docs/FileSchemaTestClass.md
@@ -6,6 +6,7 @@ Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**file** | [**File**](File.md) | | [optional]
**files** | [**[File]**](File.md) | | [optional]
+**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/openapi3/client/petstore/python/docs/Foo.md b/samples/openapi3/client/petstore/python/docs/Foo.md
index 23fb5e1678ed..c9c54d1ee40a 100644
--- a/samples/openapi3/client/petstore/python/docs/Foo.md
+++ b/samples/openapi3/client/petstore/python/docs/Foo.md
@@ -5,6 +5,7 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**bar** | **str** | | [optional] if omitted the server will use the default value of "bar"
+**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/openapi3/client/petstore/python/docs/FormatTest.md b/samples/openapi3/client/petstore/python/docs/FormatTest.md
index 4fcec135190f..3c8cc8697c1c 100644
--- a/samples/openapi3/client/petstore/python/docs/FormatTest.md
+++ b/samples/openapi3/client/petstore/python/docs/FormatTest.md
@@ -20,6 +20,7 @@ Name | Type | Description | Notes
**uuid_no_example** | **str** | | [optional]
**pattern_with_digits** | **str** | A string that is a 10 digit number. Can have leading zeros. | [optional]
**pattern_with_digits_and_delimiter** | **str** | A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. | [optional]
+**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/openapi3/client/petstore/python/docs/Fruit.md b/samples/openapi3/client/petstore/python/docs/Fruit.md
index 92700e79e084..d65f4cb14b4f 100644
--- a/samples/openapi3/client/petstore/python/docs/Fruit.md
+++ b/samples/openapi3/client/petstore/python/docs/Fruit.md
@@ -1,13 +1,15 @@
# Fruit
+a schema that tests oneOf and includes a schema level property
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
+**cultivar** | **str** | |
+**length_cm** | **float** | |
**color** | **str** | | [optional]
-**cultivar** | **str** | | [optional]
**origin** | **str** | | [optional]
-**length_cm** | **float** | | [optional]
+**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/openapi3/client/petstore/python/docs/FruitReq.md b/samples/openapi3/client/petstore/python/docs/FruitReq.md
index 7ff54d6ae022..096dde573091 100644
--- a/samples/openapi3/client/petstore/python/docs/FruitReq.md
+++ b/samples/openapi3/client/petstore/python/docs/FruitReq.md
@@ -1,5 +1,6 @@
# FruitReq
+a schema where additionalProperties is on in the composed schema and off in the oneOf object schemas also, this schem accepts null as a value
## Properties
Name | Type | Description | Notes
@@ -8,6 +9,7 @@ Name | Type | Description | Notes
**sweet** | **bool** | | [optional]
**cultivar** | **str** | | [optional]
**length_cm** | **float** | | [optional]
+**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/openapi3/client/petstore/python/docs/GmFruit.md b/samples/openapi3/client/petstore/python/docs/GmFruit.md
index f2af2abe5cef..4da4dd53ad44 100644
--- a/samples/openapi3/client/petstore/python/docs/GmFruit.md
+++ b/samples/openapi3/client/petstore/python/docs/GmFruit.md
@@ -4,10 +4,11 @@
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
+**cultivar** | **str** | |
+**length_cm** | **float** | |
**color** | **str** | | [optional]
-**cultivar** | **str** | | [optional]
**origin** | **str** | | [optional]
-**length_cm** | **float** | | [optional]
+**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/openapi3/client/petstore/python/docs/GrandparentAnimal.md b/samples/openapi3/client/petstore/python/docs/GrandparentAnimal.md
index 15db0708bb1a..a1c340378106 100644
--- a/samples/openapi3/client/petstore/python/docs/GrandparentAnimal.md
+++ b/samples/openapi3/client/petstore/python/docs/GrandparentAnimal.md
@@ -5,6 +5,7 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**pet_type** | **str** | |
+**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/openapi3/client/petstore/python/docs/HasOnlyReadOnly.md b/samples/openapi3/client/petstore/python/docs/HasOnlyReadOnly.md
index 0e1334519a8b..88bc03d4ff5c 100644
--- a/samples/openapi3/client/petstore/python/docs/HasOnlyReadOnly.md
+++ b/samples/openapi3/client/petstore/python/docs/HasOnlyReadOnly.md
@@ -6,6 +6,7 @@ Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**bar** | **str** | | [optional] [readonly]
**foo** | **str** | | [optional] [readonly]
+**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/openapi3/client/petstore/python/docs/HealthCheckResult.md b/samples/openapi3/client/petstore/python/docs/HealthCheckResult.md
index ab8b660e667f..e20455fb377a 100644
--- a/samples/openapi3/client/petstore/python/docs/HealthCheckResult.md
+++ b/samples/openapi3/client/petstore/python/docs/HealthCheckResult.md
@@ -6,6 +6,7 @@ Just a string to inform instance is up and running. Make it nullable in hope to
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**nullable_message** | **str, none_type** | | [optional]
+**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/openapi3/client/petstore/python/docs/InlineResponseDefault.md b/samples/openapi3/client/petstore/python/docs/InlineResponseDefault.md
index f0a52bc4639c..b8823d383bac 100644
--- a/samples/openapi3/client/petstore/python/docs/InlineResponseDefault.md
+++ b/samples/openapi3/client/petstore/python/docs/InlineResponseDefault.md
@@ -5,6 +5,7 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**string** | [**Foo**](Foo.md) | | [optional]
+**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/openapi3/client/petstore/python/docs/IntegerEnum.md b/samples/openapi3/client/petstore/python/docs/IntegerEnum.md
index 9567a76cc2e2..a5b38556bf8c 100644
--- a/samples/openapi3/client/petstore/python/docs/IntegerEnum.md
+++ b/samples/openapi3/client/petstore/python/docs/IntegerEnum.md
@@ -5,6 +5,7 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**value** | **int** | | must be one of [0, 1, 2, ]
+**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/openapi3/client/petstore/python/docs/IntegerEnumOneValue.md b/samples/openapi3/client/petstore/python/docs/IntegerEnumOneValue.md
index 99dcaa7a4ec3..d92f3080973d 100644
--- a/samples/openapi3/client/petstore/python/docs/IntegerEnumOneValue.md
+++ b/samples/openapi3/client/petstore/python/docs/IntegerEnumOneValue.md
@@ -5,6 +5,7 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**value** | **int** | | defaults to 0, must be one of [0, ]
+**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/openapi3/client/petstore/python/docs/IntegerEnumWithDefaultValue.md b/samples/openapi3/client/petstore/python/docs/IntegerEnumWithDefaultValue.md
index 4b8e39d9cadd..2fd432edc69d 100644
--- a/samples/openapi3/client/petstore/python/docs/IntegerEnumWithDefaultValue.md
+++ b/samples/openapi3/client/petstore/python/docs/IntegerEnumWithDefaultValue.md
@@ -5,6 +5,7 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**value** | **int** | | defaults to 0, must be one of [0, 1, 2, ]
+**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/openapi3/client/petstore/python/docs/IsoscelesTriangle.md b/samples/openapi3/client/petstore/python/docs/IsoscelesTriangle.md
index e7fffa3be03a..57cfa6d12ad1 100644
--- a/samples/openapi3/client/petstore/python/docs/IsoscelesTriangle.md
+++ b/samples/openapi3/client/petstore/python/docs/IsoscelesTriangle.md
@@ -6,6 +6,7 @@ Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**shape_type** | **str** | |
**triangle_type** | **str** | |
+**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/openapi3/client/petstore/python/docs/List.md b/samples/openapi3/client/petstore/python/docs/List.md
index 4b60956971aa..13f2694de358 100644
--- a/samples/openapi3/client/petstore/python/docs/List.md
+++ b/samples/openapi3/client/petstore/python/docs/List.md
@@ -5,6 +5,7 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**_123_list** | **str** | | [optional]
+**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/openapi3/client/petstore/python/docs/MapTest.md b/samples/openapi3/client/petstore/python/docs/MapTest.md
index 15228ee1f282..e6584f3811e0 100644
--- a/samples/openapi3/client/petstore/python/docs/MapTest.md
+++ b/samples/openapi3/client/petstore/python/docs/MapTest.md
@@ -8,6 +8,7 @@ Name | Type | Description | Notes
**map_of_enum_string** | **{str: (str,)}** | | [optional]
**direct_map** | **{str: (bool,)}** | | [optional]
**indirect_map** | [**StringBooleanMap**](StringBooleanMap.md) | | [optional]
+**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/openapi3/client/petstore/python/docs/MixedPropertiesAndAdditionalPropertiesClass.md b/samples/openapi3/client/petstore/python/docs/MixedPropertiesAndAdditionalPropertiesClass.md
index f489944a20af..f32c4e04134b 100644
--- a/samples/openapi3/client/petstore/python/docs/MixedPropertiesAndAdditionalPropertiesClass.md
+++ b/samples/openapi3/client/petstore/python/docs/MixedPropertiesAndAdditionalPropertiesClass.md
@@ -7,6 +7,7 @@ Name | Type | Description | Notes
**uuid** | **str** | | [optional]
**date_time** | **datetime** | | [optional]
**map** | [**{str: (Animal,)}**](Animal.md) | | [optional]
+**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/openapi3/client/petstore/python/docs/Model200Response.md b/samples/openapi3/client/petstore/python/docs/Model200Response.md
index c958bd4b33f8..f7ef7d79acf6 100644
--- a/samples/openapi3/client/petstore/python/docs/Model200Response.md
+++ b/samples/openapi3/client/petstore/python/docs/Model200Response.md
@@ -7,6 +7,7 @@ Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**name** | **int** | | [optional]
**_class** | **str** | | [optional]
+**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/openapi3/client/petstore/python/docs/ModelReturn.md b/samples/openapi3/client/petstore/python/docs/ModelReturn.md
index 043e9d466fab..75fb39a88698 100644
--- a/samples/openapi3/client/petstore/python/docs/ModelReturn.md
+++ b/samples/openapi3/client/petstore/python/docs/ModelReturn.md
@@ -6,6 +6,7 @@ Model for testing reserved words
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**_return** | **int** | | [optional]
+**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/openapi3/client/petstore/python/docs/Name.md b/samples/openapi3/client/petstore/python/docs/Name.md
index 3be719cdbfba..6e58fae6d0bb 100644
--- a/samples/openapi3/client/petstore/python/docs/Name.md
+++ b/samples/openapi3/client/petstore/python/docs/Name.md
@@ -9,6 +9,7 @@ Name | Type | Description | Notes
**snake_case** | **int** | | [optional] [readonly]
**_property** | **str** | | [optional]
**_123_number** | **int** | | [optional] [readonly]
+**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/openapi3/client/petstore/python/docs/NullableClass.md b/samples/openapi3/client/petstore/python/docs/NullableClass.md
index 863e93ddfbbc..48a27469f6c9 100644
--- a/samples/openapi3/client/petstore/python/docs/NullableClass.md
+++ b/samples/openapi3/client/petstore/python/docs/NullableClass.md
@@ -13,10 +13,11 @@ Name | Type | Description | Notes
**array_nullable_prop** | **[{str: (bool, date, datetime, dict, float, int, list, str, none_type)}], none_type** | | [optional]
**array_and_items_nullable_prop** | **[{str: (bool, date, datetime, dict, float, int, list, str, none_type)}, none_type], none_type** | | [optional]
**array_items_nullable** | **[{str: (bool, date, datetime, dict, float, int, list, str, none_type)}, none_type]** | | [optional]
+**object_nullable** | **{str: (bool, date, datetime, dict, float, int, list, str, none_type)}, none_type** | | [optional]
**object_nullable_prop** | **{str: ({str: (bool, date, datetime, dict, float, int, list, str, none_type)},)}, none_type** | | [optional]
**object_and_items_nullable_prop** | **{str: ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}, none_type)}, none_type** | | [optional]
**object_items_nullable** | **{str: ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}, none_type)}** | | [optional]
-**any string name** | **{str: (bool, date, datetime, dict, float, int, list, str, none_type)}, none_type** | any string name can be used but the value must be the correct type | [optional]
+**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/openapi3/client/petstore/python/docs/NumberOnly.md b/samples/openapi3/client/petstore/python/docs/NumberOnly.md
index 37195c5d8994..172e86163a44 100644
--- a/samples/openapi3/client/petstore/python/docs/NumberOnly.md
+++ b/samples/openapi3/client/petstore/python/docs/NumberOnly.md
@@ -5,6 +5,7 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**just_number** | **float** | | [optional]
+**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/openapi3/client/petstore/python/docs/NumberWithValidations.md b/samples/openapi3/client/petstore/python/docs/NumberWithValidations.md
index 119e0f678239..cc6f77c152c6 100644
--- a/samples/openapi3/client/petstore/python/docs/NumberWithValidations.md
+++ b/samples/openapi3/client/petstore/python/docs/NumberWithValidations.md
@@ -5,6 +5,7 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**value** | **float** | |
+**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/openapi3/client/petstore/python/docs/ObjectModelWithRefProps.md b/samples/openapi3/client/petstore/python/docs/ObjectModelWithRefProps.md
index 5ff4e52033d6..a0d15f4bbd15 100644
--- a/samples/openapi3/client/petstore/python/docs/ObjectModelWithRefProps.md
+++ b/samples/openapi3/client/petstore/python/docs/ObjectModelWithRefProps.md
@@ -8,6 +8,7 @@ Name | Type | Description | Notes
**my_number** | [**NumberWithValidations**](NumberWithValidations.md) | | [optional]
**my_string** | **str** | | [optional]
**my_boolean** | **bool** | | [optional]
+**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/openapi3/client/petstore/python/docs/Order.md b/samples/openapi3/client/petstore/python/docs/Order.md
index d29e1a381de8..0423082932d5 100644
--- a/samples/openapi3/client/petstore/python/docs/Order.md
+++ b/samples/openapi3/client/petstore/python/docs/Order.md
@@ -10,6 +10,7 @@ Name | Type | Description | Notes
**ship_date** | **datetime** | | [optional]
**status** | **str** | Order Status | [optional]
**complete** | **bool** | | [optional] if omitted the server will use the default value of False
+**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/openapi3/client/petstore/python/docs/Pet.md b/samples/openapi3/client/petstore/python/docs/Pet.md
index ea4abdeb13d3..bb6e8d344e64 100644
--- a/samples/openapi3/client/petstore/python/docs/Pet.md
+++ b/samples/openapi3/client/petstore/python/docs/Pet.md
@@ -11,6 +11,7 @@ Name | Type | Description | Notes
**category** | [**Category**](Category.md) | | [optional]
**tags** | [**[Tag]**](Tag.md) | | [optional]
**status** | **str** | pet status in the store | [optional]
+**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/openapi3/client/petstore/python/docs/QuadrilateralInterface.md b/samples/openapi3/client/petstore/python/docs/QuadrilateralInterface.md
index 3b9c39d22306..05573544bd79 100644
--- a/samples/openapi3/client/petstore/python/docs/QuadrilateralInterface.md
+++ b/samples/openapi3/client/petstore/python/docs/QuadrilateralInterface.md
@@ -5,6 +5,7 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**quadrilateral_type** | **str** | |
+**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/openapi3/client/petstore/python/docs/ReadOnlyFirst.md b/samples/openapi3/client/petstore/python/docs/ReadOnlyFirst.md
index 53b4c61d8445..ba39ec3d04e4 100644
--- a/samples/openapi3/client/petstore/python/docs/ReadOnlyFirst.md
+++ b/samples/openapi3/client/petstore/python/docs/ReadOnlyFirst.md
@@ -6,6 +6,7 @@ Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**bar** | **str** | | [optional] [readonly]
**baz** | **str** | | [optional]
+**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/openapi3/client/petstore/python/docs/ShapeInterface.md b/samples/openapi3/client/petstore/python/docs/ShapeInterface.md
index 4d094158faba..012d4a0cdd86 100644
--- a/samples/openapi3/client/petstore/python/docs/ShapeInterface.md
+++ b/samples/openapi3/client/petstore/python/docs/ShapeInterface.md
@@ -5,6 +5,7 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**shape_type** | **str** | |
+**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/openapi3/client/petstore/python/docs/SpecialModelName.md b/samples/openapi3/client/petstore/python/docs/SpecialModelName.md
index 268e1134192d..4a1c86ff4de0 100644
--- a/samples/openapi3/client/petstore/python/docs/SpecialModelName.md
+++ b/samples/openapi3/client/petstore/python/docs/SpecialModelName.md
@@ -5,6 +5,7 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**special_property_name** | **int** | | [optional]
+**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/openapi3/client/petstore/python/docs/StringEnum.md b/samples/openapi3/client/petstore/python/docs/StringEnum.md
index b03f3b1e6c64..29e160a9b07e 100644
--- a/samples/openapi3/client/petstore/python/docs/StringEnum.md
+++ b/samples/openapi3/client/petstore/python/docs/StringEnum.md
@@ -7,6 +7,7 @@ Name | Type | Description | Notes
**value** | **str** | | must be one of ["placed", "approved", "delivered", "single quoted", '''multiple
lines''', '''double quote
with newline''', ]
+**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/openapi3/client/petstore/python/docs/StringEnumWithDefaultValue.md b/samples/openapi3/client/petstore/python/docs/StringEnumWithDefaultValue.md
index 7799b93d8223..700a2caf3b84 100644
--- a/samples/openapi3/client/petstore/python/docs/StringEnumWithDefaultValue.md
+++ b/samples/openapi3/client/petstore/python/docs/StringEnumWithDefaultValue.md
@@ -5,6 +5,7 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**value** | **str** | | defaults to "placed", must be one of ["placed", "approved", "delivered", ]
+**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/openapi3/client/petstore/python/docs/Tag.md b/samples/openapi3/client/petstore/python/docs/Tag.md
index 4ccac4949afc..8a95090c036d 100644
--- a/samples/openapi3/client/petstore/python/docs/Tag.md
+++ b/samples/openapi3/client/petstore/python/docs/Tag.md
@@ -6,6 +6,7 @@ Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**id** | **int** | | [optional]
**name** | **str** | | [optional]
+**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/openapi3/client/petstore/python/docs/TriangleInterface.md b/samples/openapi3/client/petstore/python/docs/TriangleInterface.md
index 494c224cd313..9f8411eabdf2 100644
--- a/samples/openapi3/client/petstore/python/docs/TriangleInterface.md
+++ b/samples/openapi3/client/petstore/python/docs/TriangleInterface.md
@@ -5,6 +5,7 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**triangle_type** | **str** | |
+**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/openapi3/client/petstore/python/docs/User.md b/samples/openapi3/client/petstore/python/docs/User.md
index a4cb117e63a9..4d2da357adb1 100644
--- a/samples/openapi3/client/petstore/python/docs/User.md
+++ b/samples/openapi3/client/petstore/python/docs/User.md
@@ -16,6 +16,7 @@ Name | Type | Description | Notes
**object_with_no_declared_props_nullable** | **{str: (bool, date, datetime, dict, float, int, list, str, none_type)}, none_type** | test code generation for nullable objects. Value must be a map of strings to values or the 'null' value. | [optional]
**any_type_prop** | **bool, date, datetime, dict, float, int, list, str, none_type** | test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. See https://github.com/OAI/OpenAPI-Specification/issues/1389 | [optional]
**any_type_prop_nullable** | **bool, date, datetime, dict, float, int, list, str, none_type** | test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. The 'nullable' attribute does not change the allowed values. | [optional]
+**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/openapi3/client/petstore/python/docs/Whale.md b/samples/openapi3/client/petstore/python/docs/Whale.md
index ea48bff6bc39..500786012ead 100644
--- a/samples/openapi3/client/petstore/python/docs/Whale.md
+++ b/samples/openapi3/client/petstore/python/docs/Whale.md
@@ -7,6 +7,7 @@ Name | Type | Description | Notes
**class_name** | **str** | |
**has_baleen** | **bool** | | [optional]
**has_teeth** | **bool** | | [optional]
+**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/samples/openapi3/client/petstore/python/petstore_api/model/additional_properties_class.py b/samples/openapi3/client/petstore/python/petstore_api/model/additional_properties_class.py
index 3b526cd54e36..82aca2a9ca8d 100644
--- a/samples/openapi3/client/petstore/python/petstore_api/model/additional_properties_class.py
+++ b/samples/openapi3/client/petstore/python/petstore_api/model/additional_properties_class.py
@@ -57,7 +57,13 @@ class AdditionalPropertiesClass(ModelNormal):
validations = {
}
- additional_properties_type = None
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
@@ -78,7 +84,7 @@ def openapi_types():
'map_with_undeclared_properties_anytype_1': ({str: (bool, date, datetime, dict, float, int, list, str, none_type)},), # noqa: E501
'map_with_undeclared_properties_anytype_2': ({str: (bool, date, datetime, dict, float, int, list, str, none_type)},), # noqa: E501
'map_with_undeclared_properties_anytype_3': ({str: (bool, date, datetime, dict, float, int, list, str, none_type)},), # noqa: E501
- 'empty_map': (bool, date, datetime, dict, float, int, list, str,), # noqa: E501
+ 'empty_map': (dict,), # noqa: E501
'map_with_undeclared_properties_string': ({str: (str,)},), # noqa: E501
}
@@ -150,7 +156,7 @@ def __init__(self, *args, **kwargs): # noqa: E501
map_with_undeclared_properties_anytype_1 ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}): [optional] # noqa: E501
map_with_undeclared_properties_anytype_2 ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}): [optional] # noqa: E501
map_with_undeclared_properties_anytype_3 ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}): [optional] # noqa: E501
- empty_map (bool, date, datetime, dict, float, int, list, str): an object with no declared properties and no undeclared properties, hence it's an empty map.. [optional] # noqa: E501
+ empty_map (dict): an object with no declared properties and no undeclared properties, hence it's an empty map.. [optional] # noqa: E501
map_with_undeclared_properties_string ({str: (str,)}): [optional] # noqa: E501
"""
diff --git a/samples/openapi3/client/petstore/python/petstore_api/model/animal.py b/samples/openapi3/client/petstore/python/petstore_api/model/animal.py
index a3d48b6ea975..c53b1e1ad289 100644
--- a/samples/openapi3/client/petstore/python/petstore_api/model/animal.py
+++ b/samples/openapi3/client/petstore/python/petstore_api/model/animal.py
@@ -63,7 +63,14 @@ class Animal(ModelNormal):
validations = {
}
- additional_properties_type = None
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ lazy_import()
+ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
diff --git a/samples/openapi3/client/petstore/python/petstore_api/model/animal_farm.py b/samples/openapi3/client/petstore/python/petstore_api/model/animal_farm.py
index 838b18a12970..fb58224ebd4c 100644
--- a/samples/openapi3/client/petstore/python/petstore_api/model/animal_farm.py
+++ b/samples/openapi3/client/petstore/python/petstore_api/model/animal_farm.py
@@ -57,7 +57,14 @@ class AnimalFarm(ModelSimple):
validations = {
}
- additional_properties_type = None
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ lazy_import()
+ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
diff --git a/samples/openapi3/client/petstore/python/petstore_api/model/api_response.py b/samples/openapi3/client/petstore/python/petstore_api/model/api_response.py
index 01e2175b8004..53adb5aba12f 100644
--- a/samples/openapi3/client/petstore/python/petstore_api/model/api_response.py
+++ b/samples/openapi3/client/petstore/python/petstore_api/model/api_response.py
@@ -57,7 +57,13 @@ class ApiResponse(ModelNormal):
validations = {
}
- additional_properties_type = None
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
diff --git a/samples/openapi3/client/petstore/python/petstore_api/model/apple.py b/samples/openapi3/client/petstore/python/petstore_api/model/apple.py
index 29d34a1efe8b..4068d2488e57 100644
--- a/samples/openapi3/client/petstore/python/petstore_api/model/apple.py
+++ b/samples/openapi3/client/petstore/python/petstore_api/model/apple.py
@@ -68,7 +68,13 @@ class Apple(ModelNormal):
},
}
- additional_properties_type = None
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = True
@@ -109,9 +115,12 @@ def discriminator():
])
@convert_js_args_to_python_args
- def __init__(self, *args, **kwargs): # noqa: E501
+ def __init__(self, cultivar, *args, **kwargs): # noqa: E501
"""Apple - a model defined in OpenAPI
+ Args:
+ cultivar (str):
+
Keyword Args:
_check_type (bool): if True, values for parameters in openapi_types
will be type checked and a TypeError will be
@@ -143,7 +152,6 @@ def __init__(self, *args, **kwargs): # noqa: E501
Animal class but this time we won't travel
through its discriminator because we passed in
_visited_composed_classes = (Animal,)
- cultivar (str): [optional] # noqa: E501
origin (str): [optional] # noqa: E501
"""
@@ -170,6 +178,7 @@ def __init__(self, *args, **kwargs): # noqa: E501
self._configuration = _configuration
self._visited_composed_classes = _visited_composed_classes + (self.__class__,)
+ self.cultivar = cultivar
for var_name, var_value in kwargs.items():
if var_name not in self.attribute_map and \
self._configuration is not None and \
diff --git a/samples/openapi3/client/petstore/python/petstore_api/model/array_of_array_of_number_only.py b/samples/openapi3/client/petstore/python/petstore_api/model/array_of_array_of_number_only.py
index 008b74dd42a3..8b6a2c42d0ed 100644
--- a/samples/openapi3/client/petstore/python/petstore_api/model/array_of_array_of_number_only.py
+++ b/samples/openapi3/client/petstore/python/petstore_api/model/array_of_array_of_number_only.py
@@ -57,7 +57,13 @@ class ArrayOfArrayOfNumberOnly(ModelNormal):
validations = {
}
- additional_properties_type = None
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
diff --git a/samples/openapi3/client/petstore/python/petstore_api/model/array_of_enums.py b/samples/openapi3/client/petstore/python/petstore_api/model/array_of_enums.py
index a3dc283969ae..8d9962152edf 100644
--- a/samples/openapi3/client/petstore/python/petstore_api/model/array_of_enums.py
+++ b/samples/openapi3/client/petstore/python/petstore_api/model/array_of_enums.py
@@ -57,7 +57,14 @@ class ArrayOfEnums(ModelSimple):
validations = {
}
- additional_properties_type = None
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ lazy_import()
+ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
diff --git a/samples/openapi3/client/petstore/python/petstore_api/model/array_of_number_only.py b/samples/openapi3/client/petstore/python/petstore_api/model/array_of_number_only.py
index f2e080bc258e..7b754dc283e6 100644
--- a/samples/openapi3/client/petstore/python/petstore_api/model/array_of_number_only.py
+++ b/samples/openapi3/client/petstore/python/petstore_api/model/array_of_number_only.py
@@ -57,7 +57,13 @@ class ArrayOfNumberOnly(ModelNormal):
validations = {
}
- additional_properties_type = None
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
diff --git a/samples/openapi3/client/petstore/python/petstore_api/model/array_test.py b/samples/openapi3/client/petstore/python/petstore_api/model/array_test.py
index ac42b07b93c9..9691a1e60374 100644
--- a/samples/openapi3/client/petstore/python/petstore_api/model/array_test.py
+++ b/samples/openapi3/client/petstore/python/petstore_api/model/array_test.py
@@ -61,7 +61,14 @@ class ArrayTest(ModelNormal):
validations = {
}
- additional_properties_type = None
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ lazy_import()
+ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
diff --git a/samples/openapi3/client/petstore/python/petstore_api/model/banana.py b/samples/openapi3/client/petstore/python/petstore_api/model/banana.py
index 513bd6bf06b1..24ad257e6d21 100644
--- a/samples/openapi3/client/petstore/python/petstore_api/model/banana.py
+++ b/samples/openapi3/client/petstore/python/petstore_api/model/banana.py
@@ -57,7 +57,13 @@ class Banana(ModelNormal):
validations = {
}
- additional_properties_type = None
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
@@ -96,9 +102,12 @@ def discriminator():
])
@convert_js_args_to_python_args
- def __init__(self, *args, **kwargs): # noqa: E501
+ def __init__(self, length_cm, *args, **kwargs): # noqa: E501
"""Banana - a model defined in OpenAPI
+ Args:
+ length_cm (float):
+
Keyword Args:
_check_type (bool): if True, values for parameters in openapi_types
will be type checked and a TypeError will be
@@ -130,7 +139,6 @@ def __init__(self, *args, **kwargs): # noqa: E501
Animal class but this time we won't travel
through its discriminator because we passed in
_visited_composed_classes = (Animal,)
- length_cm (float): [optional] # noqa: E501
"""
_check_type = kwargs.pop('_check_type', True)
@@ -156,6 +164,7 @@ def __init__(self, *args, **kwargs): # noqa: E501
self._configuration = _configuration
self._visited_composed_classes = _visited_composed_classes + (self.__class__,)
+ self.length_cm = length_cm
for var_name, var_value in kwargs.items():
if var_name not in self.attribute_map and \
self._configuration is not None and \
diff --git a/samples/openapi3/client/petstore/python/petstore_api/model/basque_pig.py b/samples/openapi3/client/petstore/python/petstore_api/model/basque_pig.py
index 603f7761867c..25b336460bc4 100644
--- a/samples/openapi3/client/petstore/python/petstore_api/model/basque_pig.py
+++ b/samples/openapi3/client/petstore/python/petstore_api/model/basque_pig.py
@@ -57,7 +57,13 @@ class BasquePig(ModelNormal):
validations = {
}
- additional_properties_type = None
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
diff --git a/samples/openapi3/client/petstore/python/petstore_api/model/capitalization.py b/samples/openapi3/client/petstore/python/petstore_api/model/capitalization.py
index 710c17e51a56..6d939535ceef 100644
--- a/samples/openapi3/client/petstore/python/petstore_api/model/capitalization.py
+++ b/samples/openapi3/client/petstore/python/petstore_api/model/capitalization.py
@@ -57,7 +57,13 @@ class Capitalization(ModelNormal):
validations = {
}
- additional_properties_type = None
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
diff --git a/samples/openapi3/client/petstore/python/petstore_api/model/cat.py b/samples/openapi3/client/petstore/python/petstore_api/model/cat.py
index 1d62177c6c2e..eeea79359fc9 100644
--- a/samples/openapi3/client/petstore/python/petstore_api/model/cat.py
+++ b/samples/openapi3/client/petstore/python/petstore_api/model/cat.py
@@ -27,10 +27,8 @@
)
def lazy_import():
- from petstore_api.model.address import Address
from petstore_api.model.animal import Animal
from petstore_api.model.cat_all_of import CatAllOf
- globals()['Address'] = Address
globals()['Animal'] = Animal
globals()['CatAllOf'] = CatAllOf
@@ -120,13 +118,11 @@ def discriminator():
])
@convert_js_args_to_python_args
- def __init__(self, class_name, *args, **kwargs): # noqa: E501
+ def __init__(self, *args, **kwargs): # noqa: E501
"""Cat - a model defined in OpenAPI
- Args:
- class_name (str):
-
Keyword Args:
+ class_name (str):
_check_type (bool): if True, values for parameters in openapi_types
will be type checked and a TypeError will be
raised if the wrong type is input.
@@ -191,26 +187,18 @@ def __init__(self, class_name, *args, **kwargs): # noqa: E501
'_configuration': _configuration,
'_visited_composed_classes': self._visited_composed_classes,
}
- required_args = {
- 'class_name': class_name,
- }
- model_args = {}
- model_args.update(required_args)
- model_args.update(kwargs)
composed_info = validate_get_composed_info(
- constant_args, model_args, self)
+ constant_args, kwargs, self)
self._composed_instances = composed_info[0]
self._var_name_to_model_instances = composed_info[1]
self._additional_properties_model_instances = composed_info[2]
- unused_args = composed_info[3]
+ discarded_args = composed_info[3]
- for var_name, var_value in required_args.items():
- setattr(self, var_name, var_value)
for var_name, var_value in kwargs.items():
- if var_name in unused_args and \
+ if var_name in discarded_args and \
self._configuration is not None and \
self._configuration.discard_unknown_keys and \
- not self._additional_properties_model_instances:
+ self._additional_properties_model_instances:
# discard variable.
continue
setattr(self, var_name, var_value)
@@ -229,7 +217,6 @@ def _composed_schemas():
'anyOf': [
],
'allOf': [
- Address,
Animal,
CatAllOf,
],
diff --git a/samples/openapi3/client/petstore/python/petstore_api/model/cat_all_of.py b/samples/openapi3/client/petstore/python/petstore_api/model/cat_all_of.py
index 50b046510dfa..7efba680b4d8 100644
--- a/samples/openapi3/client/petstore/python/petstore_api/model/cat_all_of.py
+++ b/samples/openapi3/client/petstore/python/petstore_api/model/cat_all_of.py
@@ -57,7 +57,13 @@ class CatAllOf(ModelNormal):
validations = {
}
- additional_properties_type = None
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
diff --git a/samples/openapi3/client/petstore/python/petstore_api/model/category.py b/samples/openapi3/client/petstore/python/petstore_api/model/category.py
index ed167471d356..4936b4f0e443 100644
--- a/samples/openapi3/client/petstore/python/petstore_api/model/category.py
+++ b/samples/openapi3/client/petstore/python/petstore_api/model/category.py
@@ -57,7 +57,13 @@ class Category(ModelNormal):
validations = {
}
- additional_properties_type = None
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
diff --git a/samples/openapi3/client/petstore/python/petstore_api/model/child_cat.py b/samples/openapi3/client/petstore/python/petstore_api/model/child_cat.py
index e1869c917cd8..d054cb7a97a0 100644
--- a/samples/openapi3/client/petstore/python/petstore_api/model/child_cat.py
+++ b/samples/openapi3/client/petstore/python/petstore_api/model/child_cat.py
@@ -116,13 +116,11 @@ def discriminator():
])
@convert_js_args_to_python_args
- def __init__(self, pet_type, *args, **kwargs): # noqa: E501
+ def __init__(self, *args, **kwargs): # noqa: E501
"""ChildCat - a model defined in OpenAPI
- Args:
- pet_type (str):
-
Keyword Args:
+ pet_type (str):
_check_type (bool): if True, values for parameters in openapi_types
will be type checked and a TypeError will be
raised if the wrong type is input.
@@ -186,26 +184,18 @@ def __init__(self, pet_type, *args, **kwargs): # noqa: E501
'_configuration': _configuration,
'_visited_composed_classes': self._visited_composed_classes,
}
- required_args = {
- 'pet_type': pet_type,
- }
- model_args = {}
- model_args.update(required_args)
- model_args.update(kwargs)
composed_info = validate_get_composed_info(
- constant_args, model_args, self)
+ constant_args, kwargs, self)
self._composed_instances = composed_info[0]
self._var_name_to_model_instances = composed_info[1]
self._additional_properties_model_instances = composed_info[2]
- unused_args = composed_info[3]
+ discarded_args = composed_info[3]
- for var_name, var_value in required_args.items():
- setattr(self, var_name, var_value)
for var_name, var_value in kwargs.items():
- if var_name in unused_args and \
+ if var_name in discarded_args and \
self._configuration is not None and \
self._configuration.discard_unknown_keys and \
- not self._additional_properties_model_instances:
+ self._additional_properties_model_instances:
# discard variable.
continue
setattr(self, var_name, var_value)
diff --git a/samples/openapi3/client/petstore/python/petstore_api/model/child_cat_all_of.py b/samples/openapi3/client/petstore/python/petstore_api/model/child_cat_all_of.py
index f0f1a1ae6bd4..3d732d085fba 100644
--- a/samples/openapi3/client/petstore/python/petstore_api/model/child_cat_all_of.py
+++ b/samples/openapi3/client/petstore/python/petstore_api/model/child_cat_all_of.py
@@ -57,7 +57,13 @@ class ChildCatAllOf(ModelNormal):
validations = {
}
- additional_properties_type = None
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
diff --git a/samples/openapi3/client/petstore/python/petstore_api/model/class_model.py b/samples/openapi3/client/petstore/python/petstore_api/model/class_model.py
index 18c16f89f908..9e65a9373650 100644
--- a/samples/openapi3/client/petstore/python/petstore_api/model/class_model.py
+++ b/samples/openapi3/client/petstore/python/petstore_api/model/class_model.py
@@ -57,7 +57,13 @@ class ClassModel(ModelNormal):
validations = {
}
- additional_properties_type = None
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
diff --git a/samples/openapi3/client/petstore/python/petstore_api/model/client.py b/samples/openapi3/client/petstore/python/petstore_api/model/client.py
index da615c547731..6218de1e19e4 100644
--- a/samples/openapi3/client/petstore/python/petstore_api/model/client.py
+++ b/samples/openapi3/client/petstore/python/petstore_api/model/client.py
@@ -57,7 +57,13 @@ class Client(ModelNormal):
validations = {
}
- additional_properties_type = None
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
diff --git a/samples/openapi3/client/petstore/python/petstore_api/model/complex_quadrilateral.py b/samples/openapi3/client/petstore/python/petstore_api/model/complex_quadrilateral.py
index 56853f5f34f1..e461673adbd4 100644
--- a/samples/openapi3/client/petstore/python/petstore_api/model/complex_quadrilateral.py
+++ b/samples/openapi3/client/petstore/python/petstore_api/model/complex_quadrilateral.py
@@ -113,14 +113,12 @@ def discriminator():
])
@convert_js_args_to_python_args
- def __init__(self, shape_type, quadrilateral_type, *args, **kwargs): # noqa: E501
+ def __init__(self, *args, **kwargs): # noqa: E501
"""ComplexQuadrilateral - a model defined in OpenAPI
- Args:
+ Keyword Args:
shape_type (str):
quadrilateral_type (str):
-
- Keyword Args:
_check_type (bool): if True, values for parameters in openapi_types
will be type checked and a TypeError will be
raised if the wrong type is input.
@@ -183,27 +181,18 @@ def __init__(self, shape_type, quadrilateral_type, *args, **kwargs): # noqa: E5
'_configuration': _configuration,
'_visited_composed_classes': self._visited_composed_classes,
}
- required_args = {
- 'shape_type': shape_type,
- 'quadrilateral_type': quadrilateral_type,
- }
- model_args = {}
- model_args.update(required_args)
- model_args.update(kwargs)
composed_info = validate_get_composed_info(
- constant_args, model_args, self)
+ constant_args, kwargs, self)
self._composed_instances = composed_info[0]
self._var_name_to_model_instances = composed_info[1]
self._additional_properties_model_instances = composed_info[2]
- unused_args = composed_info[3]
+ discarded_args = composed_info[3]
- for var_name, var_value in required_args.items():
- setattr(self, var_name, var_value)
for var_name, var_value in kwargs.items():
- if var_name in unused_args and \
+ if var_name in discarded_args and \
self._configuration is not None and \
self._configuration.discard_unknown_keys and \
- not self._additional_properties_model_instances:
+ self._additional_properties_model_instances:
# discard variable.
continue
setattr(self, var_name, var_value)
diff --git a/samples/openapi3/client/petstore/python/petstore_api/model/composed_one_of_number_with_validations.py b/samples/openapi3/client/petstore/python/petstore_api/model/composed_one_of_number_with_validations.py
index 4a1129432f54..299c866cf8f3 100644
--- a/samples/openapi3/client/petstore/python/petstore_api/model/composed_one_of_number_with_validations.py
+++ b/samples/openapi3/client/petstore/python/petstore_api/model/composed_one_of_number_with_validations.py
@@ -181,25 +181,18 @@ def __init__(self, *args, **kwargs): # noqa: E501
'_configuration': _configuration,
'_visited_composed_classes': self._visited_composed_classes,
}
- required_args = {
- }
- model_args = {}
- model_args.update(required_args)
- model_args.update(kwargs)
composed_info = validate_get_composed_info(
- constant_args, model_args, self)
+ constant_args, kwargs, self)
self._composed_instances = composed_info[0]
self._var_name_to_model_instances = composed_info[1]
self._additional_properties_model_instances = composed_info[2]
- unused_args = composed_info[3]
+ discarded_args = composed_info[3]
- for var_name, var_value in required_args.items():
- setattr(self, var_name, var_value)
for var_name, var_value in kwargs.items():
- if var_name in unused_args and \
+ if var_name in discarded_args and \
self._configuration is not None and \
self._configuration.discard_unknown_keys and \
- not self._additional_properties_model_instances:
+ self._additional_properties_model_instances:
# discard variable.
continue
setattr(self, var_name, var_value)
diff --git a/samples/openapi3/client/petstore/python/petstore_api/model/composed_schema_with_props_and_no_add_props.py b/samples/openapi3/client/petstore/python/petstore_api/model/composed_schema_with_props_and_no_add_props.py
new file mode 100644
index 000000000000..518f4774b555
--- /dev/null
+++ b/samples/openapi3/client/petstore/python/petstore_api/model/composed_schema_with_props_and_no_add_props.py
@@ -0,0 +1,212 @@
+"""
+ 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: https://openapi-generator.tech
+"""
+
+
+import re # noqa: F401
+import sys # noqa: F401
+
+from petstore_api.model_utils import ( # noqa: F401
+ ApiTypeError,
+ ModelComposed,
+ ModelNormal,
+ ModelSimple,
+ cached_property,
+ change_keys_js_to_python,
+ convert_js_args_to_python_args,
+ date,
+ datetime,
+ file_type,
+ none_type,
+ validate_get_composed_info,
+)
+
+def lazy_import():
+ from petstore_api.model.tag import Tag
+ globals()['Tag'] = Tag
+
+
+class ComposedSchemaWithPropsAndNoAddProps(ModelComposed):
+ """NOTE: This class is auto generated by OpenAPI Generator.
+ Ref: https://openapi-generator.tech
+
+ Do not edit the class manually.
+
+ Attributes:
+ allowed_values (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ with a capitalized key describing the allowed value and an allowed
+ value. These dicts store the allowed enum values.
+ attribute_map (dict): The key is attribute name
+ and the value is json key in definition.
+ discriminator_value_class_map (dict): A dict to go from the discriminator
+ variable value to the discriminator class name.
+ validations (dict): The key is the tuple path to the attribute
+ and the for var_name this is (var_name,). The value is a dict
+ that stores validations for max_length, min_length, max_items,
+ min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
+ inclusive_minimum, and regex.
+ additional_properties_type (tuple): A tuple of classes accepted
+ as additional properties values.
+ """
+
+ allowed_values = {
+ }
+
+ validations = {
+ }
+
+ additional_properties_type = None
+
+ _nullable = False
+
+ @cached_property
+ def openapi_types():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+
+ Returns
+ openapi_types (dict): The key is attribute name
+ and the value is attribute type.
+ """
+ lazy_import()
+ return {
+ 'color': (str,), # noqa: E501
+ 'id': (int,), # noqa: E501
+ 'name': (str,), # noqa: E501
+ }
+
+ @cached_property
+ def discriminator():
+ return None
+
+
+ attribute_map = {
+ 'color': 'color', # noqa: E501
+ 'id': 'id', # noqa: E501
+ 'name': 'name', # noqa: E501
+ }
+
+ required_properties = set([
+ '_data_store',
+ '_check_type',
+ '_spec_property_naming',
+ '_path_to_item',
+ '_configuration',
+ '_visited_composed_classes',
+ '_composed_instances',
+ '_var_name_to_model_instances',
+ '_additional_properties_model_instances',
+ ])
+
+ @convert_js_args_to_python_args
+ def __init__(self, *args, **kwargs): # noqa: E501
+ """ComposedSchemaWithPropsAndNoAddProps - a model defined in OpenAPI
+
+ Keyword Args:
+ _check_type (bool): if True, values for parameters in openapi_types
+ will be type checked and a TypeError will be
+ raised if the wrong type is input.
+ Defaults to True
+ _path_to_item (tuple/list): This is a list of keys or values to
+ drill down to the model in received_data
+ when deserializing a response
+ _spec_property_naming (bool): True if the variable names in the input data
+ are serialized names, as specified in the OpenAPI document.
+ False if the variable names in the input data
+ are pythonic names, e.g. snake case (default)
+ _configuration (Configuration): the instance to use when
+ deserializing a file_type parameter.
+ If passed, type conversion is attempted
+ If omitted no type conversion is done.
+ _visited_composed_classes (tuple): This stores a tuple of
+ classes that we have traveled through so that
+ if we see that class again we will not use its
+ discriminator again.
+ When traveling through a discriminator, the
+ composed schema that is
+ is traveled through is added to this set.
+ For example if Animal has a discriminator
+ petType and we pass in "Dog", and the class Dog
+ allOf includes Animal, we move through Animal
+ once using the discriminator, and pick Dog.
+ Then in Dog, we will make an instance of the
+ Animal class but this time we won't travel
+ through its discriminator because we passed in
+ _visited_composed_classes = (Animal,)
+ color (str): [optional] # noqa: E501
+ id (int): [optional] # noqa: E501
+ name (str): [optional] # noqa: E501
+ """
+
+ _check_type = kwargs.pop('_check_type', True)
+ _spec_property_naming = kwargs.pop('_spec_property_naming', False)
+ _path_to_item = kwargs.pop('_path_to_item', ())
+ _configuration = kwargs.pop('_configuration', None)
+ _visited_composed_classes = kwargs.pop('_visited_composed_classes', ())
+
+ if args:
+ raise ApiTypeError(
+ "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % (
+ args,
+ self.__class__.__name__,
+ ),
+ path_to_item=_path_to_item,
+ valid_classes=(self.__class__,),
+ )
+
+ self._data_store = {}
+ self._check_type = _check_type
+ self._spec_property_naming = _spec_property_naming
+ self._path_to_item = _path_to_item
+ self._configuration = _configuration
+ self._visited_composed_classes = _visited_composed_classes + (self.__class__,)
+
+ constant_args = {
+ '_check_type': _check_type,
+ '_path_to_item': _path_to_item,
+ '_spec_property_naming': _spec_property_naming,
+ '_configuration': _configuration,
+ '_visited_composed_classes': self._visited_composed_classes,
+ }
+ composed_info = validate_get_composed_info(
+ constant_args, kwargs, self)
+ self._composed_instances = composed_info[0]
+ self._var_name_to_model_instances = composed_info[1]
+ self._additional_properties_model_instances = composed_info[2]
+ discarded_args = composed_info[3]
+
+ for var_name, var_value in kwargs.items():
+ if var_name in discarded_args and \
+ self._configuration is not None and \
+ self._configuration.discard_unknown_keys and \
+ self._additional_properties_model_instances:
+ # discard variable.
+ continue
+ setattr(self, var_name, var_value)
+
+ @cached_property
+ def _composed_schemas():
+ # we need this here to make our import statements work
+ # we must store _composed_schemas in here so the code is only run
+ # when we invoke this method. If we kept this at the class
+ # level we would get an error beause the class level
+ # code would be run when this module is imported, and these composed
+ # classes don't exist yet because their module has not finished
+ # loading
+ lazy_import()
+ return {
+ 'anyOf': [
+ ],
+ 'allOf': [
+ Tag,
+ ],
+ 'oneOf': [
+ ],
+ }
diff --git a/samples/openapi3/client/petstore/python/petstore_api/model/danish_pig.py b/samples/openapi3/client/petstore/python/petstore_api/model/danish_pig.py
index 5a6e424a4ec9..82215915e84c 100644
--- a/samples/openapi3/client/petstore/python/petstore_api/model/danish_pig.py
+++ b/samples/openapi3/client/petstore/python/petstore_api/model/danish_pig.py
@@ -57,7 +57,13 @@ class DanishPig(ModelNormal):
validations = {
}
- additional_properties_type = None
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
diff --git a/samples/openapi3/client/petstore/python/petstore_api/model/dog.py b/samples/openapi3/client/petstore/python/petstore_api/model/dog.py
index 8bf6d8fd3ade..3452f0d040a0 100644
--- a/samples/openapi3/client/petstore/python/petstore_api/model/dog.py
+++ b/samples/openapi3/client/petstore/python/petstore_api/model/dog.py
@@ -118,13 +118,11 @@ def discriminator():
])
@convert_js_args_to_python_args
- def __init__(self, class_name, *args, **kwargs): # noqa: E501
+ def __init__(self, *args, **kwargs): # noqa: E501
"""Dog - a model defined in OpenAPI
- Args:
- class_name (str):
-
Keyword Args:
+ class_name (str):
_check_type (bool): if True, values for parameters in openapi_types
will be type checked and a TypeError will be
raised if the wrong type is input.
@@ -189,26 +187,18 @@ def __init__(self, class_name, *args, **kwargs): # noqa: E501
'_configuration': _configuration,
'_visited_composed_classes': self._visited_composed_classes,
}
- required_args = {
- 'class_name': class_name,
- }
- model_args = {}
- model_args.update(required_args)
- model_args.update(kwargs)
composed_info = validate_get_composed_info(
- constant_args, model_args, self)
+ constant_args, kwargs, self)
self._composed_instances = composed_info[0]
self._var_name_to_model_instances = composed_info[1]
self._additional_properties_model_instances = composed_info[2]
- unused_args = composed_info[3]
+ discarded_args = composed_info[3]
- for var_name, var_value in required_args.items():
- setattr(self, var_name, var_value)
for var_name, var_value in kwargs.items():
- if var_name in unused_args and \
+ if var_name in discarded_args and \
self._configuration is not None and \
self._configuration.discard_unknown_keys and \
- not self._additional_properties_model_instances:
+ self._additional_properties_model_instances:
# discard variable.
continue
setattr(self, var_name, var_value)
diff --git a/samples/openapi3/client/petstore/python/petstore_api/model/dog_all_of.py b/samples/openapi3/client/petstore/python/petstore_api/model/dog_all_of.py
index b7b2e7db66d9..962903d3a381 100644
--- a/samples/openapi3/client/petstore/python/petstore_api/model/dog_all_of.py
+++ b/samples/openapi3/client/petstore/python/petstore_api/model/dog_all_of.py
@@ -57,7 +57,13 @@ class DogAllOf(ModelNormal):
validations = {
}
- additional_properties_type = None
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
diff --git a/samples/openapi3/client/petstore/python/petstore_api/model/enum_arrays.py b/samples/openapi3/client/petstore/python/petstore_api/model/enum_arrays.py
index 43ebac57de38..db56838d7e49 100644
--- a/samples/openapi3/client/petstore/python/petstore_api/model/enum_arrays.py
+++ b/samples/openapi3/client/petstore/python/petstore_api/model/enum_arrays.py
@@ -65,7 +65,13 @@ class EnumArrays(ModelNormal):
validations = {
}
- additional_properties_type = None
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
diff --git a/samples/openapi3/client/petstore/python/petstore_api/model/enum_class.py b/samples/openapi3/client/petstore/python/petstore_api/model/enum_class.py
index 14188ca31d28..63be703c38e9 100644
--- a/samples/openapi3/client/petstore/python/petstore_api/model/enum_class.py
+++ b/samples/openapi3/client/petstore/python/petstore_api/model/enum_class.py
@@ -58,7 +58,13 @@ class EnumClass(ModelSimple):
validations = {
}
- additional_properties_type = None
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
diff --git a/samples/openapi3/client/petstore/python/petstore_api/model/enum_test.py b/samples/openapi3/client/petstore/python/petstore_api/model/enum_test.py
index c0284b371a93..23ddbcf9a2ca 100644
--- a/samples/openapi3/client/petstore/python/petstore_api/model/enum_test.py
+++ b/samples/openapi3/client/petstore/python/petstore_api/model/enum_test.py
@@ -89,7 +89,14 @@ class EnumTest(ModelNormal):
validations = {
}
- additional_properties_type = None
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ lazy_import()
+ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
diff --git a/samples/openapi3/client/petstore/python/petstore_api/model/equilateral_triangle.py b/samples/openapi3/client/petstore/python/petstore_api/model/equilateral_triangle.py
index a536701d701e..e5e4104bd024 100644
--- a/samples/openapi3/client/petstore/python/petstore_api/model/equilateral_triangle.py
+++ b/samples/openapi3/client/petstore/python/petstore_api/model/equilateral_triangle.py
@@ -113,14 +113,12 @@ def discriminator():
])
@convert_js_args_to_python_args
- def __init__(self, shape_type, triangle_type, *args, **kwargs): # noqa: E501
+ def __init__(self, *args, **kwargs): # noqa: E501
"""EquilateralTriangle - a model defined in OpenAPI
- Args:
+ Keyword Args:
shape_type (str):
triangle_type (str):
-
- Keyword Args:
_check_type (bool): if True, values for parameters in openapi_types
will be type checked and a TypeError will be
raised if the wrong type is input.
@@ -183,27 +181,18 @@ def __init__(self, shape_type, triangle_type, *args, **kwargs): # noqa: E501
'_configuration': _configuration,
'_visited_composed_classes': self._visited_composed_classes,
}
- required_args = {
- 'shape_type': shape_type,
- 'triangle_type': triangle_type,
- }
- model_args = {}
- model_args.update(required_args)
- model_args.update(kwargs)
composed_info = validate_get_composed_info(
- constant_args, model_args, self)
+ constant_args, kwargs, self)
self._composed_instances = composed_info[0]
self._var_name_to_model_instances = composed_info[1]
self._additional_properties_model_instances = composed_info[2]
- unused_args = composed_info[3]
+ discarded_args = composed_info[3]
- for var_name, var_value in required_args.items():
- setattr(self, var_name, var_value)
for var_name, var_value in kwargs.items():
- if var_name in unused_args and \
+ if var_name in discarded_args and \
self._configuration is not None and \
self._configuration.discard_unknown_keys and \
- not self._additional_properties_model_instances:
+ self._additional_properties_model_instances:
# discard variable.
continue
setattr(self, var_name, var_value)
diff --git a/samples/openapi3/client/petstore/python/petstore_api/model/file.py b/samples/openapi3/client/petstore/python/petstore_api/model/file.py
index a38cccacc6ab..137d00263242 100644
--- a/samples/openapi3/client/petstore/python/petstore_api/model/file.py
+++ b/samples/openapi3/client/petstore/python/petstore_api/model/file.py
@@ -57,7 +57,13 @@ class File(ModelNormal):
validations = {
}
- additional_properties_type = None
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
diff --git a/samples/openapi3/client/petstore/python/petstore_api/model/file_schema_test_class.py b/samples/openapi3/client/petstore/python/petstore_api/model/file_schema_test_class.py
index b8c519ed9c7c..3722125ae485 100644
--- a/samples/openapi3/client/petstore/python/petstore_api/model/file_schema_test_class.py
+++ b/samples/openapi3/client/petstore/python/petstore_api/model/file_schema_test_class.py
@@ -61,7 +61,14 @@ class FileSchemaTestClass(ModelNormal):
validations = {
}
- additional_properties_type = None
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ lazy_import()
+ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
diff --git a/samples/openapi3/client/petstore/python/petstore_api/model/foo.py b/samples/openapi3/client/petstore/python/petstore_api/model/foo.py
index ebbb09adf91e..7c319dc9995d 100644
--- a/samples/openapi3/client/petstore/python/petstore_api/model/foo.py
+++ b/samples/openapi3/client/petstore/python/petstore_api/model/foo.py
@@ -57,7 +57,13 @@ class Foo(ModelNormal):
validations = {
}
- additional_properties_type = None
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
diff --git a/samples/openapi3/client/petstore/python/petstore_api/model/format_test.py b/samples/openapi3/client/petstore/python/petstore_api/model/format_test.py
index b232da04b45e..cce7f7f09819 100644
--- a/samples/openapi3/client/petstore/python/petstore_api/model/format_test.py
+++ b/samples/openapi3/client/petstore/python/petstore_api/model/format_test.py
@@ -100,7 +100,13 @@ class FormatTest(ModelNormal):
},
}
- additional_properties_type = None
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
diff --git a/samples/openapi3/client/petstore/python/petstore_api/model/fruit.py b/samples/openapi3/client/petstore/python/petstore_api/model/fruit.py
index 15ea987edf5d..c7283f99d0c7 100644
--- a/samples/openapi3/client/petstore/python/petstore_api/model/fruit.py
+++ b/samples/openapi3/client/petstore/python/petstore_api/model/fruit.py
@@ -74,7 +74,14 @@ class Fruit(ModelComposed):
},
}
- additional_properties_type = None
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ lazy_import()
+ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
@@ -90,10 +97,10 @@ def openapi_types():
"""
lazy_import()
return {
- 'color': (str,), # noqa: E501
'cultivar': (str,), # noqa: E501
- 'origin': (str,), # noqa: E501
'length_cm': (float,), # noqa: E501
+ 'color': (str,), # noqa: E501
+ 'origin': (str,), # noqa: E501
}
@cached_property
@@ -102,10 +109,10 @@ def discriminator():
attribute_map = {
- 'color': 'color', # noqa: E501
'cultivar': 'cultivar', # noqa: E501
- 'origin': 'origin', # noqa: E501
'length_cm': 'lengthCm', # noqa: E501
+ 'color': 'color', # noqa: E501
+ 'origin': 'origin', # noqa: E501
}
required_properties = set([
@@ -125,6 +132,8 @@ def __init__(self, *args, **kwargs): # noqa: E501
"""Fruit - a model defined in OpenAPI
Keyword Args:
+ cultivar (str):
+ length_cm (float):
_check_type (bool): if True, values for parameters in openapi_types
will be type checked and a TypeError will be
raised if the wrong type is input.
@@ -156,9 +165,7 @@ def __init__(self, *args, **kwargs): # noqa: E501
through its discriminator because we passed in
_visited_composed_classes = (Animal,)
color (str): [optional] # noqa: E501
- cultivar (str): [optional] # noqa: E501
origin (str): [optional] # noqa: E501
- length_cm (float): [optional] # noqa: E501
"""
_check_type = kwargs.pop('_check_type', True)
@@ -191,25 +198,18 @@ def __init__(self, *args, **kwargs): # noqa: E501
'_configuration': _configuration,
'_visited_composed_classes': self._visited_composed_classes,
}
- required_args = {
- }
- model_args = {}
- model_args.update(required_args)
- model_args.update(kwargs)
composed_info = validate_get_composed_info(
- constant_args, model_args, self)
+ constant_args, kwargs, self)
self._composed_instances = composed_info[0]
self._var_name_to_model_instances = composed_info[1]
self._additional_properties_model_instances = composed_info[2]
- unused_args = composed_info[3]
+ discarded_args = composed_info[3]
- for var_name, var_value in required_args.items():
- setattr(self, var_name, var_value)
for var_name, var_value in kwargs.items():
- if var_name in unused_args and \
+ if var_name in discarded_args and \
self._configuration is not None and \
self._configuration.discard_unknown_keys and \
- not self._additional_properties_model_instances:
+ self._additional_properties_model_instances:
# discard variable.
continue
setattr(self, var_name, var_value)
diff --git a/samples/openapi3/client/petstore/python/petstore_api/model/fruit_req.py b/samples/openapi3/client/petstore/python/petstore_api/model/fruit_req.py
index 13c4d6424a58..519aa6d20eb5 100644
--- a/samples/openapi3/client/petstore/python/petstore_api/model/fruit_req.py
+++ b/samples/openapi3/client/petstore/python/petstore_api/model/fruit_req.py
@@ -63,7 +63,14 @@ class FruitReq(ModelComposed):
validations = {
}
- additional_properties_type = None
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ lazy_import()
+ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
@@ -180,25 +187,18 @@ def __init__(self, *args, **kwargs): # noqa: E501
'_configuration': _configuration,
'_visited_composed_classes': self._visited_composed_classes,
}
- required_args = {
- }
- model_args = {}
- model_args.update(required_args)
- model_args.update(kwargs)
composed_info = validate_get_composed_info(
- constant_args, model_args, self)
+ constant_args, kwargs, self)
self._composed_instances = composed_info[0]
self._var_name_to_model_instances = composed_info[1]
self._additional_properties_model_instances = composed_info[2]
- unused_args = composed_info[3]
+ discarded_args = composed_info[3]
- for var_name, var_value in required_args.items():
- setattr(self, var_name, var_value)
for var_name, var_value in kwargs.items():
- if var_name in unused_args and \
+ if var_name in discarded_args and \
self._configuration is not None and \
self._configuration.discard_unknown_keys and \
- not self._additional_properties_model_instances:
+ self._additional_properties_model_instances:
# discard variable.
continue
setattr(self, var_name, var_value)
diff --git a/samples/openapi3/client/petstore/python/petstore_api/model/gm_fruit.py b/samples/openapi3/client/petstore/python/petstore_api/model/gm_fruit.py
index f3ad29beb4c4..dc9299c2a1b6 100644
--- a/samples/openapi3/client/petstore/python/petstore_api/model/gm_fruit.py
+++ b/samples/openapi3/client/petstore/python/petstore_api/model/gm_fruit.py
@@ -74,7 +74,14 @@ class GmFruit(ModelComposed):
},
}
- additional_properties_type = None
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ lazy_import()
+ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
@@ -90,10 +97,10 @@ def openapi_types():
"""
lazy_import()
return {
- 'color': (str,), # noqa: E501
'cultivar': (str,), # noqa: E501
- 'origin': (str,), # noqa: E501
'length_cm': (float,), # noqa: E501
+ 'color': (str,), # noqa: E501
+ 'origin': (str,), # noqa: E501
}
@cached_property
@@ -102,10 +109,10 @@ def discriminator():
attribute_map = {
- 'color': 'color', # noqa: E501
'cultivar': 'cultivar', # noqa: E501
- 'origin': 'origin', # noqa: E501
'length_cm': 'lengthCm', # noqa: E501
+ 'color': 'color', # noqa: E501
+ 'origin': 'origin', # noqa: E501
}
required_properties = set([
@@ -125,6 +132,8 @@ def __init__(self, *args, **kwargs): # noqa: E501
"""GmFruit - a model defined in OpenAPI
Keyword Args:
+ cultivar (str):
+ length_cm (float):
_check_type (bool): if True, values for parameters in openapi_types
will be type checked and a TypeError will be
raised if the wrong type is input.
@@ -156,9 +165,7 @@ def __init__(self, *args, **kwargs): # noqa: E501
through its discriminator because we passed in
_visited_composed_classes = (Animal,)
color (str): [optional] # noqa: E501
- cultivar (str): [optional] # noqa: E501
origin (str): [optional] # noqa: E501
- length_cm (float): [optional] # noqa: E501
"""
_check_type = kwargs.pop('_check_type', True)
@@ -191,25 +198,18 @@ def __init__(self, *args, **kwargs): # noqa: E501
'_configuration': _configuration,
'_visited_composed_classes': self._visited_composed_classes,
}
- required_args = {
- }
- model_args = {}
- model_args.update(required_args)
- model_args.update(kwargs)
composed_info = validate_get_composed_info(
- constant_args, model_args, self)
+ constant_args, kwargs, self)
self._composed_instances = composed_info[0]
self._var_name_to_model_instances = composed_info[1]
self._additional_properties_model_instances = composed_info[2]
- unused_args = composed_info[3]
+ discarded_args = composed_info[3]
- for var_name, var_value in required_args.items():
- setattr(self, var_name, var_value)
for var_name, var_value in kwargs.items():
- if var_name in unused_args and \
+ if var_name in discarded_args and \
self._configuration is not None and \
self._configuration.discard_unknown_keys and \
- not self._additional_properties_model_instances:
+ self._additional_properties_model_instances:
# discard variable.
continue
setattr(self, var_name, var_value)
diff --git a/samples/openapi3/client/petstore/python/petstore_api/model/grandparent_animal.py b/samples/openapi3/client/petstore/python/petstore_api/model/grandparent_animal.py
index f7c417562ece..70523affd890 100644
--- a/samples/openapi3/client/petstore/python/petstore_api/model/grandparent_animal.py
+++ b/samples/openapi3/client/petstore/python/petstore_api/model/grandparent_animal.py
@@ -63,7 +63,14 @@ class GrandparentAnimal(ModelNormal):
validations = {
}
- additional_properties_type = None
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ lazy_import()
+ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
diff --git a/samples/openapi3/client/petstore/python/petstore_api/model/has_only_read_only.py b/samples/openapi3/client/petstore/python/petstore_api/model/has_only_read_only.py
index c94781ae2c46..4ea0bb087217 100644
--- a/samples/openapi3/client/petstore/python/petstore_api/model/has_only_read_only.py
+++ b/samples/openapi3/client/petstore/python/petstore_api/model/has_only_read_only.py
@@ -57,7 +57,13 @@ class HasOnlyReadOnly(ModelNormal):
validations = {
}
- additional_properties_type = None
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
diff --git a/samples/openapi3/client/petstore/python/petstore_api/model/health_check_result.py b/samples/openapi3/client/petstore/python/petstore_api/model/health_check_result.py
index 3c0cd37dfad9..356ddea3cb14 100644
--- a/samples/openapi3/client/petstore/python/petstore_api/model/health_check_result.py
+++ b/samples/openapi3/client/petstore/python/petstore_api/model/health_check_result.py
@@ -57,7 +57,13 @@ class HealthCheckResult(ModelNormal):
validations = {
}
- additional_properties_type = None
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
diff --git a/samples/openapi3/client/petstore/python/petstore_api/model/inline_response_default.py b/samples/openapi3/client/petstore/python/petstore_api/model/inline_response_default.py
index 8e814cf43838..cb7b9985ea85 100644
--- a/samples/openapi3/client/petstore/python/petstore_api/model/inline_response_default.py
+++ b/samples/openapi3/client/petstore/python/petstore_api/model/inline_response_default.py
@@ -61,7 +61,14 @@ class InlineResponseDefault(ModelNormal):
validations = {
}
- additional_properties_type = None
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ lazy_import()
+ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
diff --git a/samples/openapi3/client/petstore/python/petstore_api/model/integer_enum.py b/samples/openapi3/client/petstore/python/petstore_api/model/integer_enum.py
index a01fc6149225..a31cd7c56958 100644
--- a/samples/openapi3/client/petstore/python/petstore_api/model/integer_enum.py
+++ b/samples/openapi3/client/petstore/python/petstore_api/model/integer_enum.py
@@ -58,7 +58,13 @@ class IntegerEnum(ModelSimple):
validations = {
}
- additional_properties_type = None
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
diff --git a/samples/openapi3/client/petstore/python/petstore_api/model/integer_enum_one_value.py b/samples/openapi3/client/petstore/python/petstore_api/model/integer_enum_one_value.py
index 0d69cd535b31..f8fc86bfba7f 100644
--- a/samples/openapi3/client/petstore/python/petstore_api/model/integer_enum_one_value.py
+++ b/samples/openapi3/client/petstore/python/petstore_api/model/integer_enum_one_value.py
@@ -56,7 +56,13 @@ class IntegerEnumOneValue(ModelSimple):
validations = {
}
- additional_properties_type = None
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
diff --git a/samples/openapi3/client/petstore/python/petstore_api/model/integer_enum_with_default_value.py b/samples/openapi3/client/petstore/python/petstore_api/model/integer_enum_with_default_value.py
index 958b2ad2e39a..3c56da865f6c 100644
--- a/samples/openapi3/client/petstore/python/petstore_api/model/integer_enum_with_default_value.py
+++ b/samples/openapi3/client/petstore/python/petstore_api/model/integer_enum_with_default_value.py
@@ -58,7 +58,13 @@ class IntegerEnumWithDefaultValue(ModelSimple):
validations = {
}
- additional_properties_type = None
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
diff --git a/samples/openapi3/client/petstore/python/petstore_api/model/isosceles_triangle.py b/samples/openapi3/client/petstore/python/petstore_api/model/isosceles_triangle.py
index 27197f5a235b..b1f64bcb0db9 100644
--- a/samples/openapi3/client/petstore/python/petstore_api/model/isosceles_triangle.py
+++ b/samples/openapi3/client/petstore/python/petstore_api/model/isosceles_triangle.py
@@ -63,7 +63,14 @@ class IsoscelesTriangle(ModelComposed):
validations = {
}
- additional_properties_type = None
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ lazy_import()
+ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
@@ -106,14 +113,12 @@ def discriminator():
])
@convert_js_args_to_python_args
- def __init__(self, shape_type, triangle_type, *args, **kwargs): # noqa: E501
+ def __init__(self, *args, **kwargs): # noqa: E501
"""IsoscelesTriangle - a model defined in OpenAPI
- Args:
+ Keyword Args:
shape_type (str):
triangle_type (str):
-
- Keyword Args:
_check_type (bool): if True, values for parameters in openapi_types
will be type checked and a TypeError will be
raised if the wrong type is input.
@@ -176,27 +181,18 @@ def __init__(self, shape_type, triangle_type, *args, **kwargs): # noqa: E501
'_configuration': _configuration,
'_visited_composed_classes': self._visited_composed_classes,
}
- required_args = {
- 'shape_type': shape_type,
- 'triangle_type': triangle_type,
- }
- model_args = {}
- model_args.update(required_args)
- model_args.update(kwargs)
composed_info = validate_get_composed_info(
- constant_args, model_args, self)
+ constant_args, kwargs, self)
self._composed_instances = composed_info[0]
self._var_name_to_model_instances = composed_info[1]
self._additional_properties_model_instances = composed_info[2]
- unused_args = composed_info[3]
+ discarded_args = composed_info[3]
- for var_name, var_value in required_args.items():
- setattr(self, var_name, var_value)
for var_name, var_value in kwargs.items():
- if var_name in unused_args and \
+ if var_name in discarded_args and \
self._configuration is not None and \
self._configuration.discard_unknown_keys and \
- not self._additional_properties_model_instances:
+ self._additional_properties_model_instances:
# discard variable.
continue
setattr(self, var_name, var_value)
diff --git a/samples/openapi3/client/petstore/python/petstore_api/model/list.py b/samples/openapi3/client/petstore/python/petstore_api/model/list.py
index 09c762d6a794..11b46f10b565 100644
--- a/samples/openapi3/client/petstore/python/petstore_api/model/list.py
+++ b/samples/openapi3/client/petstore/python/petstore_api/model/list.py
@@ -57,7 +57,13 @@ class List(ModelNormal):
validations = {
}
- additional_properties_type = None
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
diff --git a/samples/openapi3/client/petstore/python/petstore_api/model/mammal.py b/samples/openapi3/client/petstore/python/petstore_api/model/mammal.py
index 067adf793505..234933fe1a8e 100644
--- a/samples/openapi3/client/petstore/python/petstore_api/model/mammal.py
+++ b/samples/openapi3/client/petstore/python/petstore_api/model/mammal.py
@@ -131,13 +131,11 @@ def discriminator():
])
@convert_js_args_to_python_args
- def __init__(self, class_name, *args, **kwargs): # noqa: E501
+ def __init__(self, *args, **kwargs): # noqa: E501
"""Mammal - a model defined in OpenAPI
- Args:
- class_name (str):
-
Keyword Args:
+ class_name (str):
_check_type (bool): if True, values for parameters in openapi_types
will be type checked and a TypeError will be
raised if the wrong type is input.
@@ -203,26 +201,18 @@ def __init__(self, class_name, *args, **kwargs): # noqa: E501
'_configuration': _configuration,
'_visited_composed_classes': self._visited_composed_classes,
}
- required_args = {
- 'class_name': class_name,
- }
- model_args = {}
- model_args.update(required_args)
- model_args.update(kwargs)
composed_info = validate_get_composed_info(
- constant_args, model_args, self)
+ constant_args, kwargs, self)
self._composed_instances = composed_info[0]
self._var_name_to_model_instances = composed_info[1]
self._additional_properties_model_instances = composed_info[2]
- unused_args = composed_info[3]
+ discarded_args = composed_info[3]
- for var_name, var_value in required_args.items():
- setattr(self, var_name, var_value)
for var_name, var_value in kwargs.items():
- if var_name in unused_args and \
+ if var_name in discarded_args and \
self._configuration is not None and \
self._configuration.discard_unknown_keys and \
- not self._additional_properties_model_instances:
+ self._additional_properties_model_instances:
# discard variable.
continue
setattr(self, var_name, var_value)
diff --git a/samples/openapi3/client/petstore/python/petstore_api/model/map_test.py b/samples/openapi3/client/petstore/python/petstore_api/model/map_test.py
index 169fb9d88ee0..a5418b39e734 100644
--- a/samples/openapi3/client/petstore/python/petstore_api/model/map_test.py
+++ b/samples/openapi3/client/petstore/python/petstore_api/model/map_test.py
@@ -65,7 +65,14 @@ class MapTest(ModelNormal):
validations = {
}
- additional_properties_type = None
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ lazy_import()
+ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
diff --git a/samples/openapi3/client/petstore/python/petstore_api/model/mixed_properties_and_additional_properties_class.py b/samples/openapi3/client/petstore/python/petstore_api/model/mixed_properties_and_additional_properties_class.py
index 01df80d9d62b..67b3f79d9e5f 100644
--- a/samples/openapi3/client/petstore/python/petstore_api/model/mixed_properties_and_additional_properties_class.py
+++ b/samples/openapi3/client/petstore/python/petstore_api/model/mixed_properties_and_additional_properties_class.py
@@ -61,7 +61,14 @@ class MixedPropertiesAndAdditionalPropertiesClass(ModelNormal):
validations = {
}
- additional_properties_type = None
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ lazy_import()
+ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
diff --git a/samples/openapi3/client/petstore/python/petstore_api/model/model200_response.py b/samples/openapi3/client/petstore/python/petstore_api/model/model200_response.py
index 46b155b65239..056f4c56ad35 100644
--- a/samples/openapi3/client/petstore/python/petstore_api/model/model200_response.py
+++ b/samples/openapi3/client/petstore/python/petstore_api/model/model200_response.py
@@ -57,7 +57,13 @@ class Model200Response(ModelNormal):
validations = {
}
- additional_properties_type = None
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
diff --git a/samples/openapi3/client/petstore/python/petstore_api/model/model_return.py b/samples/openapi3/client/petstore/python/petstore_api/model/model_return.py
index 377b3507a8b3..5f34582cdb4a 100644
--- a/samples/openapi3/client/petstore/python/petstore_api/model/model_return.py
+++ b/samples/openapi3/client/petstore/python/petstore_api/model/model_return.py
@@ -57,7 +57,13 @@ class ModelReturn(ModelNormal):
validations = {
}
- additional_properties_type = None
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
diff --git a/samples/openapi3/client/petstore/python/petstore_api/model/name.py b/samples/openapi3/client/petstore/python/petstore_api/model/name.py
index 1432e185ad6b..06b387ce9bfe 100644
--- a/samples/openapi3/client/petstore/python/petstore_api/model/name.py
+++ b/samples/openapi3/client/petstore/python/petstore_api/model/name.py
@@ -57,7 +57,13 @@ class Name(ModelNormal):
validations = {
}
- additional_properties_type = None
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
diff --git a/samples/openapi3/client/petstore/python/petstore_api/model/nullable_class.py b/samples/openapi3/client/petstore/python/petstore_api/model/nullable_class.py
index a117dfa69160..f2c2cb7642e6 100644
--- a/samples/openapi3/client/petstore/python/petstore_api/model/nullable_class.py
+++ b/samples/openapi3/client/petstore/python/petstore_api/model/nullable_class.py
@@ -63,7 +63,7 @@ def additional_properties_type():
This must be a method because a model may have properties that are
of type self, this must run after the class is loaded
"""
- return ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}, none_type,) # noqa: E501
+ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
@@ -87,6 +87,7 @@ def openapi_types():
'array_nullable_prop': ([{str: (bool, date, datetime, dict, float, int, list, str, none_type)}], none_type,), # noqa: E501
'array_and_items_nullable_prop': ([{str: (bool, date, datetime, dict, float, int, list, str, none_type)}, none_type], none_type,), # noqa: E501
'array_items_nullable': ([{str: (bool, date, datetime, dict, float, int, list, str, none_type)}, none_type],), # noqa: E501
+ 'object_nullable': ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}, none_type,), # noqa: E501
'object_nullable_prop': ({str: ({str: (bool, date, datetime, dict, float, int, list, str, none_type)},)}, none_type,), # noqa: E501
'object_and_items_nullable_prop': ({str: ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}, none_type)}, none_type,), # noqa: E501
'object_items_nullable': ({str: ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}, none_type)},), # noqa: E501
@@ -107,6 +108,7 @@ def discriminator():
'array_nullable_prop': 'array_nullable_prop', # noqa: E501
'array_and_items_nullable_prop': 'array_and_items_nullable_prop', # noqa: E501
'array_items_nullable': 'array_items_nullable', # noqa: E501
+ 'object_nullable': 'object_nullable', # noqa: E501
'object_nullable_prop': 'object_nullable_prop', # noqa: E501
'object_and_items_nullable_prop': 'object_and_items_nullable_prop', # noqa: E501
'object_items_nullable': 'object_items_nullable', # noqa: E501
@@ -167,6 +169,7 @@ def __init__(self, *args, **kwargs): # noqa: E501
array_nullable_prop ([{str: (bool, date, datetime, dict, float, int, list, str, none_type)}], none_type): [optional] # noqa: E501
array_and_items_nullable_prop ([{str: (bool, date, datetime, dict, float, int, list, str, none_type)}, none_type], none_type): [optional] # noqa: E501
array_items_nullable ([{str: (bool, date, datetime, dict, float, int, list, str, none_type)}, none_type]): [optional] # noqa: E501
+ object_nullable ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}, none_type): [optional] # noqa: E501
object_nullable_prop ({str: ({str: (bool, date, datetime, dict, float, int, list, str, none_type)},)}, none_type): [optional] # noqa: E501
object_and_items_nullable_prop ({str: ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}, none_type)}, none_type): [optional] # noqa: E501
object_items_nullable ({str: ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}, none_type)}): [optional] # noqa: E501
diff --git a/samples/openapi3/client/petstore/python/petstore_api/model/nullable_shape.py b/samples/openapi3/client/petstore/python/petstore_api/model/nullable_shape.py
index fcd20ddfbc19..a2cf17e3e7b9 100644
--- a/samples/openapi3/client/petstore/python/petstore_api/model/nullable_shape.py
+++ b/samples/openapi3/client/petstore/python/petstore_api/model/nullable_shape.py
@@ -121,13 +121,11 @@ def discriminator():
])
@convert_js_args_to_python_args
- def __init__(self, shape_type, *args, **kwargs): # noqa: E501
+ def __init__(self, *args, **kwargs): # noqa: E501
"""NullableShape - a model defined in OpenAPI
- Args:
- shape_type (str):
-
Keyword Args:
+ shape_type (str):
_check_type (bool): if True, values for parameters in openapi_types
will be type checked and a TypeError will be
raised if the wrong type is input.
@@ -192,26 +190,18 @@ def __init__(self, shape_type, *args, **kwargs): # noqa: E501
'_configuration': _configuration,
'_visited_composed_classes': self._visited_composed_classes,
}
- required_args = {
- 'shape_type': shape_type,
- }
- model_args = {}
- model_args.update(required_args)
- model_args.update(kwargs)
composed_info = validate_get_composed_info(
- constant_args, model_args, self)
+ constant_args, kwargs, self)
self._composed_instances = composed_info[0]
self._var_name_to_model_instances = composed_info[1]
self._additional_properties_model_instances = composed_info[2]
- unused_args = composed_info[3]
+ discarded_args = composed_info[3]
- for var_name, var_value in required_args.items():
- setattr(self, var_name, var_value)
for var_name, var_value in kwargs.items():
- if var_name in unused_args and \
+ if var_name in discarded_args and \
self._configuration is not None and \
self._configuration.discard_unknown_keys and \
- not self._additional_properties_model_instances:
+ self._additional_properties_model_instances:
# discard variable.
continue
setattr(self, var_name, var_value)
diff --git a/samples/openapi3/client/petstore/python/petstore_api/model/number_only.py b/samples/openapi3/client/petstore/python/petstore_api/model/number_only.py
index d4892dbede5b..cb2c9e2ad526 100644
--- a/samples/openapi3/client/petstore/python/petstore_api/model/number_only.py
+++ b/samples/openapi3/client/petstore/python/petstore_api/model/number_only.py
@@ -57,7 +57,13 @@ class NumberOnly(ModelNormal):
validations = {
}
- additional_properties_type = None
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
diff --git a/samples/openapi3/client/petstore/python/petstore_api/model/number_with_validations.py b/samples/openapi3/client/petstore/python/petstore_api/model/number_with_validations.py
index ffa5e9cf4621..a3b2746c22b5 100644
--- a/samples/openapi3/client/petstore/python/petstore_api/model/number_with_validations.py
+++ b/samples/openapi3/client/petstore/python/petstore_api/model/number_with_validations.py
@@ -57,7 +57,13 @@ class NumberWithValidations(ModelSimple):
},
}
- additional_properties_type = None
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
diff --git a/samples/openapi3/client/petstore/python/petstore_api/model/object_model_with_ref_props.py b/samples/openapi3/client/petstore/python/petstore_api/model/object_model_with_ref_props.py
index b1dc4bf82e2c..7256f67a8d6b 100644
--- a/samples/openapi3/client/petstore/python/petstore_api/model/object_model_with_ref_props.py
+++ b/samples/openapi3/client/petstore/python/petstore_api/model/object_model_with_ref_props.py
@@ -61,7 +61,14 @@ class ObjectModelWithRefProps(ModelNormal):
validations = {
}
- additional_properties_type = None
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ lazy_import()
+ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
diff --git a/samples/openapi3/client/petstore/python/petstore_api/model/order.py b/samples/openapi3/client/petstore/python/petstore_api/model/order.py
index b42f066848ab..48207e4560eb 100644
--- a/samples/openapi3/client/petstore/python/petstore_api/model/order.py
+++ b/samples/openapi3/client/petstore/python/petstore_api/model/order.py
@@ -62,7 +62,13 @@ class Order(ModelNormal):
validations = {
}
- additional_properties_type = None
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
diff --git a/samples/openapi3/client/petstore/python/petstore_api/model/parent_pet.py b/samples/openapi3/client/petstore/python/petstore_api/model/parent_pet.py
index 16099236da34..bda9c2779965 100644
--- a/samples/openapi3/client/petstore/python/petstore_api/model/parent_pet.py
+++ b/samples/openapi3/client/petstore/python/petstore_api/model/parent_pet.py
@@ -116,13 +116,11 @@ def discriminator():
])
@convert_js_args_to_python_args
- def __init__(self, pet_type, *args, **kwargs): # noqa: E501
+ def __init__(self, *args, **kwargs): # noqa: E501
"""ParentPet - a model defined in OpenAPI
- Args:
- pet_type (str):
-
Keyword Args:
+ pet_type (str):
_check_type (bool): if True, values for parameters in openapi_types
will be type checked and a TypeError will be
raised if the wrong type is input.
@@ -185,26 +183,18 @@ def __init__(self, pet_type, *args, **kwargs): # noqa: E501
'_configuration': _configuration,
'_visited_composed_classes': self._visited_composed_classes,
}
- required_args = {
- 'pet_type': pet_type,
- }
- model_args = {}
- model_args.update(required_args)
- model_args.update(kwargs)
composed_info = validate_get_composed_info(
- constant_args, model_args, self)
+ constant_args, kwargs, self)
self._composed_instances = composed_info[0]
self._var_name_to_model_instances = composed_info[1]
self._additional_properties_model_instances = composed_info[2]
- unused_args = composed_info[3]
+ discarded_args = composed_info[3]
- for var_name, var_value in required_args.items():
- setattr(self, var_name, var_value)
for var_name, var_value in kwargs.items():
- if var_name in unused_args and \
+ if var_name in discarded_args and \
self._configuration is not None and \
self._configuration.discard_unknown_keys and \
- not self._additional_properties_model_instances:
+ self._additional_properties_model_instances:
# discard variable.
continue
setattr(self, var_name, var_value)
diff --git a/samples/openapi3/client/petstore/python/petstore_api/model/pet.py b/samples/openapi3/client/petstore/python/petstore_api/model/pet.py
index e9f1e30a3196..b0c8b08607d1 100644
--- a/samples/openapi3/client/petstore/python/petstore_api/model/pet.py
+++ b/samples/openapi3/client/petstore/python/petstore_api/model/pet.py
@@ -68,7 +68,14 @@ class Pet(ModelNormal):
validations = {
}
- additional_properties_type = None
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ lazy_import()
+ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
diff --git a/samples/openapi3/client/petstore/python/petstore_api/model/pig.py b/samples/openapi3/client/petstore/python/petstore_api/model/pig.py
index 4a6f200f6ffc..21f61c65de08 100644
--- a/samples/openapi3/client/petstore/python/petstore_api/model/pig.py
+++ b/samples/openapi3/client/petstore/python/petstore_api/model/pig.py
@@ -117,13 +117,11 @@ def discriminator():
])
@convert_js_args_to_python_args
- def __init__(self, class_name, *args, **kwargs): # noqa: E501
+ def __init__(self, *args, **kwargs): # noqa: E501
"""Pig - a model defined in OpenAPI
- Args:
- class_name (str):
-
Keyword Args:
+ class_name (str):
_check_type (bool): if True, values for parameters in openapi_types
will be type checked and a TypeError will be
raised if the wrong type is input.
@@ -186,26 +184,18 @@ def __init__(self, class_name, *args, **kwargs): # noqa: E501
'_configuration': _configuration,
'_visited_composed_classes': self._visited_composed_classes,
}
- required_args = {
- 'class_name': class_name,
- }
- model_args = {}
- model_args.update(required_args)
- model_args.update(kwargs)
composed_info = validate_get_composed_info(
- constant_args, model_args, self)
+ constant_args, kwargs, self)
self._composed_instances = composed_info[0]
self._var_name_to_model_instances = composed_info[1]
self._additional_properties_model_instances = composed_info[2]
- unused_args = composed_info[3]
+ discarded_args = composed_info[3]
- for var_name, var_value in required_args.items():
- setattr(self, var_name, var_value)
for var_name, var_value in kwargs.items():
- if var_name in unused_args and \
+ if var_name in discarded_args and \
self._configuration is not None and \
self._configuration.discard_unknown_keys and \
- not self._additional_properties_model_instances:
+ self._additional_properties_model_instances:
# discard variable.
continue
setattr(self, var_name, var_value)
diff --git a/samples/openapi3/client/petstore/python/petstore_api/model/quadrilateral.py b/samples/openapi3/client/petstore/python/petstore_api/model/quadrilateral.py
index 4e28ac0d2389..d15d37cdbca9 100644
--- a/samples/openapi3/client/petstore/python/petstore_api/model/quadrilateral.py
+++ b/samples/openapi3/client/petstore/python/petstore_api/model/quadrilateral.py
@@ -119,13 +119,11 @@ def discriminator():
])
@convert_js_args_to_python_args
- def __init__(self, quadrilateral_type, *args, **kwargs): # noqa: E501
+ def __init__(self, *args, **kwargs): # noqa: E501
"""Quadrilateral - a model defined in OpenAPI
- Args:
- quadrilateral_type (str):
-
Keyword Args:
+ quadrilateral_type (str):
_check_type (bool): if True, values for parameters in openapi_types
will be type checked and a TypeError will be
raised if the wrong type is input.
@@ -189,26 +187,18 @@ def __init__(self, quadrilateral_type, *args, **kwargs): # noqa: E501
'_configuration': _configuration,
'_visited_composed_classes': self._visited_composed_classes,
}
- required_args = {
- 'quadrilateral_type': quadrilateral_type,
- }
- model_args = {}
- model_args.update(required_args)
- model_args.update(kwargs)
composed_info = validate_get_composed_info(
- constant_args, model_args, self)
+ constant_args, kwargs, self)
self._composed_instances = composed_info[0]
self._var_name_to_model_instances = composed_info[1]
self._additional_properties_model_instances = composed_info[2]
- unused_args = composed_info[3]
+ discarded_args = composed_info[3]
- for var_name, var_value in required_args.items():
- setattr(self, var_name, var_value)
for var_name, var_value in kwargs.items():
- if var_name in unused_args and \
+ if var_name in discarded_args and \
self._configuration is not None and \
self._configuration.discard_unknown_keys and \
- not self._additional_properties_model_instances:
+ self._additional_properties_model_instances:
# discard variable.
continue
setattr(self, var_name, var_value)
diff --git a/samples/openapi3/client/petstore/python/petstore_api/model/quadrilateral_interface.py b/samples/openapi3/client/petstore/python/petstore_api/model/quadrilateral_interface.py
index 124d9128bc53..872608885aca 100644
--- a/samples/openapi3/client/petstore/python/petstore_api/model/quadrilateral_interface.py
+++ b/samples/openapi3/client/petstore/python/petstore_api/model/quadrilateral_interface.py
@@ -57,7 +57,13 @@ class QuadrilateralInterface(ModelNormal):
validations = {
}
- additional_properties_type = None
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
diff --git a/samples/openapi3/client/petstore/python/petstore_api/model/read_only_first.py b/samples/openapi3/client/petstore/python/petstore_api/model/read_only_first.py
index 5c68eab91ea3..0302bf96a7e5 100644
--- a/samples/openapi3/client/petstore/python/petstore_api/model/read_only_first.py
+++ b/samples/openapi3/client/petstore/python/petstore_api/model/read_only_first.py
@@ -57,7 +57,13 @@ class ReadOnlyFirst(ModelNormal):
validations = {
}
- additional_properties_type = None
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
diff --git a/samples/openapi3/client/petstore/python/petstore_api/model/scalene_triangle.py b/samples/openapi3/client/petstore/python/petstore_api/model/scalene_triangle.py
index 1e3893627dad..86fc0a4f4959 100644
--- a/samples/openapi3/client/petstore/python/petstore_api/model/scalene_triangle.py
+++ b/samples/openapi3/client/petstore/python/petstore_api/model/scalene_triangle.py
@@ -113,14 +113,12 @@ def discriminator():
])
@convert_js_args_to_python_args
- def __init__(self, shape_type, triangle_type, *args, **kwargs): # noqa: E501
+ def __init__(self, *args, **kwargs): # noqa: E501
"""ScaleneTriangle - a model defined in OpenAPI
- Args:
+ Keyword Args:
shape_type (str):
triangle_type (str):
-
- Keyword Args:
_check_type (bool): if True, values for parameters in openapi_types
will be type checked and a TypeError will be
raised if the wrong type is input.
@@ -183,27 +181,18 @@ def __init__(self, shape_type, triangle_type, *args, **kwargs): # noqa: E501
'_configuration': _configuration,
'_visited_composed_classes': self._visited_composed_classes,
}
- required_args = {
- 'shape_type': shape_type,
- 'triangle_type': triangle_type,
- }
- model_args = {}
- model_args.update(required_args)
- model_args.update(kwargs)
composed_info = validate_get_composed_info(
- constant_args, model_args, self)
+ constant_args, kwargs, self)
self._composed_instances = composed_info[0]
self._var_name_to_model_instances = composed_info[1]
self._additional_properties_model_instances = composed_info[2]
- unused_args = composed_info[3]
+ discarded_args = composed_info[3]
- for var_name, var_value in required_args.items():
- setattr(self, var_name, var_value)
for var_name, var_value in kwargs.items():
- if var_name in unused_args and \
+ if var_name in discarded_args and \
self._configuration is not None and \
self._configuration.discard_unknown_keys and \
- not self._additional_properties_model_instances:
+ self._additional_properties_model_instances:
# discard variable.
continue
setattr(self, var_name, var_value)
diff --git a/samples/openapi3/client/petstore/python/petstore_api/model/shape.py b/samples/openapi3/client/petstore/python/petstore_api/model/shape.py
index f5e3c142b914..763a7aa362b0 100644
--- a/samples/openapi3/client/petstore/python/petstore_api/model/shape.py
+++ b/samples/openapi3/client/petstore/python/petstore_api/model/shape.py
@@ -121,13 +121,11 @@ def discriminator():
])
@convert_js_args_to_python_args
- def __init__(self, shape_type, *args, **kwargs): # noqa: E501
+ def __init__(self, *args, **kwargs): # noqa: E501
"""Shape - a model defined in OpenAPI
- Args:
- shape_type (str):
-
Keyword Args:
+ shape_type (str):
_check_type (bool): if True, values for parameters in openapi_types
will be type checked and a TypeError will be
raised if the wrong type is input.
@@ -192,26 +190,18 @@ def __init__(self, shape_type, *args, **kwargs): # noqa: E501
'_configuration': _configuration,
'_visited_composed_classes': self._visited_composed_classes,
}
- required_args = {
- 'shape_type': shape_type,
- }
- model_args = {}
- model_args.update(required_args)
- model_args.update(kwargs)
composed_info = validate_get_composed_info(
- constant_args, model_args, self)
+ constant_args, kwargs, self)
self._composed_instances = composed_info[0]
self._var_name_to_model_instances = composed_info[1]
self._additional_properties_model_instances = composed_info[2]
- unused_args = composed_info[3]
+ discarded_args = composed_info[3]
- for var_name, var_value in required_args.items():
- setattr(self, var_name, var_value)
for var_name, var_value in kwargs.items():
- if var_name in unused_args and \
+ if var_name in discarded_args and \
self._configuration is not None and \
self._configuration.discard_unknown_keys and \
- not self._additional_properties_model_instances:
+ self._additional_properties_model_instances:
# discard variable.
continue
setattr(self, var_name, var_value)
diff --git a/samples/openapi3/client/petstore/python/petstore_api/model/shape_interface.py b/samples/openapi3/client/petstore/python/petstore_api/model/shape_interface.py
index 8a3c52088be3..b8ab31fc31c6 100644
--- a/samples/openapi3/client/petstore/python/petstore_api/model/shape_interface.py
+++ b/samples/openapi3/client/petstore/python/petstore_api/model/shape_interface.py
@@ -57,7 +57,13 @@ class ShapeInterface(ModelNormal):
validations = {
}
- additional_properties_type = None
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
diff --git a/samples/openapi3/client/petstore/python/petstore_api/model/shape_or_null.py b/samples/openapi3/client/petstore/python/petstore_api/model/shape_or_null.py
index 480fa5bd5d65..403449e0c9c2 100644
--- a/samples/openapi3/client/petstore/python/petstore_api/model/shape_or_null.py
+++ b/samples/openapi3/client/petstore/python/petstore_api/model/shape_or_null.py
@@ -121,13 +121,11 @@ def discriminator():
])
@convert_js_args_to_python_args
- def __init__(self, shape_type, *args, **kwargs): # noqa: E501
+ def __init__(self, *args, **kwargs): # noqa: E501
"""ShapeOrNull - a model defined in OpenAPI
- Args:
- shape_type (str):
-
Keyword Args:
+ shape_type (str):
_check_type (bool): if True, values for parameters in openapi_types
will be type checked and a TypeError will be
raised if the wrong type is input.
@@ -192,26 +190,18 @@ def __init__(self, shape_type, *args, **kwargs): # noqa: E501
'_configuration': _configuration,
'_visited_composed_classes': self._visited_composed_classes,
}
- required_args = {
- 'shape_type': shape_type,
- }
- model_args = {}
- model_args.update(required_args)
- model_args.update(kwargs)
composed_info = validate_get_composed_info(
- constant_args, model_args, self)
+ constant_args, kwargs, self)
self._composed_instances = composed_info[0]
self._var_name_to_model_instances = composed_info[1]
self._additional_properties_model_instances = composed_info[2]
- unused_args = composed_info[3]
+ discarded_args = composed_info[3]
- for var_name, var_value in required_args.items():
- setattr(self, var_name, var_value)
for var_name, var_value in kwargs.items():
- if var_name in unused_args and \
+ if var_name in discarded_args and \
self._configuration is not None and \
self._configuration.discard_unknown_keys and \
- not self._additional_properties_model_instances:
+ self._additional_properties_model_instances:
# discard variable.
continue
setattr(self, var_name, var_value)
diff --git a/samples/openapi3/client/petstore/python/petstore_api/model/simple_quadrilateral.py b/samples/openapi3/client/petstore/python/petstore_api/model/simple_quadrilateral.py
index f2f0a61acbd2..d68f1d3b5cb3 100644
--- a/samples/openapi3/client/petstore/python/petstore_api/model/simple_quadrilateral.py
+++ b/samples/openapi3/client/petstore/python/petstore_api/model/simple_quadrilateral.py
@@ -113,14 +113,12 @@ def discriminator():
])
@convert_js_args_to_python_args
- def __init__(self, shape_type, quadrilateral_type, *args, **kwargs): # noqa: E501
+ def __init__(self, *args, **kwargs): # noqa: E501
"""SimpleQuadrilateral - a model defined in OpenAPI
- Args:
+ Keyword Args:
shape_type (str):
quadrilateral_type (str):
-
- Keyword Args:
_check_type (bool): if True, values for parameters in openapi_types
will be type checked and a TypeError will be
raised if the wrong type is input.
@@ -183,27 +181,18 @@ def __init__(self, shape_type, quadrilateral_type, *args, **kwargs): # noqa: E5
'_configuration': _configuration,
'_visited_composed_classes': self._visited_composed_classes,
}
- required_args = {
- 'shape_type': shape_type,
- 'quadrilateral_type': quadrilateral_type,
- }
- model_args = {}
- model_args.update(required_args)
- model_args.update(kwargs)
composed_info = validate_get_composed_info(
- constant_args, model_args, self)
+ constant_args, kwargs, self)
self._composed_instances = composed_info[0]
self._var_name_to_model_instances = composed_info[1]
self._additional_properties_model_instances = composed_info[2]
- unused_args = composed_info[3]
+ discarded_args = composed_info[3]
- for var_name, var_value in required_args.items():
- setattr(self, var_name, var_value)
for var_name, var_value in kwargs.items():
- if var_name in unused_args and \
+ if var_name in discarded_args and \
self._configuration is not None and \
self._configuration.discard_unknown_keys and \
- not self._additional_properties_model_instances:
+ self._additional_properties_model_instances:
# discard variable.
continue
setattr(self, var_name, var_value)
diff --git a/samples/openapi3/client/petstore/python/petstore_api/model/some_object.py b/samples/openapi3/client/petstore/python/petstore_api/model/some_object.py
index 683d1794293c..72687c02ab69 100644
--- a/samples/openapi3/client/petstore/python/petstore_api/model/some_object.py
+++ b/samples/openapi3/client/petstore/python/petstore_api/model/some_object.py
@@ -173,25 +173,18 @@ def __init__(self, *args, **kwargs): # noqa: E501
'_configuration': _configuration,
'_visited_composed_classes': self._visited_composed_classes,
}
- required_args = {
- }
- model_args = {}
- model_args.update(required_args)
- model_args.update(kwargs)
composed_info = validate_get_composed_info(
- constant_args, model_args, self)
+ constant_args, kwargs, self)
self._composed_instances = composed_info[0]
self._var_name_to_model_instances = composed_info[1]
self._additional_properties_model_instances = composed_info[2]
- unused_args = composed_info[3]
+ discarded_args = composed_info[3]
- for var_name, var_value in required_args.items():
- setattr(self, var_name, var_value)
for var_name, var_value in kwargs.items():
- if var_name in unused_args and \
+ if var_name in discarded_args and \
self._configuration is not None and \
self._configuration.discard_unknown_keys and \
- not self._additional_properties_model_instances:
+ self._additional_properties_model_instances:
# discard variable.
continue
setattr(self, var_name, var_value)
diff --git a/samples/openapi3/client/petstore/python/petstore_api/model/special_model_name.py b/samples/openapi3/client/petstore/python/petstore_api/model/special_model_name.py
index 823e77596636..cfaedbc78815 100644
--- a/samples/openapi3/client/petstore/python/petstore_api/model/special_model_name.py
+++ b/samples/openapi3/client/petstore/python/petstore_api/model/special_model_name.py
@@ -57,7 +57,13 @@ class SpecialModelName(ModelNormal):
validations = {
}
- additional_properties_type = None
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
diff --git a/samples/openapi3/client/petstore/python/petstore_api/model/string_enum.py b/samples/openapi3/client/petstore/python/petstore_api/model/string_enum.py
index a6d2fbee08f2..1e48fdecbf49 100644
--- a/samples/openapi3/client/petstore/python/petstore_api/model/string_enum.py
+++ b/samples/openapi3/client/petstore/python/petstore_api/model/string_enum.py
@@ -64,7 +64,13 @@ class StringEnum(ModelSimple):
validations = {
}
- additional_properties_type = None
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = True
diff --git a/samples/openapi3/client/petstore/python/petstore_api/model/string_enum_with_default_value.py b/samples/openapi3/client/petstore/python/petstore_api/model/string_enum_with_default_value.py
index 4dfc426446ca..1417d0ff0fc1 100644
--- a/samples/openapi3/client/petstore/python/petstore_api/model/string_enum_with_default_value.py
+++ b/samples/openapi3/client/petstore/python/petstore_api/model/string_enum_with_default_value.py
@@ -58,7 +58,13 @@ class StringEnumWithDefaultValue(ModelSimple):
validations = {
}
- additional_properties_type = None
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
diff --git a/samples/openapi3/client/petstore/python/petstore_api/model/tag.py b/samples/openapi3/client/petstore/python/petstore_api/model/tag.py
index e5fc749d5149..0e7427effa67 100644
--- a/samples/openapi3/client/petstore/python/petstore_api/model/tag.py
+++ b/samples/openapi3/client/petstore/python/petstore_api/model/tag.py
@@ -57,7 +57,13 @@ class Tag(ModelNormal):
validations = {
}
- additional_properties_type = None
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
diff --git a/samples/openapi3/client/petstore/python/petstore_api/model/triangle.py b/samples/openapi3/client/petstore/python/petstore_api/model/triangle.py
index 83d6e52e8867..b1112e24892d 100644
--- a/samples/openapi3/client/petstore/python/petstore_api/model/triangle.py
+++ b/samples/openapi3/client/petstore/python/petstore_api/model/triangle.py
@@ -122,13 +122,11 @@ def discriminator():
])
@convert_js_args_to_python_args
- def __init__(self, triangle_type, *args, **kwargs): # noqa: E501
+ def __init__(self, *args, **kwargs): # noqa: E501
"""Triangle - a model defined in OpenAPI
- Args:
- triangle_type (str):
-
Keyword Args:
+ triangle_type (str):
_check_type (bool): if True, values for parameters in openapi_types
will be type checked and a TypeError will be
raised if the wrong type is input.
@@ -192,26 +190,18 @@ def __init__(self, triangle_type, *args, **kwargs): # noqa: E501
'_configuration': _configuration,
'_visited_composed_classes': self._visited_composed_classes,
}
- required_args = {
- 'triangle_type': triangle_type,
- }
- model_args = {}
- model_args.update(required_args)
- model_args.update(kwargs)
composed_info = validate_get_composed_info(
- constant_args, model_args, self)
+ constant_args, kwargs, self)
self._composed_instances = composed_info[0]
self._var_name_to_model_instances = composed_info[1]
self._additional_properties_model_instances = composed_info[2]
- unused_args = composed_info[3]
+ discarded_args = composed_info[3]
- for var_name, var_value in required_args.items():
- setattr(self, var_name, var_value)
for var_name, var_value in kwargs.items():
- if var_name in unused_args and \
+ if var_name in discarded_args and \
self._configuration is not None and \
self._configuration.discard_unknown_keys and \
- not self._additional_properties_model_instances:
+ self._additional_properties_model_instances:
# discard variable.
continue
setattr(self, var_name, var_value)
diff --git a/samples/openapi3/client/petstore/python/petstore_api/model/triangle_interface.py b/samples/openapi3/client/petstore/python/petstore_api/model/triangle_interface.py
index c54bd0811720..f31e3dba1358 100644
--- a/samples/openapi3/client/petstore/python/petstore_api/model/triangle_interface.py
+++ b/samples/openapi3/client/petstore/python/petstore_api/model/triangle_interface.py
@@ -57,7 +57,13 @@ class TriangleInterface(ModelNormal):
validations = {
}
- additional_properties_type = None
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
diff --git a/samples/openapi3/client/petstore/python/petstore_api/model/user.py b/samples/openapi3/client/petstore/python/petstore_api/model/user.py
index 7613ac7dc263..2271e3e37e51 100644
--- a/samples/openapi3/client/petstore/python/petstore_api/model/user.py
+++ b/samples/openapi3/client/petstore/python/petstore_api/model/user.py
@@ -57,7 +57,13 @@ class User(ModelNormal):
validations = {
}
- additional_properties_type = None
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
diff --git a/samples/openapi3/client/petstore/python/petstore_api/model/whale.py b/samples/openapi3/client/petstore/python/petstore_api/model/whale.py
index e6400ea34fc7..c3e1c40b4e51 100644
--- a/samples/openapi3/client/petstore/python/petstore_api/model/whale.py
+++ b/samples/openapi3/client/petstore/python/petstore_api/model/whale.py
@@ -57,7 +57,13 @@ class Whale(ModelNormal):
validations = {
}
- additional_properties_type = None
+ @cached_property
+ def additional_properties_type():
+ """
+ This must be a method because a model may have properties that are
+ of type self, this must run after the class is loaded
+ """
+ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
diff --git a/samples/openapi3/client/petstore/python/petstore_api/model_utils.py b/samples/openapi3/client/petstore/python/petstore_api/model_utils.py
index ae5547106703..b6d5934170a3 100644
--- a/samples/openapi3/client/petstore/python/petstore_api/model_utils.py
+++ b/samples/openapi3/client/petstore/python/petstore_api/model_utils.py
@@ -434,27 +434,43 @@ def __setitem__(self, name, value):
self.__dict__[name] = value
return
- # set the attribute on the correct instance
- model_instances = self._var_name_to_model_instances.get(
- name, self._additional_properties_model_instances)
- if model_instances:
- for model_instance in model_instances:
- if model_instance == self:
- self.set_attribute(name, value)
- else:
- setattr(model_instance, name, value)
- if name not in self._var_name_to_model_instances:
- # we assigned an additional property
- self.__dict__['_var_name_to_model_instances'][name] = (
- model_instance
- )
- return None
-
- raise ApiAttributeError(
- "{0} has no attribute '{1}'".format(
- type(self).__name__, name),
- [e for e in [self._path_to_item, name] if e]
- )
+ """
+ Use cases:
+ 1. additional_properties_type is None (additionalProperties == False in spec)
+ Check for property presence in self.openapi_types
+ if not present then throw an error
+ if present set in self, set attribute
+ always set on composed schemas
+ 2. additional_properties_type exists
+ set attribute on self
+ always set on composed schemas
+ """
+ if self.additional_properties_type is None:
+ """
+ For an attribute to exist on a composed schema it must:
+ - fulfill schema_requirements in the self composed schema not considering oneOf/anyOf/allOf schemas AND
+ - fulfill schema_requirements in each oneOf/anyOf/allOf schemas
+
+ schema_requirements:
+ For an attribute to exist on a schema it must:
+ - be present in properties at the schema OR
+ - have additionalProperties unset (defaults additionalProperties = any type) OR
+ - have additionalProperties set
+ """
+ if name not in self.openapi_types:
+ raise ApiAttributeError(
+ "{0} has no attribute '{1}'".format(
+ type(self).__name__, name),
+ [e for e in [self._path_to_item, name] if e]
+ )
+ # attribute must be set on self and composed instances
+ self.set_attribute(name, value)
+ for model_instance in self._composed_instances:
+ setattr(model_instance, name, value)
+ if name not in self._var_name_to_model_instances:
+ # we assigned an additional property
+ self.__dict__['_var_name_to_model_instances'][name] = self._composed_instances + [self]
+ return None
__unset_attribute_value__ = object()
@@ -464,13 +480,12 @@ def get(self, name, default=None):
return self.__dict__[name]
# get the attribute from the correct instance
- model_instances = self._var_name_to_model_instances.get(
- name, self._additional_properties_model_instances)
+ model_instances = self._var_name_to_model_instances.get(name)
values = []
- # A composed model stores child (oneof/anyOf/allOf) models under
- # self._var_name_to_model_instances. A named property can exist in
- # multiple child models. If the property is present in more than one
- # child model, the value must be the same across all the child models.
+ # A composed model stores self and child (oneof/anyOf/allOf) models under
+ # self._var_name_to_model_instances.
+ # Any property must exist in self and all model instances
+ # The value stored in all model instances must be the same
if model_instances:
for model_instance in model_instances:
if name in model_instance._data_store:
@@ -1573,8 +1588,13 @@ def get_allof_instances(self, model_args, constant_args):
self: the class we are handling
model_args (dict): var_name to var_value
used to make instances
- constant_args (dict): var_name to var_value
- used to make instances
+ constant_args (dict):
+ metadata arguments:
+ _check_type
+ _path_to_item
+ _spec_property_naming
+ _configuration
+ _visited_composed_classes
Returns
composed_instances (list)
@@ -1582,20 +1602,8 @@ def get_allof_instances(self, model_args, constant_args):
composed_instances = []
for allof_class in self._composed_schemas['allOf']:
- # no need to handle changing js keys to python because
- # for composed schemas, allof parameters are included in the
- # composed schema and were changed to python keys in __new__
- # extract a dict of only required keys from fixed_model_args
- kwargs = {}
- var_names = set(allof_class.openapi_types.keys())
- for var_name in var_names:
- if var_name in model_args:
- kwargs[var_name] = model_args[var_name]
-
- # and use it to make the instance
- kwargs.update(constant_args)
try:
- allof_instance = allof_class(**kwargs)
+ allof_instance = allof_class(**model_args, **constant_args)
composed_instances.append(allof_instance)
except Exception as ex:
raise ApiValueError(
@@ -1655,31 +1663,9 @@ def get_oneof_instance(cls, model_kwargs, constant_kwargs, model_arg=None):
single_value_input = allows_single_value_input(oneof_class)
- if not single_value_input:
- # transform js keys from input data to python keys in fixed_model_args
- fixed_model_args = change_keys_js_to_python(
- model_kwargs, oneof_class)
-
- # Extract a dict with the properties that are declared in the oneOf schema.
- # Undeclared properties (e.g. properties that are allowed because of the
- # additionalProperties attribute in the OAS document) are not added to
- # the dict.
- kwargs = {}
- var_names = set(oneof_class.openapi_types.keys())
- for var_name in var_names:
- if var_name in fixed_model_args:
- kwargs[var_name] = fixed_model_args[var_name]
-
- # do not try to make a model with no input args
- if len(kwargs) == 0:
- continue
-
- # and use it to make the instance
- kwargs.update(constant_kwargs)
-
try:
if not single_value_input:
- oneof_instance = oneof_class(**kwargs)
+ oneof_instance = oneof_class(**model_kwargs, **constant_kwargs)
else:
if issubclass(oneof_class, ModelSimple):
oneof_instance = oneof_class(model_arg, **constant_kwargs)
@@ -1736,24 +1722,8 @@ def get_anyof_instances(self, model_args, constant_args):
# none_type deserialization is handled in the __new__ method
continue
- # transform js keys to python keys in fixed_model_args
- fixed_model_args = change_keys_js_to_python(model_args, anyof_class)
-
- # extract a dict of only required keys from these_model_vars
- kwargs = {}
- var_names = set(anyof_class.openapi_types.keys())
- for var_name in var_names:
- if var_name in fixed_model_args:
- kwargs[var_name] = fixed_model_args[var_name]
-
- # do not try to make a model with no input args
- if len(kwargs) == 0:
- continue
-
- # and use it to make the instance
- kwargs.update(constant_args)
try:
- anyof_instance = anyof_class(**kwargs)
+ anyof_instance = anyof_class(**model_args, **constant_args)
anyof_instances.append(anyof_instance)
except Exception:
pass
@@ -1766,47 +1736,34 @@ def get_anyof_instances(self, model_args, constant_args):
return anyof_instances
-def get_additional_properties_model_instances(
- composed_instances, self):
- additional_properties_model_instances = []
- all_instances = [self]
- all_instances.extend(composed_instances)
- for instance in all_instances:
- if instance.additional_properties_type is not None:
- additional_properties_model_instances.append(instance)
- return additional_properties_model_instances
-
-
-def get_var_name_to_model_instances(self, composed_instances):
- var_name_to_model_instances = {}
- all_instances = [self]
- all_instances.extend(composed_instances)
- for instance in all_instances:
- for var_name in instance.openapi_types:
- if var_name not in var_name_to_model_instances:
- var_name_to_model_instances[var_name] = [instance]
- else:
- var_name_to_model_instances[var_name].append(instance)
- return var_name_to_model_instances
-
-
-def get_unused_args(self, composed_instances, model_args):
- unused_args = dict(model_args)
- # arguments apssed to self were already converted to python names
+def get_discarded_args(self, composed_instances, model_args):
+ """
+ Gathers the args that were discarded by configuration.discard_unknown_keys
+ """
+ model_arg_keys = model_args.keys()
+ discarded_args = set()
+ # arguments passed to self were already converted to python names
# before __init__ was called
- for var_name_py in self.attribute_map:
- if var_name_py in unused_args:
- del unused_args[var_name_py]
for instance in composed_instances:
if instance.__class__ in self._composed_schemas['allOf']:
- for var_name_py in instance.attribute_map:
- if var_name_py in unused_args:
- del unused_args[var_name_py]
+ try:
+ keys = instance.to_dict().keys()
+ discarded_keys = model_args - keys
+ discarded_args.update(discarded_keys)
+ except Exception:
+ # allOf integer schema will throw exception
+ pass
else:
- for var_name_js in instance.attribute_map.values():
- if var_name_js in unused_args:
- del unused_args[var_name_js]
- return unused_args
+ try:
+ all_keys = set(model_to_dict(instance, serialize=False).keys())
+ js_keys = model_to_dict(instance, serialize=True).keys()
+ all_keys.update(js_keys)
+ discarded_keys = model_arg_keys - all_keys
+ discarded_args.update(discarded_keys)
+ except Exception:
+ # allOf integer schema will throw exception
+ pass
+ return discarded_args
def validate_get_composed_info(constant_args, model_args, self):
@@ -1850,36 +1807,42 @@ def validate_get_composed_info(constant_args, model_args, self):
composed_instances.append(oneof_instance)
anyof_instances = get_anyof_instances(self, model_args, constant_args)
composed_instances.extend(anyof_instances)
+ """
+ set additional_properties_model_instances
+ additional properties must be evaluated at the schema level
+ so self's additional properties are most important
+ If self is a composed schema with:
+ - no properties defined in self
+ - additionalProperties: False
+ Then for object payloads every property is an additional property
+ and they are not allowed, so only empty dict is allowed
+
+ Properties must be set on all matching schemas
+ so when a property is assigned toa composed instance, it must be set on all
+ composed instances regardless of additionalProperties presence
+ keeping it to prevent breaking changes in v5.0.1
+ TODO remove cls._additional_properties_model_instances in 6.0.0
+ """
+ additional_properties_model_instances = []
+ if self.additional_properties_type is not None:
+ additional_properties_model_instances = [self]
- # map variable names to composed_instances
- var_name_to_model_instances = get_var_name_to_model_instances(
- self, composed_instances)
-
- # set additional_properties_model_instances
- additional_properties_model_instances = (
- get_additional_properties_model_instances(composed_instances, self)
- )
-
- # set any remaining values
- unused_args = get_unused_args(self, composed_instances, model_args)
- if len(unused_args) > 0 and \
- len(additional_properties_model_instances) == 0 and \
- (self._configuration is None or
- not self._configuration.discard_unknown_keys):
- raise ApiValueError(
- "Invalid input arguments input when making an instance of "
- "class %s. Not all inputs were used. The unused input data "
- "is %s" % (self.__class__.__name__, unused_args)
- )
+ """
+ no need to set properties on self in here, they will be set in __init__
+ By here all composed schema oneOf/anyOf/allOf instances have their properties set using
+ model_args
+ """
+ discarded_args = get_discarded_args(self, composed_instances, model_args)
- # no need to add additional_properties to var_name_to_model_instances here
- # because additional_properties_model_instances will direct us to that
- # instance when we use getattr or setattr
- # and we update var_name_to_model_instances in setattr
+ # map variable names to composed_instances
+ var_name_to_model_instances = {}
+ for prop_name in model_args:
+ if prop_name not in discarded_args:
+ var_name_to_model_instances[prop_name] = [self] + composed_instances
return [
composed_instances,
var_name_to_model_instances,
additional_properties_model_instances,
- unused_args
+ discarded_args
]
diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/__init__.py b/samples/openapi3/client/petstore/python/petstore_api/models/__init__.py
index 4941dc7de6e3..465f610d6d45 100644
--- a/samples/openapi3/client/petstore/python/petstore_api/models/__init__.py
+++ b/samples/openapi3/client/petstore/python/petstore_api/models/__init__.py
@@ -34,6 +34,7 @@
from petstore_api.model.client import Client
from petstore_api.model.complex_quadrilateral import ComplexQuadrilateral
from petstore_api.model.composed_one_of_number_with_validations import ComposedOneOfNumberWithValidations
+from petstore_api.model.composed_schema_with_props_and_no_add_props import ComposedSchemaWithPropsAndNoAddProps
from petstore_api.model.danish_pig import DanishPig
from petstore_api.model.dog import Dog
from petstore_api.model.dog_all_of import DogAllOf
diff --git a/samples/openapi3/client/petstore/python/pom.xml b/samples/openapi3/client/petstore/python/pom.xml
index c2364c744828..e7d7d9caf133 100644
--- a/samples/openapi3/client/petstore/python/pom.xml
+++ b/samples/openapi3/client/petstore/python/pom.xml
@@ -1,10 +1,10 @@
4.0.0
org.openapitools
- PythonExperimentalOAS3PetstoreTests
+ PythonOAS3PetstoreTests
pom
1.0-SNAPSHOT
- Python-Experimental OpenAPI3 Petstore Client
+ Python OpenAPI3 Petstore Client
diff --git a/samples/openapi3/client/petstore/python/test/test_composed_schema_with_props_and_no_add_props.py b/samples/openapi3/client/petstore/python/test/test_composed_schema_with_props_and_no_add_props.py
new file mode 100644
index 000000000000..7e7ac901ca6d
--- /dev/null
+++ b/samples/openapi3/client/petstore/python/test/test_composed_schema_with_props_and_no_add_props.py
@@ -0,0 +1,37 @@
+"""
+ 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: https://openapi-generator.tech
+"""
+
+
+import sys
+import unittest
+
+import petstore_api
+from petstore_api.model.tag import Tag
+globals()['Tag'] = Tag
+from petstore_api.model.composed_schema_with_props_and_no_add_props import ComposedSchemaWithPropsAndNoAddProps
+
+
+class TestComposedSchemaWithPropsAndNoAddProps(unittest.TestCase):
+ """ComposedSchemaWithPropsAndNoAddProps unit test stubs"""
+
+ def setUp(self):
+ pass
+
+ def tearDown(self):
+ pass
+
+ def testComposedSchemaWithPropsAndNoAddProps(self):
+ """Test ComposedSchemaWithPropsAndNoAddProps"""
+ # FIXME: construct object with mandatory attributes with example values
+ # model = ComposedSchemaWithPropsAndNoAddProps() # noqa: E501
+ pass
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/samples/openapi3/client/petstore/python/tests_manual/test_composed_schema_with_props_and_no_add_props.py b/samples/openapi3/client/petstore/python/tests_manual/test_composed_schema_with_props_and_no_add_props.py
new file mode 100644
index 000000000000..d219a4e4b8aa
--- /dev/null
+++ b/samples/openapi3/client/petstore/python/tests_manual/test_composed_schema_with_props_and_no_add_props.py
@@ -0,0 +1,45 @@
+"""
+ 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: https://openapi-generator.tech
+"""
+
+
+import sys
+import unittest
+
+import petstore_api
+from petstore_api.model.tag import Tag
+globals()['Tag'] = Tag
+from petstore_api.model.composed_schema_with_props_and_no_add_props import ComposedSchemaWithPropsAndNoAddProps
+
+
+class TestComposedSchemaWithPropsAndNoAddProps(unittest.TestCase):
+ """ComposedSchemaWithPropsAndNoAddProps unit test stubs"""
+
+ def setUp(self):
+ pass
+
+ def tearDown(self):
+ pass
+
+ def testComposedSchemaWithPropsAndNoAddProps(self):
+ """Test ComposedSchemaWithPropsAndNoAddProps"""
+
+ inst = ComposedSchemaWithPropsAndNoAddProps(color='red')
+
+ # ComposedSchemaWithPropsAndNoAddProps should only allow in the color property
+ # once https://github.com/OpenAPITools/openapi-generator/pull/8816 lands
+ # this will no longer work
+ # TODO update the test then
+ inst = ComposedSchemaWithPropsAndNoAddProps(color='red', id=1, name='foo')
+
+ with self.assertRaises(petstore_api.ApiAttributeError):
+ inst = ComposedSchemaWithPropsAndNoAddProps(color='red', id=1, name='foo', additional=5)
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/samples/openapi3/client/petstore/python/tests_manual/test_deserialization.py b/samples/openapi3/client/petstore/python/tests_manual/test_deserialization.py
index 37e0943273ad..93538160f9a8 100644
--- a/samples/openapi3/client/petstore/python/tests_manual/test_deserialization.py
+++ b/samples/openapi3/client/petstore/python/tests_manual/test_deserialization.py
@@ -118,12 +118,7 @@ def test_regex_constraint(self):
)
assert isinstance(inst, apple.Apple)
- inst = apple.Apple(
- origin="cHiLe"
- )
- assert isinstance(inst, apple.Apple)
-
- # Test with invalid regex pattern.
+ # Test with invalid regex pattern in cultivar
err_msg = ("Invalid value for `{}`, must match regular expression `{}`$")
with self.assertRaisesRegex(
petstore_api.ApiValueError,
@@ -133,12 +128,14 @@ def test_regex_constraint(self):
cultivar="!@#%@$#Akane"
)
+ # Test with invalid regex pattern in origin
err_msg = ("Invalid value for `{}`, must match regular expression `{}` with flags")
with self.assertRaisesRegex(
petstore_api.ApiValueError,
err_msg.format("origin", "[^`]*")
):
inst = apple.Apple(
+ cultivar="Akane",
origin="!@#%@$#Chile"
)
diff --git a/samples/openapi3/client/petstore/python/tests_manual/test_discard_unknown_properties.py b/samples/openapi3/client/petstore/python/tests_manual/test_discard_unknown_properties.py
index d8b71e44353e..ed1ca736d4ba 100644
--- a/samples/openapi3/client/petstore/python/tests_manual/test_discard_unknown_properties.py
+++ b/samples/openapi3/client/petstore/python/tests_manual/test_discard_unknown_properties.py
@@ -16,7 +16,7 @@
import unittest
import petstore_api
-from petstore_api.model import cat, dog, isosceles_triangle, banana_req
+from petstore_api.model import cat, dog, isosceles_triangle, banana_req, fruit_req
from petstore_api import Configuration, signing
from petstore_api.model_utils import (
@@ -54,17 +54,17 @@ def test_deserialize_banana_req_do_not_discard_unknown_properties(self):
'Exception message: {0}'.format(str(cm.exception)))
- def test_deserialize_isosceles_triangle_do_not_discard_unknown_properties(self):
+ def test_deserialize_fruit_req_do_not_discard_unknown_properties(self):
"""
- deserialize IsoscelesTriangle with unknown properties.
+ deserialize FruitReq with unknown properties.
Strict validation is enabled.
Composed schema scenario.
"""
config = Configuration(discard_unknown_keys=False)
api_client = petstore_api.ApiClient(config)
data = {
- 'shape_type': 'Triangle',
- 'triangle_type': 'EquilateralTriangle',
+ 'lengthCm': 21.3,
+ 'sweet': False,
# Below is an unknown property not explicitly declared in the OpenAPI document.
# It should not be in the payload because additional properties (undeclared) are
# not allowed in the schema (additionalProperties: false).
@@ -74,10 +74,29 @@ def test_deserialize_isosceles_triangle_do_not_discard_unknown_properties(self):
# Deserializing with strict validation raises an exception because the 'unknown_property'
# is undeclared.
- with self.assertRaises(petstore_api.ApiValueError) as cm:
- deserialized = api_client.deserialize(response, ((isosceles_triangle.IsoscelesTriangle),), True)
- self.assertTrue(re.match('.*Not all inputs were used.*unknown_property.*', str(cm.exception)),
- 'Exception message: {0}'.format(str(cm.exception)))
+ with self.assertRaisesRegex(petstore_api.ApiValueError, "Invalid inputs given to generate an instance of FruitReq. None of the oneOf schemas matched the input data."):
+ deserialized = api_client.deserialize(response, ((fruit_req.FruitReq),), True)
+
+
+ def test_deserialize_fruit_req_discard_unknown_properties(self):
+ """
+ deserialize FruitReq with unknown properties.
+ Strict validation is enabled.
+ Composed schema scenario.
+ """
+ config = Configuration(discard_unknown_keys=True)
+ api_client = petstore_api.ApiClient(config)
+ data = {
+ 'lengthCm': 21.3,
+ 'sweet': False,
+ # Below is an unknown property not explicitly declared in the OpenAPI document.
+ # It should not be in the payload because additional properties (undeclared) are
+ # not allowed in BananaReq
+ 'unknown_property': 'a-value'
+ }
+ response = MockResponse(data=json.dumps(data))
+ deserialized = api_client.deserialize(response, ((fruit_req.FruitReq),), True)
+ self.assertNotIn("unknown_property", deserialized.to_dict().keys())
def test_deserialize_banana_req_discard_unknown_properties(self):
@@ -145,13 +164,10 @@ def test_deserialize_cat_discard_unknown_properties(self):
# Below are additional (undeclared) properties.
"my_additional_property": 123,
}
- # The 'my_additional_property' is undeclared, but 'Cat' has a 'Address' type through
- # the allOf: [ $ref: '#/components/schemas/Address' ].
+ # The 'my_additional_property' is undeclared
response = MockResponse(data=json.dumps(data))
deserialized = api_client.deserialize(response, ((cat.Cat),), True)
self.assertTrue(isinstance(deserialized, cat.Cat))
- # Check the 'unknown_property' and 'more-unknown' properties are not present in the
- # output.
- self.assertIn("declawed", deserialized.to_dict().keys())
+ # Check the 'my_additional_property' is present
self.assertIn("my_additional_property", deserialized.to_dict().keys())
diff --git a/samples/openapi3/client/petstore/python/tests_manual/test_fruit.py b/samples/openapi3/client/petstore/python/tests_manual/test_fruit.py
index a60fdb9f6be3..f95c07755f85 100644
--- a/samples/openapi3/client/petstore/python/tests_manual/test_fruit.py
+++ b/samples/openapi3/client/petstore/python/tests_manual/test_fruit.py
@@ -14,56 +14,70 @@
import unittest
import petstore_api
-try:
- from petstore_api.model import apple
-except ImportError:
- apple = sys.modules[
- 'petstore_api.model.apple']
-try:
- from petstore_api.model import banana
-except ImportError:
- banana = sys.modules[
- 'petstore_api.model.banana']
+from petstore_api.model import apple
+from petstore_api.model import banana
from petstore_api.model.fruit import Fruit
class TestFruit(unittest.TestCase):
"""Fruit unit test stubs"""
+ length_cm = 20.3
+ color = 'yellow'
+
+
def setUp(self):
pass
def tearDown(self):
pass
- def testFruit(self):
- """Test Fruit"""
+ def test_fruit_with_additional_props(self):
+ # including extra parameters works because the oneOf models include additionalProperties
+ some_value = 'some_value'
+ some_fruit = Fruit(
+ color=self.color,
+ length_cm=self.length_cm,
+ unknown_property=some_value
+ )
+ assert some_fruit['unknown_property'] == some_value
+
+ def test_fruit_assigning_additional_props_in_client(self):
+ # setting a value that doesn't exist works because additional_properties_type allows any type
+ other_fruit = Fruit(length_cm=self.length_cm, color=self.color)
+ blah = 'blah'
+ other_fruit['a'] = blah
+ assert other_fruit.a == blah
+
+ # with setattr
+ setattr(other_fruit, 'b', blah)
+ assert other_fruit.b == blah
- # make an instance of Fruit, a composed schema oneOf model
- # banana test
- length_cm = 20.3
- color = 'yellow'
- fruit = Fruit(length_cm=length_cm, color=color)
- # check its properties
- self.assertEqual(fruit.length_cm, length_cm)
- self.assertEqual(fruit['length_cm'], length_cm)
- self.assertEqual(fruit.get('length_cm'), length_cm)
- self.assertEqual(getattr(fruit, 'length_cm'), length_cm)
- self.assertEqual(fruit.color, color)
- self.assertEqual(fruit['color'], color)
- self.assertEqual(getattr(fruit, 'color'), color)
- # check the dict representation
self.assertEqual(
- fruit.to_dict(),
+ other_fruit.to_dict(),
{
- 'length_cm': length_cm,
- 'color': color
+ 'a': 'blah',
+ 'b': 'blah',
+ 'length_cm': self.length_cm,
+ 'color': self.color
}
)
- # setting a value that doesn't exist raises an exception
+
+ def test_fruit_access_errors(self):
+ fruit = Fruit(length_cm=self.length_cm, color=self.color)
+
+ # getting a value that doesn't exist raises an exception
# with a key
with self.assertRaises(AttributeError):
- fruit['invalid_variable'] = 'some value'
+ invalid_variable = fruit['cultivar']
+
+ # Per Python doc, if the named attribute does not exist,
+ # default is returned if provided, otherwise AttributeError is raised.
+ with self.assertRaises(AttributeError):
+ getattr(fruit, 'cultivar')
+
+ def test_fruit_attribute_access(self):
+ fruit = Fruit(length_cm=self.length_cm, color=self.color)
# Assert that we can call the builtin hasattr() function.
# hasattr should return False for non-existent attribute.
@@ -74,14 +88,6 @@ def testFruit(self):
# hasattr should return True for existent attribute.
self.assertTrue(hasattr(fruit, 'color'))
- # with setattr
- with self.assertRaises(AttributeError):
- setattr(fruit, 'invalid_variable', 'some value')
-
- # getting a value that doesn't exist raises an exception
- # with a key
- with self.assertRaises(AttributeError):
- invalid_variable = fruit['cultivar']
# with getattr
# Per Python doc, if the named attribute does not exist,
# default is returned if provided.
@@ -89,10 +95,28 @@ def testFruit(self):
self.assertEqual(fruit.get('cultivar'), None)
self.assertEqual(fruit.get('cultivar', 'some value'), 'some value')
- # Per Python doc, if the named attribute does not exist,
- # default is returned if provided, otherwise AttributeError is raised.
- with self.assertRaises(AttributeError):
- getattr(fruit, 'cultivar')
+ def test_banana_fruit(self):
+ """Test Fruit"""
+
+ # make an instance of Fruit, a composed schema oneOf model
+ # banana test
+ fruit = Fruit(length_cm=self.length_cm, color=self.color)
+ # check its properties
+ self.assertEqual(fruit.length_cm, self.length_cm)
+ self.assertEqual(fruit['length_cm'], self.length_cm)
+ self.assertEqual(fruit.get('length_cm'), self.length_cm)
+ self.assertEqual(getattr(fruit, 'length_cm'), self.length_cm)
+ self.assertEqual(fruit.color, self.color)
+ self.assertEqual(fruit['color'], self.color)
+ self.assertEqual(getattr(fruit, 'color'), self.color)
+ # check the dict representation
+ self.assertEqual(
+ fruit.to_dict(),
+ {
+ 'length_cm': self.length_cm,
+ 'color': self.color
+ }
+ )
# make sure that the ModelComposed class properties are correct
# model._composed_schemas stores the anyOf/allOf/oneOf info
@@ -109,6 +133,7 @@ def testFruit(self):
)
# model._composed_instances is a list of the instances that were
# made from the anyOf/allOf/OneOf classes in model._composed_schemas
+ self.assertEqual(len(fruit._composed_instances), 1)
for composed_instance in fruit._composed_instances:
if composed_instance.__class__ == banana.Banana:
banana_instance = composed_instance
@@ -118,19 +143,16 @@ def testFruit(self):
)
# model._var_name_to_model_instances maps the variable name to the
# model instances which store that variable
+ print(fruit._var_name_to_model_instances)
self.assertEqual(
fruit._var_name_to_model_instances,
{
- 'color': [fruit],
+ 'color': [fruit, banana_instance],
'length_cm': [fruit, banana_instance],
- 'cultivar': [fruit],
- 'origin': [fruit],
}
)
- # model._additional_properties_model_instances stores a list of
- # models which have the property additional_properties_type != None
self.assertEqual(
- fruit._additional_properties_model_instances, []
+ fruit._additional_properties_model_instances, [fruit]
)
# if we modify one of the properties owned by multiple
@@ -140,21 +162,15 @@ def testFruit(self):
with self.assertRaises(petstore_api.ApiValueError):
some_length_cm = fruit.length_cm
- # including extra parameters raises an exception
- with self.assertRaises(petstore_api.ApiValueError):
- fruit = Fruit(
- color=color,
- length_cm=length_cm,
- unknown_property='some value'
- )
-
# including input parameters for two oneOf instances raise an exception
with self.assertRaises(petstore_api.ApiValueError):
fruit = Fruit(
- length_cm=length_cm,
+ length_cm=self.length_cm,
cultivar='granny smith'
)
+ def test_apple_fruit(self):
+
# make an instance of Fruit, a composed schema oneOf model
# apple test
color = 'red'
@@ -190,19 +206,15 @@ def testFruit(self):
self.assertEqual(
fruit._var_name_to_model_instances,
{
- 'color': [fruit],
- 'length_cm': [fruit],
+ 'color': [fruit, apple_instance],
'cultivar': [fruit, apple_instance],
- 'origin': [fruit, apple_instance],
}
)
- # model._additional_properties_model_instances stores a list of
- # models which have the property additional_properties_type != None
self.assertEqual(
- fruit._additional_properties_model_instances, []
+ fruit._additional_properties_model_instances, [fruit]
)
- def testFruitNullValue(self):
+ def test_null_fruit(self):
# Since 'apple' is nullable, validate we can create an apple with the 'null' value.
fruit = apple.Apple(None)
self.assertIsNone(fruit)
@@ -220,5 +232,16 @@ def testFruitNullValue(self):
fruit = Fruit(apple.Apple(None))
self.assertIsNone(fruit)
+ def test_fruit_with_invalid_input_type(self):
+
+ """
+ color must be a str, color's str type is only defined at the Fruit level
+ Banana + Apple would allow color to be assigned with any type of value
+ """
+ invalid_value = 1
+ with self.assertRaises(petstore_api.ApiTypeError):
+ fruit = Fruit(color=invalid_value, length_cm=self.length_cm)
+
+
if __name__ == '__main__':
unittest.main()
diff --git a/samples/openapi3/client/petstore/python/tests_manual/test_fruit_req.py b/samples/openapi3/client/petstore/python/tests_manual/test_fruit_req.py
index 3e637c3226a0..64b710fdd583 100644
--- a/samples/openapi3/client/petstore/python/tests_manual/test_fruit_req.py
+++ b/samples/openapi3/client/petstore/python/tests_manual/test_fruit_req.py
@@ -14,21 +14,14 @@
import unittest
import petstore_api
-try:
- from petstore_api.model import apple_req
-except ImportError:
- apple_req = sys.modules[
- 'petstore_api.model.apple_req']
-try:
- from petstore_api.model import banana_req
-except ImportError:
- banana_req = sys.modules[
- 'petstore_api.model.banana_req']
+from petstore_api.model import apple_req
+from petstore_api.model import banana_req
from petstore_api.model.fruit_req import FruitReq
class TestFruitReq(unittest.TestCase):
"""FruitReq unit test stubs"""
+ length_cm = 20.3
def setUp(self):
pass
@@ -36,24 +29,9 @@ def setUp(self):
def tearDown(self):
pass
- def testFruitReq(self):
- """Test FruitReq"""
+ def test_fruit_access_errors(self):
+ fruit = FruitReq(length_cm=self.length_cm)
- # make an instance of Fruit, a composed schema oneOf model
- # banana test
- length_cm = 20.3
- fruit = FruitReq(length_cm=length_cm)
- # check its properties
- self.assertEqual(fruit.length_cm, length_cm)
- self.assertEqual(fruit['length_cm'], length_cm)
- self.assertEqual(getattr(fruit, 'length_cm'), length_cm)
- # check the dict representation
- self.assertEqual(
- fruit.to_dict(),
- {
- 'length_cm': length_cm,
- }
- )
# setting a value that doesn't exist raises an exception
# with a key
with self.assertRaises(AttributeError):
@@ -66,12 +44,31 @@ def testFruitReq(self):
# with a key
with self.assertRaises(AttributeError):
invalid_variable = fruit['cultivar']
- # with getattr
- self.assertEqual(getattr(fruit, 'cultivar', 'some value'), 'some value')
with self.assertRaises(AttributeError):
getattr(fruit, 'cultivar')
+ def test_FruitReq_banana(self):
+ """Test FruitReq"""
+
+ # make an instance of Fruit, a composed schema oneOf model
+ # banana test
+ fruit = FruitReq(length_cm=self.length_cm)
+ # check its properties
+ self.assertEqual(fruit.length_cm, self.length_cm)
+ self.assertEqual(fruit['length_cm'], self.length_cm)
+ self.assertEqual(getattr(fruit, 'length_cm'), self.length_cm)
+ # check the dict representation
+ self.assertEqual(
+ fruit.to_dict(),
+ {
+ 'length_cm': self.length_cm,
+ }
+ )
+
+ # with getattr
+ self.assertEqual(getattr(fruit, 'cultivar', 'some value'), 'some value')
+
# make sure that the ModelComposed class properties are correct
# model._composed_schemas stores the anyOf/allOf/oneOf info
self.assertEqual(
@@ -101,15 +98,10 @@ def testFruitReq(self):
fruit._var_name_to_model_instances,
{
'length_cm': [fruit, banana_instance],
- 'cultivar': [fruit],
- 'mealy': [fruit],
- 'sweet': [fruit, banana_instance],
}
)
- # model._additional_properties_model_instances stores a list of
- # models which have the property additional_properties_type != None
self.assertEqual(
- fruit._additional_properties_model_instances, []
+ fruit._additional_properties_model_instances, [fruit]
)
# if we modify one of the properties owned by multiple
@@ -119,21 +111,24 @@ def testFruitReq(self):
with self.assertRaises(petstore_api.ApiValueError):
some_length_cm = fruit.length_cm
+ def test_invalid_inputs(self):
# including extra parameters raises an exception
with self.assertRaises(petstore_api.ApiValueError):
fruit = FruitReq(
- length_cm=length_cm,
+ length_cm=self.length_cm,
unknown_property='some value'
)
# including input parameters for two oneOf instances raise an exception
with self.assertRaises(petstore_api.ApiValueError):
fruit = FruitReq(
- length_cm=length_cm,
+ length_cm=self.length_cm,
cultivar='granny smith'
)
- # make an instance of Fruit, a composed schema oneOf model
+ def test_FruitReq_apple(self):
+ """Test FruitReq"""
+
# apple test
cultivar = 'golden delicious'
fruit = FruitReq(cultivar=cultivar)
@@ -163,21 +158,18 @@ def testFruitReq(self):
self.assertEqual(
fruit._var_name_to_model_instances,
{
- 'length_cm': [fruit],
'cultivar': [fruit, apple_instance],
- 'mealy': [fruit, apple_instance],
- 'sweet': [fruit],
}
)
- # model._additional_properties_model_instances stores a list of
- # models which have the property additional_properties_type != None
self.assertEqual(
- fruit._additional_properties_model_instances, []
+ fruit._additional_properties_model_instances, [fruit]
)
+ def test_null_fruit(self):
# we can pass in None
fruit = FruitReq(None)
assert fruit is None
+
if __name__ == '__main__':
unittest.main()
diff --git a/samples/openapi3/client/petstore/python/tests_manual/test_gm_fruit.py b/samples/openapi3/client/petstore/python/tests_manual/test_gm_fruit.py
index 85d0fcf9b1c7..ad5907ee4436 100644
--- a/samples/openapi3/client/petstore/python/tests_manual/test_gm_fruit.py
+++ b/samples/openapi3/client/petstore/python/tests_manual/test_gm_fruit.py
@@ -14,21 +14,15 @@
import unittest
import petstore_api
-try:
- from petstore_api.model import apple
-except ImportError:
- apple = sys.modules[
- 'petstore_api.model.apple']
-try:
- from petstore_api.model import banana
-except ImportError:
- banana = sys.modules[
- 'petstore_api.model.banana']
+from petstore_api.model import apple
+from petstore_api.model import banana
from petstore_api.model.gm_fruit import GmFruit
class TestGmFruit(unittest.TestCase):
"""GmFruit unit test stubs"""
+ length_cm = 20.3
+ color = 'yellow'
def setUp(self):
pass
@@ -36,36 +30,48 @@ def setUp(self):
def tearDown(self):
pass
- def testGmFruit(self):
+ def test_set_addprop_attributes(self):
+ # setting a value that doesn't exist works because additional_properties_type allows any type
+ other_fruit = GmFruit(length_cm=self.length_cm, color=self.color)
+ blah = 'blah'
+ other_fruit['a'] = blah
+ assert other_fruit.a == blah
+
+ # with setattr
+ setattr(other_fruit, 'b', blah)
+ assert other_fruit.b == blah
+
+ self.assertEqual(
+ other_fruit.to_dict(),
+ {
+ 'a': 'blah',
+ 'b': 'blah',
+ 'length_cm': self.length_cm,
+ 'color': self.color
+ }
+ )
+
+ def test_banana_fruit(self):
"""Test GmFruit"""
# make an instance of GmFruit, a composed schema anyOf model
# banana test
- length_cm = 20.3
- color = 'yellow'
- fruit = GmFruit(length_cm=length_cm, color=color)
+ fruit = GmFruit(length_cm=self.length_cm, color=self.color)
# check its properties
- self.assertEqual(fruit.length_cm, length_cm)
- self.assertEqual(fruit['length_cm'], length_cm)
- self.assertEqual(getattr(fruit, 'length_cm'), length_cm)
- self.assertEqual(fruit.color, color)
- self.assertEqual(fruit['color'], color)
- self.assertEqual(getattr(fruit, 'color'), color)
+ self.assertEqual(fruit.length_cm, self.length_cm)
+ self.assertEqual(fruit['length_cm'], self.length_cm)
+ self.assertEqual(getattr(fruit, 'length_cm'), self.length_cm)
+ self.assertEqual(fruit.color, self.color)
+ self.assertEqual(fruit['color'], self.color)
+ self.assertEqual(getattr(fruit, 'color'), self.color)
# check the dict representation
self.assertEqual(
fruit.to_dict(),
{
- 'length_cm': length_cm,
- 'color': color
+ 'length_cm': self.length_cm,
+ 'color': self.color
}
)
- # setting a value that doesn't exist raises an exception
- # with a key
- with self.assertRaises(AttributeError):
- fruit['invalid_variable'] = 'some value'
- # with setattr
- with self.assertRaises(AttributeError):
- setattr(fruit, 'invalid_variable', 'some value')
# getting a value that doesn't exist raises an exception
# with a key
@@ -104,40 +110,22 @@ def testGmFruit(self):
self.assertEqual(
fruit._var_name_to_model_instances,
{
- 'color': [fruit],
+ 'color': [fruit, banana_instance],
'length_cm': [fruit, banana_instance],
- 'cultivar': [fruit],
- 'origin': [fruit],
}
)
- # model._additional_properties_model_instances stores a list of
- # models which have the property additional_properties_type != None
self.assertEqual(
- fruit._additional_properties_model_instances, []
+ fruit._additional_properties_model_instances, [fruit]
)
- # if we modify one of the properties owned by multiple
- # model_instances we get an exception when we try to access that
- # property because the retrieved values are not all the same
- banana_instance.length_cm = 4.56
- with self.assertRaises(petstore_api.ApiValueError):
- some_length_cm = fruit.length_cm
-
- # including extra parameters raises an exception
- with self.assertRaises(petstore_api.ApiValueError):
- fruit = GmFruit(
- color=color,
- length_cm=length_cm,
- unknown_property='some value'
- )
-
+ def test_combo_fruit(self):
# including input parameters for both anyOf instances works
cultivar = 'banaple'
color = 'orange'
fruit = GmFruit(
color=color,
cultivar=cultivar,
- length_cm=length_cm
+ length_cm=self.length_cm
)
self.assertEqual(fruit.color, color)
self.assertEqual(fruit['color'], color)
@@ -145,9 +133,9 @@ def testGmFruit(self):
self.assertEqual(fruit.cultivar, cultivar)
self.assertEqual(fruit['cultivar'], cultivar)
self.assertEqual(getattr(fruit, 'cultivar'), cultivar)
- self.assertEqual(fruit.length_cm, length_cm)
- self.assertEqual(fruit['length_cm'], length_cm)
- self.assertEqual(getattr(fruit, 'length_cm'), length_cm)
+ self.assertEqual(fruit.length_cm, self.length_cm)
+ self.assertEqual(fruit['length_cm'], self.length_cm)
+ self.assertEqual(getattr(fruit, 'length_cm'), self.length_cm)
# model._composed_instances is a list of the instances that were
# made from the anyOf/allOf/OneOf classes in model._composed_schemas
@@ -165,14 +153,16 @@ def testGmFruit(self):
self.assertEqual(
fruit._var_name_to_model_instances,
{
- 'color': [fruit],
- 'length_cm': [fruit, banana_instance],
- 'cultivar': [fruit, apple_instance],
- 'origin': [fruit, apple_instance],
+ 'color': [fruit, apple_instance, banana_instance],
+ 'length_cm': [fruit, apple_instance, banana_instance],
+ 'cultivar': [fruit, apple_instance, banana_instance],
}
)
+ self.assertEqual(
+ fruit._additional_properties_model_instances, [fruit]
+ )
- # make an instance of GmFruit, a composed schema anyOf model
+ def test_apple_fruit(self):
# apple test
color = 'red'
cultivar = 'golden delicious'
@@ -214,16 +204,13 @@ def testGmFruit(self):
self.assertEqual(
fruit._var_name_to_model_instances,
{
- 'color': [fruit],
- 'length_cm': [fruit],
+ 'color': [fruit, apple_instance],
'cultivar': [fruit, apple_instance],
'origin': [fruit, apple_instance],
}
)
- # model._additional_properties_model_instances stores a list of
- # models which have the property additional_properties_type != None
self.assertEqual(
- fruit._additional_properties_model_instances, []
+ fruit._additional_properties_model_instances, [fruit]
)
if __name__ == '__main__':
diff --git a/samples/openapi3/client/petstore/python/tests_manual/test_tag.py b/samples/openapi3/client/petstore/python/tests_manual/test_tag.py
new file mode 100644
index 000000000000..ec945f6b30b8
--- /dev/null
+++ b/samples/openapi3/client/petstore/python/tests_manual/test_tag.py
@@ -0,0 +1,35 @@
+# 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: https://openapi-generator.tech
+"""
+
+
+import sys
+import unittest
+
+import petstore_api
+from petstore_api.model.tag import Tag
+
+
+class TestTag(unittest.TestCase):
+ """Tag unit test stubs"""
+
+ def setUp(self):
+ pass
+
+ def tearDown(self):
+ pass
+
+ def test_can_ingest_additional_properties_in_tag(self):
+ t = Tag(a='abc')
+ assert t.a == 'abc'
+
+
+if __name__ == '__main__':
+ unittest.main()