From a6bcef5b16353ee154a678eec333bf6b6d251d24 Mon Sep 17 00:00:00 2001
From: Akhil Nair <36164259+the-akhil-nair@users.noreply.github.com>
Date: Wed, 30 Mar 2022 21:22:00 +0530
Subject: [PATCH] [PYTHON] Setting default value for Required variables
(#10809)
* [req_vars_changes]
* Added new schema to generate samples to test the issue mentioned in the PR.
* Changed the variable name from setRequiredVars to initRequiredVars
* Added initRequiredVars as a generator additional property
* Regenerating the samples after rebasing the code with master branch
* Changed the description of additional property
---
bin/configs/python.yaml | 1 +
docs/generators/python.md | 1 +
.../codegen/CodegenConstants.java | 2 +
.../languages/PythonClientCodegen.java | 8 +
...method_from_openapi_data_composed.mustache | 13 +
.../method_init_composed.mustache | 13 +
.../options/PythonClientOptionsProvider.java | 2 +
...ith-fake-endpoints-models-for-testing.yaml | 60 ++++
.../petstore/python/.openapi-generator/FILES | 14 +
samples/client/petstore/python/README.md | 7 +
.../client/petstore/python/docs/Polygon.md | 14 +
.../petstore/python/docs/PolygonAllOf.md | 14 +
samples/client/petstore/python/docs/Shape.md | 13 +
samples/client/petstore/python/docs/Square.md | 14 +
.../petstore/python/docs/SquareAllOf.md | 14 +
.../client/petstore/python/docs/Triangle.md | 14 +
.../petstore/python/docs/TriangleAllOf.md | 14 +
.../python/petstore_api/model/polygon.py | 334 +++++++++++++++++
.../petstore_api/model/polygon_all_of.py | 281 +++++++++++++++
.../python/petstore_api/model/shape.py | 277 +++++++++++++++
.../python/petstore_api/model/square.py | 335 ++++++++++++++++++
.../petstore_api/model/square_all_of.py | 274 ++++++++++++++
.../python/petstore_api/model/triangle.py | 335 ++++++++++++++++++
.../petstore_api/model/triangle_all_of.py | 274 ++++++++++++++
.../python/petstore_api/models/__init__.py | 7 +
.../petstore/python/test/test_polygon.py | 39 ++
.../python/test/test_polygon_all_of.py | 35 ++
.../client/petstore/python/test/test_shape.py | 35 ++
.../petstore/python/test/test_square.py | 39 ++
.../python/test/test_square_all_of.py | 35 ++
.../petstore/python/test/test_triangle.py | 39 ++
.../python/test/test_triangle_all_of.py | 35 ++
.../.openapi-generator/FILES | 14 +
.../README.md | 7 +
.../docs/Polygon.md | 13 +
.../docs/PolygonAllOf.md | 13 +
.../docs/Shape.md | 12 +
.../docs/Square.md | 13 +
.../docs/SquareAllOf.md | 13 +
.../docs/Triangle.md | 13 +
.../docs/TriangleAllOf.md | 13 +
.../petstore_api/model/polygon.py | 327 +++++++++++++++++
.../petstore_api/model/polygon_all_of.py | 275 ++++++++++++++
.../petstore_api/model/shape.py | 271 ++++++++++++++
.../petstore_api/model/square.py | 328 +++++++++++++++++
.../petstore_api/model/square_all_of.py | 268 ++++++++++++++
.../petstore_api/model/triangle.py | 328 +++++++++++++++++
.../petstore_api/model/triangle_all_of.py | 268 ++++++++++++++
.../petstore_api/models/__init__.py | 7 +
.../test/test_polygon.py | 39 ++
.../test/test_polygon_all_of.py | 35 ++
.../test/test_shape.py | 35 ++
.../test/test_square.py | 39 ++
.../test/test_square_all_of.py | 35 ++
.../test/test_triangle.py | 39 ++
.../test/test_triangle_all_of.py | 35 ++
56 files changed, 5032 insertions(+)
create mode 100644 samples/client/petstore/python/docs/Polygon.md
create mode 100644 samples/client/petstore/python/docs/PolygonAllOf.md
create mode 100644 samples/client/petstore/python/docs/Shape.md
create mode 100644 samples/client/petstore/python/docs/Square.md
create mode 100644 samples/client/petstore/python/docs/SquareAllOf.md
create mode 100644 samples/client/petstore/python/docs/Triangle.md
create mode 100644 samples/client/petstore/python/docs/TriangleAllOf.md
create mode 100644 samples/client/petstore/python/petstore_api/model/polygon.py
create mode 100644 samples/client/petstore/python/petstore_api/model/polygon_all_of.py
create mode 100644 samples/client/petstore/python/petstore_api/model/shape.py
create mode 100644 samples/client/petstore/python/petstore_api/model/square.py
create mode 100644 samples/client/petstore/python/petstore_api/model/square_all_of.py
create mode 100644 samples/client/petstore/python/petstore_api/model/triangle.py
create mode 100644 samples/client/petstore/python/petstore_api/model/triangle_all_of.py
create mode 100644 samples/client/petstore/python/test/test_polygon.py
create mode 100644 samples/client/petstore/python/test/test_polygon_all_of.py
create mode 100644 samples/client/petstore/python/test/test_shape.py
create mode 100644 samples/client/petstore/python/test/test_square.py
create mode 100644 samples/client/petstore/python/test/test_square_all_of.py
create mode 100644 samples/client/petstore/python/test/test_triangle.py
create mode 100644 samples/client/petstore/python/test/test_triangle_all_of.py
create mode 100644 samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/Polygon.md
create mode 100644 samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/PolygonAllOf.md
create mode 100644 samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/Shape.md
create mode 100644 samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/Square.md
create mode 100644 samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/SquareAllOf.md
create mode 100644 samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/Triangle.md
create mode 100644 samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/TriangleAllOf.md
create mode 100644 samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/polygon.py
create mode 100644 samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/polygon_all_of.py
create mode 100644 samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/shape.py
create mode 100644 samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/square.py
create mode 100644 samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/square_all_of.py
create mode 100644 samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/triangle.py
create mode 100644 samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/triangle_all_of.py
create mode 100644 samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_polygon.py
create mode 100644 samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_polygon_all_of.py
create mode 100644 samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_shape.py
create mode 100644 samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_square.py
create mode 100644 samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_square_all_of.py
create mode 100644 samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_triangle.py
create mode 100644 samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_triangle_all_of.py
diff --git a/bin/configs/python.yaml b/bin/configs/python.yaml
index 37d0948cc68..f66aab26993 100644
--- a/bin/configs/python.yaml
+++ b/bin/configs/python.yaml
@@ -5,3 +5,4 @@ templateDir: modules/openapi-generator/src/main/resources/python
additionalProperties:
packageName: petstore_api
recursionLimit: "1234"
+ initRequiredVars: false
diff --git a/docs/generators/python.md b/docs/generators/python.md
index 1910f46d544..9b7e75b39de 100644
--- a/docs/generators/python.md
+++ b/docs/generators/python.md
@@ -22,6 +22,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|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|
+|initRequiredVars|If set to true then the required variables are included as positional arguments in __init__ and _from_openapi_data methods. Note: this can break some composition use cases. To learn more read PR #8802.| |false|
|library|library template (sub-template) to use: asyncio, tornado, urllib3| |urllib3|
|packageName|python package name (convention: snake_case).| |openapi_client|
|packageUrl|python package URL.| |null|
diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenConstants.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenConstants.java
index d0906a4caf0..2c0fe6b1b26 100644
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenConstants.java
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenConstants.java
@@ -396,4 +396,6 @@ public class CodegenConstants {
public static final String USE_ONEOF_DISCRIMINATOR_LOOKUP = "useOneOfDiscriminatorLookup";
public static final String USE_ONEOF_DISCRIMINATOR_LOOKUP_DESC = "Use the discriminator's mapping in oneOf to speed up the model lookup. IMPORTANT: Validation (e.g. one and only one match in oneOf's schemas) will be skipped.";
+ public static final String INIT_REQUIRED_VARS = "initRequiredVars";
+ public static final String INIT_REQUIRED_VARS_DESC = "If set to true then the required variables are included as positional arguments in __init__ and _from_openapi_data methods. Note: this can break some composition use cases. To learn more read PR #8802.";
}
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 515e6c6891c..80ebe46c272 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
@@ -110,6 +110,9 @@ public class PythonClientCodegen extends PythonLegacyClientCodegen {
cliOptions.add(new CliOption(CodegenConstants.PYTHON_ATTR_NONE_IF_UNSET, CodegenConstants.PYTHON_ATTR_NONE_IF_UNSET_DESC)
.defaultValue(Boolean.FALSE.toString()));
+ cliOptions.add(new CliOption(CodegenConstants.INIT_REQUIRED_VARS, CodegenConstants.INIT_REQUIRED_VARS_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,
@@ -186,6 +189,11 @@ public class PythonClientCodegen extends PythonLegacyClientCodegen {
}
this.setDisallowAdditionalPropertiesIfNotPresent(disallowAddProps);
+ Boolean initRequiredVars = false;
+ if (additionalProperties.containsKey(CodegenConstants.INIT_REQUIRED_VARS)) {
+ initRequiredVars = Boolean.valueOf(additionalProperties.get(CodegenConstants.INIT_REQUIRED_VARS).toString());
+ }
+ additionalProperties.put("initRequiredVars", initRequiredVars);
// check library option to ensure only urllib3 is supported
if (!DEFAULT_LIBRARY.equals(getLibrary())) {
diff --git a/modules/openapi-generator/src/main/resources/python/model_templates/method_from_openapi_data_composed.mustache b/modules/openapi-generator/src/main/resources/python/model_templates/method_from_openapi_data_composed.mustache
index ba03dbc63f3..3b6993094bd 100644
--- a/modules/openapi-generator/src/main/resources/python/model_templates/method_from_openapi_data_composed.mustache
+++ b/modules/openapi-generator/src/main/resources/python/model_templates/method_from_openapi_data_composed.mustache
@@ -1,6 +1,11 @@
@classmethod
@convert_js_args_to_python_args
+ {{#initRequiredVars}}
+ def _from_openapi_data(cls{{#requiredVars}}{{^defaultValue}}, {{name}}{{/defaultValue}}{{/requiredVars}}, *args, **kwargs): # noqa: E501
+ {{/initRequiredVars}}
+ {{^initRequiredVars}}
def _from_openapi_data(cls, *args, **kwargs): # noqa: E501
+ {{/initRequiredVars}}
"""{{classname}} - a model defined in OpenAPI
Keyword Args:
@@ -47,6 +52,14 @@
'_configuration': _configuration,
'_visited_composed_classes': self._visited_composed_classes,
}
+ {{#initRequiredVars}}
+ required_args = {
+{{#requiredVars}}
+ '{{name}}': {{name}},
+{{/requiredVars}}
+ }
+ kwargs.update(required_args)
+ {{/initRequiredVars}}
composed_info = validate_get_composed_info(
constant_args, kwargs, self)
self._composed_instances = composed_info[0]
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 ba7991e4d07..b0d4c5c7bd5 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
@@ -11,7 +11,12 @@
])
@convert_js_args_to_python_args
+ {{#initRequiredVars}}
+ def __init__(self{{#requiredVars}}{{^defaultValue}}, {{name}}{{/defaultValue}}{{/requiredVars}}, *args, **kwargs): # noqa: E501
+ {{/initRequiredVars}}
+ {{^initRequiredVars}}
def __init__(self, *args, **kwargs): # noqa: E501
+ {{/initRequiredVars}}
"""{{classname}} - a model defined in OpenAPI
Keyword Args:
@@ -60,6 +65,14 @@
'_configuration': _configuration,
'_visited_composed_classes': self._visited_composed_classes,
}
+ {{#initRequiredVars}}
+ required_args = {
+{{#requiredVars}}
+ '{{name}}': {{name}},
+{{/requiredVars}}
+ }
+ kwargs.update(required_args)
+ {{/initRequiredVars}}
composed_info = validate_get_composed_info(
constant_args, kwargs, self)
self._composed_instances = composed_info[0]
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 fc7d74074dd..dd11b886a9a 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
@@ -32,6 +32,7 @@ public class PythonClientOptionsProvider implements OptionsProvider {
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";
+ public static final String INIT_REQUIRED_VARS = "false";
@Override
public String getLanguage() {
@@ -52,6 +53,7 @@ public class PythonClientOptionsProvider implements OptionsProvider {
.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)
+ .put(CodegenConstants.INIT_REQUIRED_VARS, INIT_REQUIRED_VARS)
.build();
}
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 097ae6768bb..0fd88cfd5ae 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
@@ -2122,3 +2122,63 @@ definitions:
properties:
lovesRocks:
type: boolean
+ Triangle:
+ allOf:
+ - $ref: '#/definitions/Polygon'
+ - type: object
+ properties:
+ type:
+ enum:
+ - 'Triangle'
+ x-enum-as-string: true
+ default: 'Triangle'
+ type: string
+ sides:
+ type: integer
+ area:
+ type: string
+ Square:
+ allOf:
+ - $ref: '#/definitions/Polygon'
+ - type: object
+ properties:
+ type:
+ enum:
+ - 'Square'
+ x-enum-as-string: true
+ default: 'Square'
+ type: string
+ sides:
+ type: integer
+ area:
+ type: string
+ Polygon:
+ allOf:
+ - $ref: '#/definitions/Shape'
+ - type: object
+ required:
+ - type
+ properties:
+ type:
+ enum:
+ - 'Triangle'
+ - 'Square'
+ x-enum-as-string: true
+ type: string
+ sides:
+ type: integer
+ area:
+ type: string
+ Shape:
+ type: object
+ required:
+ - type
+ properties:
+ type:
+ enum:
+ - 'Triangle'
+ - 'Square'
+ x-enum-as-string: true
+ type: string
+ area:
+ type: string
\ No newline at end of file
diff --git a/samples/client/petstore/python/.openapi-generator/FILES b/samples/client/petstore/python/.openapi-generator/FILES
index 417028fbd1f..9ea15953368 100644
--- a/samples/client/petstore/python/.openapi-generator/FILES
+++ b/samples/client/petstore/python/.openapi-generator/FILES
@@ -60,12 +60,19 @@ docs/ParentPet.md
docs/Pet.md
docs/PetApi.md
docs/Player.md
+docs/Polygon.md
+docs/PolygonAllOf.md
docs/ReadOnlyFirst.md
+docs/Shape.md
docs/SpecialModelName.md
+docs/Square.md
+docs/SquareAllOf.md
docs/StoreApi.md
docs/StringBooleanMap.md
docs/StringEnum.md
docs/Tag.md
+docs/Triangle.md
+docs/TriangleAllOf.md
docs/TypeHolderDefault.md
docs/TypeHolderExample.md
docs/User.md
@@ -139,11 +146,18 @@ 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/polygon.py
+petstore_api/model/polygon_all_of.py
petstore_api/model/read_only_first.py
+petstore_api/model/shape.py
petstore_api/model/special_model_name.py
+petstore_api/model/square.py
+petstore_api/model/square_all_of.py
petstore_api/model/string_boolean_map.py
petstore_api/model/string_enum.py
petstore_api/model/tag.py
+petstore_api/model/triangle.py
+petstore_api/model/triangle_all_of.py
petstore_api/model/type_holder_default.py
petstore_api/model/type_holder_example.py
petstore_api/model/user.py
diff --git a/samples/client/petstore/python/README.md b/samples/client/petstore/python/README.md
index 8e57b995b3e..4b34d32b616 100644
--- a/samples/client/petstore/python/README.md
+++ b/samples/client/petstore/python/README.md
@@ -178,11 +178,18 @@ Class | Method | HTTP request | Description
- [ParentPet](docs/ParentPet.md)
- [Pet](docs/Pet.md)
- [Player](docs/Player.md)
+ - [Polygon](docs/Polygon.md)
+ - [PolygonAllOf](docs/PolygonAllOf.md)
- [ReadOnlyFirst](docs/ReadOnlyFirst.md)
+ - [Shape](docs/Shape.md)
- [SpecialModelName](docs/SpecialModelName.md)
+ - [Square](docs/Square.md)
+ - [SquareAllOf](docs/SquareAllOf.md)
- [StringBooleanMap](docs/StringBooleanMap.md)
- [StringEnum](docs/StringEnum.md)
- [Tag](docs/Tag.md)
+ - [Triangle](docs/Triangle.md)
+ - [TriangleAllOf](docs/TriangleAllOf.md)
- [TypeHolderDefault](docs/TypeHolderDefault.md)
- [TypeHolderExample](docs/TypeHolderExample.md)
- [User](docs/User.md)
diff --git a/samples/client/petstore/python/docs/Polygon.md b/samples/client/petstore/python/docs/Polygon.md
new file mode 100644
index 00000000000..586c509a41e
--- /dev/null
+++ b/samples/client/petstore/python/docs/Polygon.md
@@ -0,0 +1,14 @@
+# Polygon
+
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**type** | **str** | |
+**area** | **str** | | [optional]
+**sides** | **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/PolygonAllOf.md b/samples/client/petstore/python/docs/PolygonAllOf.md
new file mode 100644
index 00000000000..66548f78b74
--- /dev/null
+++ b/samples/client/petstore/python/docs/PolygonAllOf.md
@@ -0,0 +1,14 @@
+# PolygonAllOf
+
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**type** | **str** | |
+**sides** | **int** | | [optional]
+**area** | **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/Shape.md b/samples/client/petstore/python/docs/Shape.md
new file mode 100644
index 00000000000..520db56a6fc
--- /dev/null
+++ b/samples/client/petstore/python/docs/Shape.md
@@ -0,0 +1,13 @@
+# Shape
+
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**type** | **str** | |
+**area** | **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/Square.md b/samples/client/petstore/python/docs/Square.md
new file mode 100644
index 00000000000..901633cc6a4
--- /dev/null
+++ b/samples/client/petstore/python/docs/Square.md
@@ -0,0 +1,14 @@
+# Square
+
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**type** | **str** | | defaults to "Square"
+**area** | **str** | | [optional]
+**sides** | **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/SquareAllOf.md b/samples/client/petstore/python/docs/SquareAllOf.md
new file mode 100644
index 00000000000..ad9520092db
--- /dev/null
+++ b/samples/client/petstore/python/docs/SquareAllOf.md
@@ -0,0 +1,14 @@
+# SquareAllOf
+
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**type** | **str** | | [optional] if omitted the server will use the default value of "Square"
+**sides** | **int** | | [optional]
+**area** | **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/Triangle.md b/samples/client/petstore/python/docs/Triangle.md
new file mode 100644
index 00000000000..28f18053371
--- /dev/null
+++ b/samples/client/petstore/python/docs/Triangle.md
@@ -0,0 +1,14 @@
+# Triangle
+
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**type** | **str** | | defaults to "Triangle"
+**area** | **str** | | [optional]
+**sides** | **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/TriangleAllOf.md b/samples/client/petstore/python/docs/TriangleAllOf.md
new file mode 100644
index 00000000000..44b8c0581cc
--- /dev/null
+++ b/samples/client/petstore/python/docs/TriangleAllOf.md
@@ -0,0 +1,14 @@
+# TriangleAllOf
+
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**type** | **str** | | [optional] if omitted the server will use the default value of "Triangle"
+**sides** | **int** | | [optional]
+**area** | **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/petstore_api/model/polygon.py b/samples/client/petstore/python/petstore_api/model/polygon.py
new file mode 100644
index 00000000000..abe7f5e5ae8
--- /dev/null
+++ b/samples/client/petstore/python/petstore_api/model/polygon.py
@@ -0,0 +1,334 @@
+"""
+ 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,
+ OpenApiModel
+)
+from petstore_api.exceptions import ApiAttributeError
+
+
+def lazy_import():
+ from petstore_api.model.polygon_all_of import PolygonAllOf
+ from petstore_api.model.shape import Shape
+ globals()['PolygonAllOf'] = PolygonAllOf
+ globals()['Shape'] = Shape
+
+
+class Polygon(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 = {
+ ('type',): {
+ 'TRIANGLE': "Triangle",
+ 'SQUARE': "Square",
+ },
+ }
+
+ 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
+ """
+ lazy_import()
+ 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.
+ """
+ lazy_import()
+ return {
+ 'type': (str,), # noqa: E501
+ 'area': (str,), # noqa: E501
+ 'sides': (int,), # noqa: E501
+ }
+
+ @cached_property
+ def discriminator():
+ return None
+
+
+ attribute_map = {
+ 'type': 'type', # noqa: E501
+ 'area': 'area', # noqa: E501
+ 'sides': 'sides', # noqa: E501
+ }
+
+ read_only_vars = {
+ }
+
+ @classmethod
+ @convert_js_args_to_python_args
+ def _from_openapi_data(cls, *args, **kwargs): # noqa: E501
+ """Polygon - a model defined in OpenAPI
+
+ Keyword Args:
+ 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,)
+ area (str): [optional] # noqa: E501
+ sides (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', ())
+
+ self = super(OpenApiModel, cls).__new__(cls)
+
+ if args:
+ for arg in args:
+ if isinstance(arg, dict):
+ kwargs.update(arg)
+ else:
+ 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)
+
+ return self
+
+ 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
+ """Polygon - a model defined in OpenAPI
+
+ Keyword Args:
+ 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,)
+ area (str): [optional] # noqa: E501
+ sides (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:
+ for arg in args:
+ if isinstance(arg, dict):
+ kwargs.update(arg)
+ else:
+ 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)
+ if var_name in self.read_only_vars:
+ raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate "
+ f"class with read only attributes.")
+
+ @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 because 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': [
+ PolygonAllOf,
+ Shape,
+ ],
+ 'oneOf': [
+ ],
+ }
diff --git a/samples/client/petstore/python/petstore_api/model/polygon_all_of.py b/samples/client/petstore/python/petstore_api/model/polygon_all_of.py
new file mode 100644
index 00000000000..e596e25616a
--- /dev/null
+++ b/samples/client/petstore/python/petstore_api/model/polygon_all_of.py
@@ -0,0 +1,281 @@
+"""
+ 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,
+ OpenApiModel
+)
+from petstore_api.exceptions import ApiAttributeError
+
+
+
+class PolygonAllOf(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 = {
+ ('type',): {
+ 'TRIANGLE': "Triangle",
+ 'SQUARE': "Square",
+ },
+ }
+
+ 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 {
+ 'type': (str,), # noqa: E501
+ 'sides': (int,), # noqa: E501
+ 'area': (str,), # noqa: E501
+ }
+
+ @cached_property
+ def discriminator():
+ return None
+
+
+ attribute_map = {
+ 'type': 'type', # noqa: E501
+ 'sides': 'sides', # noqa: E501
+ 'area': 'area', # noqa: E501
+ }
+
+ read_only_vars = {
+ }
+
+ _composed_schemas = {}
+
+ @classmethod
+ @convert_js_args_to_python_args
+ def _from_openapi_data(cls, type, *args, **kwargs): # noqa: E501
+ """PolygonAllOf - a model defined in OpenAPI
+
+ Args:
+ 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,)
+ sides (int): [optional] # noqa: E501
+ area (str): [optional] # noqa: E501
+ """
+
+ _check_type = kwargs.pop('_check_type', True)
+ _spec_property_naming = kwargs.pop('_spec_property_naming', True)
+ _path_to_item = kwargs.pop('_path_to_item', ())
+ _configuration = kwargs.pop('_configuration', None)
+ _visited_composed_classes = kwargs.pop('_visited_composed_classes', ())
+
+ self = super(OpenApiModel, cls).__new__(cls)
+
+ if args:
+ for arg in args:
+ if isinstance(arg, dict):
+ kwargs.update(arg)
+ else:
+ 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.type = 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)
+ return self
+
+ 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, type, *args, **kwargs): # noqa: E501
+ """PolygonAllOf - a model defined in OpenAPI
+
+ Args:
+ 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,)
+ sides (int): [optional] # noqa: E501
+ area (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:
+ for arg in args:
+ if isinstance(arg, dict):
+ kwargs.update(arg)
+ else:
+ 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.type = 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)
+ if var_name in self.read_only_vars:
+ raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate "
+ f"class with read only attributes.")
diff --git a/samples/client/petstore/python/petstore_api/model/shape.py b/samples/client/petstore/python/petstore_api/model/shape.py
new file mode 100644
index 00000000000..6a52a82fef7
--- /dev/null
+++ b/samples/client/petstore/python/petstore_api/model/shape.py
@@ -0,0 +1,277 @@
+"""
+ 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,
+ OpenApiModel
+)
+from petstore_api.exceptions import ApiAttributeError
+
+
+
+class Shape(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 = {
+ ('type',): {
+ 'TRIANGLE': "Triangle",
+ 'SQUARE': "Square",
+ },
+ }
+
+ 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 {
+ 'type': (str,), # noqa: E501
+ 'area': (str,), # noqa: E501
+ }
+
+ @cached_property
+ def discriminator():
+ return None
+
+
+ attribute_map = {
+ 'type': 'type', # noqa: E501
+ 'area': 'area', # noqa: E501
+ }
+
+ read_only_vars = {
+ }
+
+ _composed_schemas = {}
+
+ @classmethod
+ @convert_js_args_to_python_args
+ def _from_openapi_data(cls, type, *args, **kwargs): # noqa: E501
+ """Shape - a model defined in OpenAPI
+
+ Args:
+ 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,)
+ area (str): [optional] # noqa: E501
+ """
+
+ _check_type = kwargs.pop('_check_type', True)
+ _spec_property_naming = kwargs.pop('_spec_property_naming', True)
+ _path_to_item = kwargs.pop('_path_to_item', ())
+ _configuration = kwargs.pop('_configuration', None)
+ _visited_composed_classes = kwargs.pop('_visited_composed_classes', ())
+
+ self = super(OpenApiModel, cls).__new__(cls)
+
+ if args:
+ for arg in args:
+ if isinstance(arg, dict):
+ kwargs.update(arg)
+ else:
+ 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.type = 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)
+ return self
+
+ 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, type, *args, **kwargs): # noqa: E501
+ """Shape - a model defined in OpenAPI
+
+ Args:
+ 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,)
+ area (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:
+ for arg in args:
+ if isinstance(arg, dict):
+ kwargs.update(arg)
+ else:
+ 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.type = 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)
+ if var_name in self.read_only_vars:
+ raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate "
+ f"class with read only attributes.")
diff --git a/samples/client/petstore/python/petstore_api/model/square.py b/samples/client/petstore/python/petstore_api/model/square.py
new file mode 100644
index 00000000000..dd8309f11df
--- /dev/null
+++ b/samples/client/petstore/python/petstore_api/model/square.py
@@ -0,0 +1,335 @@
+"""
+ 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,
+ OpenApiModel
+)
+from petstore_api.exceptions import ApiAttributeError
+
+
+def lazy_import():
+ from petstore_api.model.polygon import Polygon
+ from petstore_api.model.square_all_of import SquareAllOf
+ globals()['Polygon'] = Polygon
+ globals()['SquareAllOf'] = SquareAllOf
+
+
+class Square(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 = {
+ ('type',): {
+ 'SQUARE': "Square",
+ },
+ }
+
+ 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
+ """
+ lazy_import()
+ 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.
+ """
+ lazy_import()
+ return {
+ 'type': (str,), # noqa: E501
+ 'area': (str,), # noqa: E501
+ 'sides': (int,), # noqa: E501
+ }
+
+ @cached_property
+ def discriminator():
+ return None
+
+
+ attribute_map = {
+ 'type': 'type', # noqa: E501
+ 'area': 'area', # noqa: E501
+ 'sides': 'sides', # noqa: E501
+ }
+
+ read_only_vars = {
+ }
+
+ @classmethod
+ @convert_js_args_to_python_args
+ def _from_openapi_data(cls, *args, **kwargs): # noqa: E501
+ """Square - a model defined in OpenAPI
+
+ Keyword Args:
+ type (str): defaults to "Square", must be one of ["Square", ] # 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,)
+ area (str): [optional] # noqa: E501
+ sides (int): [optional] # noqa: E501
+ """
+
+ type = kwargs.get('type', "Square")
+ _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', ())
+
+ self = super(OpenApiModel, cls).__new__(cls)
+
+ if args:
+ for arg in args:
+ if isinstance(arg, dict):
+ kwargs.update(arg)
+ else:
+ 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)
+
+ return self
+
+ 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
+ """Square - a model defined in OpenAPI
+
+ Keyword Args:
+ type (str): defaults to "Square", must be one of ["Square", ] # 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,)
+ area (str): [optional] # noqa: E501
+ sides (int): [optional] # noqa: E501
+ """
+
+ type = kwargs.get('type', "Square")
+ _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:
+ for arg in args:
+ if isinstance(arg, dict):
+ kwargs.update(arg)
+ else:
+ 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)
+ if var_name in self.read_only_vars:
+ raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate "
+ f"class with read only attributes.")
+
+ @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 because 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': [
+ Polygon,
+ SquareAllOf,
+ ],
+ 'oneOf': [
+ ],
+ }
diff --git a/samples/client/petstore/python/petstore_api/model/square_all_of.py b/samples/client/petstore/python/petstore_api/model/square_all_of.py
new file mode 100644
index 00000000000..414338a7785
--- /dev/null
+++ b/samples/client/petstore/python/petstore_api/model/square_all_of.py
@@ -0,0 +1,274 @@
+"""
+ 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,
+ OpenApiModel
+)
+from petstore_api.exceptions import ApiAttributeError
+
+
+
+class SquareAllOf(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 = {
+ ('type',): {
+ 'SQUARE': "Square",
+ },
+ }
+
+ 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 {
+ 'type': (str,), # noqa: E501
+ 'sides': (int,), # noqa: E501
+ 'area': (str,), # noqa: E501
+ }
+
+ @cached_property
+ def discriminator():
+ return None
+
+
+ attribute_map = {
+ 'type': 'type', # noqa: E501
+ 'sides': 'sides', # noqa: E501
+ 'area': 'area', # noqa: E501
+ }
+
+ read_only_vars = {
+ }
+
+ _composed_schemas = {}
+
+ @classmethod
+ @convert_js_args_to_python_args
+ def _from_openapi_data(cls, *args, **kwargs): # noqa: E501
+ """SquareAllOf - 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,)
+ type (str): [optional] if omitted the server will use the default value of "Square" # noqa: E501
+ sides (int): [optional] # noqa: E501
+ area (str): [optional] # noqa: E501
+ """
+
+ _check_type = kwargs.pop('_check_type', True)
+ _spec_property_naming = kwargs.pop('_spec_property_naming', True)
+ _path_to_item = kwargs.pop('_path_to_item', ())
+ _configuration = kwargs.pop('_configuration', None)
+ _visited_composed_classes = kwargs.pop('_visited_composed_classes', ())
+
+ self = super(OpenApiModel, cls).__new__(cls)
+
+ if args:
+ for arg in args:
+ if isinstance(arg, dict):
+ kwargs.update(arg)
+ else:
+ 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)
+ return self
+
+ 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
+ """SquareAllOf - 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,)
+ type (str): [optional] if omitted the server will use the default value of "Square" # noqa: E501
+ sides (int): [optional] # noqa: E501
+ area (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:
+ for arg in args:
+ if isinstance(arg, dict):
+ kwargs.update(arg)
+ else:
+ 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)
+ if var_name in self.read_only_vars:
+ raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate "
+ f"class with read only attributes.")
diff --git a/samples/client/petstore/python/petstore_api/model/triangle.py b/samples/client/petstore/python/petstore_api/model/triangle.py
new file mode 100644
index 00000000000..3642426ffdd
--- /dev/null
+++ b/samples/client/petstore/python/petstore_api/model/triangle.py
@@ -0,0 +1,335 @@
+"""
+ 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,
+ OpenApiModel
+)
+from petstore_api.exceptions import ApiAttributeError
+
+
+def lazy_import():
+ from petstore_api.model.polygon import Polygon
+ from petstore_api.model.triangle_all_of import TriangleAllOf
+ globals()['Polygon'] = Polygon
+ globals()['TriangleAllOf'] = TriangleAllOf
+
+
+class Triangle(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 = {
+ ('type',): {
+ 'TRIANGLE': "Triangle",
+ },
+ }
+
+ 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
+ """
+ lazy_import()
+ 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.
+ """
+ lazy_import()
+ return {
+ 'type': (str,), # noqa: E501
+ 'area': (str,), # noqa: E501
+ 'sides': (int,), # noqa: E501
+ }
+
+ @cached_property
+ def discriminator():
+ return None
+
+
+ attribute_map = {
+ 'type': 'type', # noqa: E501
+ 'area': 'area', # noqa: E501
+ 'sides': 'sides', # noqa: E501
+ }
+
+ read_only_vars = {
+ }
+
+ @classmethod
+ @convert_js_args_to_python_args
+ def _from_openapi_data(cls, *args, **kwargs): # noqa: E501
+ """Triangle - a model defined in OpenAPI
+
+ Keyword Args:
+ type (str): defaults to "Triangle", must be one of ["Triangle", ] # 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,)
+ area (str): [optional] # noqa: E501
+ sides (int): [optional] # noqa: E501
+ """
+
+ type = kwargs.get('type', "Triangle")
+ _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', ())
+
+ self = super(OpenApiModel, cls).__new__(cls)
+
+ if args:
+ for arg in args:
+ if isinstance(arg, dict):
+ kwargs.update(arg)
+ else:
+ 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)
+
+ return self
+
+ 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
+ """Triangle - a model defined in OpenAPI
+
+ Keyword Args:
+ type (str): defaults to "Triangle", must be one of ["Triangle", ] # 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,)
+ area (str): [optional] # noqa: E501
+ sides (int): [optional] # noqa: E501
+ """
+
+ type = kwargs.get('type', "Triangle")
+ _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:
+ for arg in args:
+ if isinstance(arg, dict):
+ kwargs.update(arg)
+ else:
+ 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)
+ if var_name in self.read_only_vars:
+ raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate "
+ f"class with read only attributes.")
+
+ @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 because 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': [
+ Polygon,
+ TriangleAllOf,
+ ],
+ 'oneOf': [
+ ],
+ }
diff --git a/samples/client/petstore/python/petstore_api/model/triangle_all_of.py b/samples/client/petstore/python/petstore_api/model/triangle_all_of.py
new file mode 100644
index 00000000000..0105c347d41
--- /dev/null
+++ b/samples/client/petstore/python/petstore_api/model/triangle_all_of.py
@@ -0,0 +1,274 @@
+"""
+ 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,
+ OpenApiModel
+)
+from petstore_api.exceptions import ApiAttributeError
+
+
+
+class TriangleAllOf(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 = {
+ ('type',): {
+ 'TRIANGLE': "Triangle",
+ },
+ }
+
+ 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 {
+ 'type': (str,), # noqa: E501
+ 'sides': (int,), # noqa: E501
+ 'area': (str,), # noqa: E501
+ }
+
+ @cached_property
+ def discriminator():
+ return None
+
+
+ attribute_map = {
+ 'type': 'type', # noqa: E501
+ 'sides': 'sides', # noqa: E501
+ 'area': 'area', # noqa: E501
+ }
+
+ read_only_vars = {
+ }
+
+ _composed_schemas = {}
+
+ @classmethod
+ @convert_js_args_to_python_args
+ def _from_openapi_data(cls, *args, **kwargs): # noqa: E501
+ """TriangleAllOf - 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,)
+ type (str): [optional] if omitted the server will use the default value of "Triangle" # noqa: E501
+ sides (int): [optional] # noqa: E501
+ area (str): [optional] # noqa: E501
+ """
+
+ _check_type = kwargs.pop('_check_type', True)
+ _spec_property_naming = kwargs.pop('_spec_property_naming', True)
+ _path_to_item = kwargs.pop('_path_to_item', ())
+ _configuration = kwargs.pop('_configuration', None)
+ _visited_composed_classes = kwargs.pop('_visited_composed_classes', ())
+
+ self = super(OpenApiModel, cls).__new__(cls)
+
+ if args:
+ for arg in args:
+ if isinstance(arg, dict):
+ kwargs.update(arg)
+ else:
+ 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)
+ return self
+
+ 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
+ """TriangleAllOf - 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,)
+ type (str): [optional] if omitted the server will use the default value of "Triangle" # noqa: E501
+ sides (int): [optional] # noqa: E501
+ area (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:
+ for arg in args:
+ if isinstance(arg, dict):
+ kwargs.update(arg)
+ else:
+ 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)
+ if var_name in self.read_only_vars:
+ raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate "
+ f"class with read only attributes.")
diff --git a/samples/client/petstore/python/petstore_api/models/__init__.py b/samples/client/petstore/python/petstore_api/models/__init__.py
index 361e2bd9766..06a63ac193e 100644
--- a/samples/client/petstore/python/petstore_api/models/__init__.py
+++ b/samples/client/petstore/python/petstore_api/models/__init__.py
@@ -63,11 +63,18 @@ 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.polygon import Polygon
+from petstore_api.model.polygon_all_of import PolygonAllOf
from petstore_api.model.read_only_first import ReadOnlyFirst
+from petstore_api.model.shape import Shape
from petstore_api.model.special_model_name import SpecialModelName
+from petstore_api.model.square import Square
+from petstore_api.model.square_all_of import SquareAllOf
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.triangle import Triangle
+from petstore_api.model.triangle_all_of import TriangleAllOf
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
diff --git a/samples/client/petstore/python/test/test_polygon.py b/samples/client/petstore/python/test/test_polygon.py
new file mode 100644
index 00000000000..44c6f5430a5
--- /dev/null
+++ b/samples/client/petstore/python/test/test_polygon.py
@@ -0,0 +1,39 @@
+"""
+ 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.polygon_all_of import PolygonAllOf
+from petstore_api.model.shape import Shape
+globals()['PolygonAllOf'] = PolygonAllOf
+globals()['Shape'] = Shape
+from petstore_api.model.polygon import Polygon
+
+
+class TestPolygon(unittest.TestCase):
+ """Polygon unit test stubs"""
+
+ def setUp(self):
+ pass
+
+ def tearDown(self):
+ pass
+
+ def testPolygon(self):
+ """Test Polygon"""
+ # FIXME: construct object with mandatory attributes with example values
+ # model = Polygon() # noqa: E501
+ pass
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/samples/client/petstore/python/test/test_polygon_all_of.py b/samples/client/petstore/python/test/test_polygon_all_of.py
new file mode 100644
index 00000000000..fb04385d713
--- /dev/null
+++ b/samples/client/petstore/python/test/test_polygon_all_of.py
@@ -0,0 +1,35 @@
+"""
+ 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.polygon_all_of import PolygonAllOf
+
+
+class TestPolygonAllOf(unittest.TestCase):
+ """PolygonAllOf unit test stubs"""
+
+ def setUp(self):
+ pass
+
+ def tearDown(self):
+ pass
+
+ def testPolygonAllOf(self):
+ """Test PolygonAllOf"""
+ # FIXME: construct object with mandatory attributes with example values
+ # model = PolygonAllOf() # noqa: E501
+ pass
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/samples/client/petstore/python/test/test_shape.py b/samples/client/petstore/python/test/test_shape.py
new file mode 100644
index 00000000000..7e1c0659eaa
--- /dev/null
+++ b/samples/client/petstore/python/test/test_shape.py
@@ -0,0 +1,35 @@
+"""
+ 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.shape import Shape
+
+
+class TestShape(unittest.TestCase):
+ """Shape unit test stubs"""
+
+ def setUp(self):
+ pass
+
+ def tearDown(self):
+ pass
+
+ def testShape(self):
+ """Test Shape"""
+ # FIXME: construct object with mandatory attributes with example values
+ # model = Shape() # noqa: E501
+ pass
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/samples/client/petstore/python/test/test_square.py b/samples/client/petstore/python/test/test_square.py
new file mode 100644
index 00000000000..056c248d6a9
--- /dev/null
+++ b/samples/client/petstore/python/test/test_square.py
@@ -0,0 +1,39 @@
+"""
+ 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.polygon import Polygon
+from petstore_api.model.square_all_of import SquareAllOf
+globals()['Polygon'] = Polygon
+globals()['SquareAllOf'] = SquareAllOf
+from petstore_api.model.square import Square
+
+
+class TestSquare(unittest.TestCase):
+ """Square unit test stubs"""
+
+ def setUp(self):
+ pass
+
+ def tearDown(self):
+ pass
+
+ def testSquare(self):
+ """Test Square"""
+ # FIXME: construct object with mandatory attributes with example values
+ # model = Square() # noqa: E501
+ pass
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/samples/client/petstore/python/test/test_square_all_of.py b/samples/client/petstore/python/test/test_square_all_of.py
new file mode 100644
index 00000000000..466d3acbc14
--- /dev/null
+++ b/samples/client/petstore/python/test/test_square_all_of.py
@@ -0,0 +1,35 @@
+"""
+ 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.square_all_of import SquareAllOf
+
+
+class TestSquareAllOf(unittest.TestCase):
+ """SquareAllOf unit test stubs"""
+
+ def setUp(self):
+ pass
+
+ def tearDown(self):
+ pass
+
+ def testSquareAllOf(self):
+ """Test SquareAllOf"""
+ # FIXME: construct object with mandatory attributes with example values
+ # model = SquareAllOf() # noqa: E501
+ pass
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/samples/client/petstore/python/test/test_triangle.py b/samples/client/petstore/python/test/test_triangle.py
new file mode 100644
index 00000000000..433e572eddd
--- /dev/null
+++ b/samples/client/petstore/python/test/test_triangle.py
@@ -0,0 +1,39 @@
+"""
+ 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.polygon import Polygon
+from petstore_api.model.triangle_all_of import TriangleAllOf
+globals()['Polygon'] = Polygon
+globals()['TriangleAllOf'] = TriangleAllOf
+from petstore_api.model.triangle import Triangle
+
+
+class TestTriangle(unittest.TestCase):
+ """Triangle unit test stubs"""
+
+ def setUp(self):
+ pass
+
+ def tearDown(self):
+ pass
+
+ def testTriangle(self):
+ """Test Triangle"""
+ # FIXME: construct object with mandatory attributes with example values
+ # model = Triangle() # noqa: E501
+ pass
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/samples/client/petstore/python/test/test_triangle_all_of.py b/samples/client/petstore/python/test/test_triangle_all_of.py
new file mode 100644
index 00000000000..322d2e802eb
--- /dev/null
+++ b/samples/client/petstore/python/test/test_triangle_all_of.py
@@ -0,0 +1,35 @@
+"""
+ 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.triangle_all_of import TriangleAllOf
+
+
+class TestTriangleAllOf(unittest.TestCase):
+ """TriangleAllOf unit test stubs"""
+
+ def setUp(self):
+ pass
+
+ def tearDown(self):
+ pass
+
+ def testTriangleAllOf(self):
+ """Test TriangleAllOf"""
+ # FIXME: construct object with mandatory attributes with example values
+ # model = TriangleAllOf() # noqa: E501
+ pass
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/.openapi-generator/FILES b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/.openapi-generator/FILES
index 417028fbd1f..9ea15953368 100644
--- a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/.openapi-generator/FILES
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/.openapi-generator/FILES
@@ -60,12 +60,19 @@ docs/ParentPet.md
docs/Pet.md
docs/PetApi.md
docs/Player.md
+docs/Polygon.md
+docs/PolygonAllOf.md
docs/ReadOnlyFirst.md
+docs/Shape.md
docs/SpecialModelName.md
+docs/Square.md
+docs/SquareAllOf.md
docs/StoreApi.md
docs/StringBooleanMap.md
docs/StringEnum.md
docs/Tag.md
+docs/Triangle.md
+docs/TriangleAllOf.md
docs/TypeHolderDefault.md
docs/TypeHolderExample.md
docs/User.md
@@ -139,11 +146,18 @@ 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/polygon.py
+petstore_api/model/polygon_all_of.py
petstore_api/model/read_only_first.py
+petstore_api/model/shape.py
petstore_api/model/special_model_name.py
+petstore_api/model/square.py
+petstore_api/model/square_all_of.py
petstore_api/model/string_boolean_map.py
petstore_api/model/string_enum.py
petstore_api/model/tag.py
+petstore_api/model/triangle.py
+petstore_api/model/triangle_all_of.py
petstore_api/model/type_holder_default.py
petstore_api/model/type_holder_example.py
petstore_api/model/user.py
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/README.md b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/README.md
index 8e57b995b3e..4b34d32b616 100644
--- a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/README.md
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/README.md
@@ -178,11 +178,18 @@ Class | Method | HTTP request | Description
- [ParentPet](docs/ParentPet.md)
- [Pet](docs/Pet.md)
- [Player](docs/Player.md)
+ - [Polygon](docs/Polygon.md)
+ - [PolygonAllOf](docs/PolygonAllOf.md)
- [ReadOnlyFirst](docs/ReadOnlyFirst.md)
+ - [Shape](docs/Shape.md)
- [SpecialModelName](docs/SpecialModelName.md)
+ - [Square](docs/Square.md)
+ - [SquareAllOf](docs/SquareAllOf.md)
- [StringBooleanMap](docs/StringBooleanMap.md)
- [StringEnum](docs/StringEnum.md)
- [Tag](docs/Tag.md)
+ - [Triangle](docs/Triangle.md)
+ - [TriangleAllOf](docs/TriangleAllOf.md)
- [TypeHolderDefault](docs/TypeHolderDefault.md)
- [TypeHolderExample](docs/TypeHolderExample.md)
- [User](docs/User.md)
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/Polygon.md b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/Polygon.md
new file mode 100644
index 00000000000..ee26d74fab6
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/Polygon.md
@@ -0,0 +1,13 @@
+# Polygon
+
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**type** | **str** | |
+**area** | **str** | | [optional]
+**sides** | **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/PolygonAllOf.md b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/PolygonAllOf.md
new file mode 100644
index 00000000000..af335e0da30
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/PolygonAllOf.md
@@ -0,0 +1,13 @@
+# PolygonAllOf
+
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**type** | **str** | |
+**sides** | **int** | | [optional]
+**area** | **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/Shape.md b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/Shape.md
new file mode 100644
index 00000000000..d6ec61ccba2
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/Shape.md
@@ -0,0 +1,12 @@
+# Shape
+
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**type** | **str** | |
+**area** | **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/Square.md b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/Square.md
new file mode 100644
index 00000000000..f1e5416fb79
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/Square.md
@@ -0,0 +1,13 @@
+# Square
+
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**type** | **str** | | defaults to "Square"
+**area** | **str** | | [optional]
+**sides** | **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/SquareAllOf.md b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/SquareAllOf.md
new file mode 100644
index 00000000000..0aee3fc5201
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/SquareAllOf.md
@@ -0,0 +1,13 @@
+# SquareAllOf
+
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**type** | **str** | | [optional] if omitted the server will use the default value of "Square"
+**sides** | **int** | | [optional]
+**area** | **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/Triangle.md b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/Triangle.md
new file mode 100644
index 00000000000..84770cd63f8
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/Triangle.md
@@ -0,0 +1,13 @@
+# Triangle
+
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**type** | **str** | | defaults to "Triangle"
+**area** | **str** | | [optional]
+**sides** | **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/TriangleAllOf.md b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/TriangleAllOf.md
new file mode 100644
index 00000000000..4bd5a697020
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/docs/TriangleAllOf.md
@@ -0,0 +1,13 @@
+# TriangleAllOf
+
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**type** | **str** | | [optional] if omitted the server will use the default value of "Triangle"
+**sides** | **int** | | [optional]
+**area** | **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/petstore_api/model/polygon.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/polygon.py
new file mode 100644
index 00000000000..5cb7b464fe0
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/polygon.py
@@ -0,0 +1,327 @@
+"""
+ 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,
+ OpenApiModel
+)
+from petstore_api.exceptions import ApiAttributeError
+
+
+def lazy_import():
+ from petstore_api.model.polygon_all_of import PolygonAllOf
+ from petstore_api.model.shape import Shape
+ globals()['PolygonAllOf'] = PolygonAllOf
+ globals()['Shape'] = Shape
+
+
+class Polygon(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 = {
+ ('type',): {
+ 'TRIANGLE': "Triangle",
+ 'SQUARE': "Square",
+ },
+ }
+
+ 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 {
+ 'type': (str,), # noqa: E501
+ 'area': (str,), # noqa: E501
+ 'sides': (int,), # noqa: E501
+ }
+
+ @cached_property
+ def discriminator():
+ return None
+
+
+ attribute_map = {
+ 'type': 'type', # noqa: E501
+ 'area': 'area', # noqa: E501
+ 'sides': 'sides', # noqa: E501
+ }
+
+ read_only_vars = {
+ }
+
+ @classmethod
+ @convert_js_args_to_python_args
+ def _from_openapi_data(cls, *args, **kwargs): # noqa: E501
+ """Polygon - a model defined in OpenAPI
+
+ Keyword Args:
+ 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,)
+ area (str): [optional] # noqa: E501
+ sides (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', ())
+
+ self = super(OpenApiModel, cls).__new__(cls)
+
+ if args:
+ for arg in args:
+ if isinstance(arg, dict):
+ kwargs.update(arg)
+ else:
+ 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)
+
+ return self
+
+ 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
+ """Polygon - a model defined in OpenAPI
+
+ Keyword Args:
+ 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,)
+ area (str): [optional] # noqa: E501
+ sides (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:
+ for arg in args:
+ if isinstance(arg, dict):
+ kwargs.update(arg)
+ else:
+ 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)
+ if var_name in self.read_only_vars:
+ raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate "
+ f"class with read only attributes.")
+
+ @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 because 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': [
+ PolygonAllOf,
+ Shape,
+ ],
+ 'oneOf': [
+ ],
+ }
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/polygon_all_of.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/polygon_all_of.py
new file mode 100644
index 00000000000..69f646b3c4d
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/polygon_all_of.py
@@ -0,0 +1,275 @@
+"""
+ 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,
+ OpenApiModel
+)
+from petstore_api.exceptions import ApiAttributeError
+
+
+
+class PolygonAllOf(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 = {
+ ('type',): {
+ 'TRIANGLE': "Triangle",
+ 'SQUARE': "Square",
+ },
+ }
+
+ 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 {
+ 'type': (str,), # noqa: E501
+ 'sides': (int,), # noqa: E501
+ 'area': (str,), # noqa: E501
+ }
+
+ @cached_property
+ def discriminator():
+ return None
+
+
+ attribute_map = {
+ 'type': 'type', # noqa: E501
+ 'sides': 'sides', # noqa: E501
+ 'area': 'area', # noqa: E501
+ }
+
+ read_only_vars = {
+ }
+
+ _composed_schemas = {}
+
+ @classmethod
+ @convert_js_args_to_python_args
+ def _from_openapi_data(cls, type, *args, **kwargs): # noqa: E501
+ """PolygonAllOf - a model defined in OpenAPI
+
+ Args:
+ 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,)
+ sides (int): [optional] # noqa: E501
+ area (str): [optional] # noqa: E501
+ """
+
+ _check_type = kwargs.pop('_check_type', True)
+ _spec_property_naming = kwargs.pop('_spec_property_naming', True)
+ _path_to_item = kwargs.pop('_path_to_item', ())
+ _configuration = kwargs.pop('_configuration', None)
+ _visited_composed_classes = kwargs.pop('_visited_composed_classes', ())
+
+ self = super(OpenApiModel, cls).__new__(cls)
+
+ if args:
+ for arg in args:
+ if isinstance(arg, dict):
+ kwargs.update(arg)
+ else:
+ 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.type = 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)
+ return self
+
+ 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, type, *args, **kwargs): # noqa: E501
+ """PolygonAllOf - a model defined in OpenAPI
+
+ Args:
+ 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,)
+ sides (int): [optional] # noqa: E501
+ area (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:
+ for arg in args:
+ if isinstance(arg, dict):
+ kwargs.update(arg)
+ else:
+ 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.type = 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)
+ if var_name in self.read_only_vars:
+ raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate "
+ f"class with read only attributes.")
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/shape.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/shape.py
new file mode 100644
index 00000000000..e6b84303dc7
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/shape.py
@@ -0,0 +1,271 @@
+"""
+ 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,
+ OpenApiModel
+)
+from petstore_api.exceptions import ApiAttributeError
+
+
+
+class Shape(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 = {
+ ('type',): {
+ 'TRIANGLE': "Triangle",
+ 'SQUARE': "Square",
+ },
+ }
+
+ 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 {
+ 'type': (str,), # noqa: E501
+ 'area': (str,), # noqa: E501
+ }
+
+ @cached_property
+ def discriminator():
+ return None
+
+
+ attribute_map = {
+ 'type': 'type', # noqa: E501
+ 'area': 'area', # noqa: E501
+ }
+
+ read_only_vars = {
+ }
+
+ _composed_schemas = {}
+
+ @classmethod
+ @convert_js_args_to_python_args
+ def _from_openapi_data(cls, type, *args, **kwargs): # noqa: E501
+ """Shape - a model defined in OpenAPI
+
+ Args:
+ 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,)
+ area (str): [optional] # noqa: E501
+ """
+
+ _check_type = kwargs.pop('_check_type', True)
+ _spec_property_naming = kwargs.pop('_spec_property_naming', True)
+ _path_to_item = kwargs.pop('_path_to_item', ())
+ _configuration = kwargs.pop('_configuration', None)
+ _visited_composed_classes = kwargs.pop('_visited_composed_classes', ())
+
+ self = super(OpenApiModel, cls).__new__(cls)
+
+ if args:
+ for arg in args:
+ if isinstance(arg, dict):
+ kwargs.update(arg)
+ else:
+ 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.type = 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)
+ return self
+
+ 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, type, *args, **kwargs): # noqa: E501
+ """Shape - a model defined in OpenAPI
+
+ Args:
+ 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,)
+ area (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:
+ for arg in args:
+ if isinstance(arg, dict):
+ kwargs.update(arg)
+ else:
+ 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.type = 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)
+ if var_name in self.read_only_vars:
+ raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate "
+ f"class with read only attributes.")
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/square.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/square.py
new file mode 100644
index 00000000000..f402fd73561
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/square.py
@@ -0,0 +1,328 @@
+"""
+ 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,
+ OpenApiModel
+)
+from petstore_api.exceptions import ApiAttributeError
+
+
+def lazy_import():
+ from petstore_api.model.polygon import Polygon
+ from petstore_api.model.square_all_of import SquareAllOf
+ globals()['Polygon'] = Polygon
+ globals()['SquareAllOf'] = SquareAllOf
+
+
+class Square(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 = {
+ ('type',): {
+ 'SQUARE': "Square",
+ },
+ }
+
+ 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 {
+ 'type': (str,), # noqa: E501
+ 'area': (str,), # noqa: E501
+ 'sides': (int,), # noqa: E501
+ }
+
+ @cached_property
+ def discriminator():
+ return None
+
+
+ attribute_map = {
+ 'type': 'type', # noqa: E501
+ 'area': 'area', # noqa: E501
+ 'sides': 'sides', # noqa: E501
+ }
+
+ read_only_vars = {
+ }
+
+ @classmethod
+ @convert_js_args_to_python_args
+ def _from_openapi_data(cls, *args, **kwargs): # noqa: E501
+ """Square - a model defined in OpenAPI
+
+ Keyword Args:
+ type (str): defaults to "Square", must be one of ["Square", ] # 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,)
+ area (str): [optional] # noqa: E501
+ sides (int): [optional] # noqa: E501
+ """
+
+ type = kwargs.get('type', "Square")
+ _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', ())
+
+ self = super(OpenApiModel, cls).__new__(cls)
+
+ if args:
+ for arg in args:
+ if isinstance(arg, dict):
+ kwargs.update(arg)
+ else:
+ 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)
+
+ return self
+
+ 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
+ """Square - a model defined in OpenAPI
+
+ Keyword Args:
+ type (str): defaults to "Square", must be one of ["Square", ] # 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,)
+ area (str): [optional] # noqa: E501
+ sides (int): [optional] # noqa: E501
+ """
+
+ type = kwargs.get('type', "Square")
+ _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:
+ for arg in args:
+ if isinstance(arg, dict):
+ kwargs.update(arg)
+ else:
+ 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)
+ if var_name in self.read_only_vars:
+ raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate "
+ f"class with read only attributes.")
+
+ @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 because 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': [
+ Polygon,
+ SquareAllOf,
+ ],
+ 'oneOf': [
+ ],
+ }
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/square_all_of.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/square_all_of.py
new file mode 100644
index 00000000000..ad3f3fb1e93
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/square_all_of.py
@@ -0,0 +1,268 @@
+"""
+ 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,
+ OpenApiModel
+)
+from petstore_api.exceptions import ApiAttributeError
+
+
+
+class SquareAllOf(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 = {
+ ('type',): {
+ 'SQUARE': "Square",
+ },
+ }
+
+ 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 {
+ 'type': (str,), # noqa: E501
+ 'sides': (int,), # noqa: E501
+ 'area': (str,), # noqa: E501
+ }
+
+ @cached_property
+ def discriminator():
+ return None
+
+
+ attribute_map = {
+ 'type': 'type', # noqa: E501
+ 'sides': 'sides', # noqa: E501
+ 'area': 'area', # noqa: E501
+ }
+
+ read_only_vars = {
+ }
+
+ _composed_schemas = {}
+
+ @classmethod
+ @convert_js_args_to_python_args
+ def _from_openapi_data(cls, *args, **kwargs): # noqa: E501
+ """SquareAllOf - 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,)
+ type (str): [optional] if omitted the server will use the default value of "Square" # noqa: E501
+ sides (int): [optional] # noqa: E501
+ area (str): [optional] # noqa: E501
+ """
+
+ _check_type = kwargs.pop('_check_type', True)
+ _spec_property_naming = kwargs.pop('_spec_property_naming', True)
+ _path_to_item = kwargs.pop('_path_to_item', ())
+ _configuration = kwargs.pop('_configuration', None)
+ _visited_composed_classes = kwargs.pop('_visited_composed_classes', ())
+
+ self = super(OpenApiModel, cls).__new__(cls)
+
+ if args:
+ for arg in args:
+ if isinstance(arg, dict):
+ kwargs.update(arg)
+ else:
+ 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)
+ return self
+
+ 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
+ """SquareAllOf - 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,)
+ type (str): [optional] if omitted the server will use the default value of "Square" # noqa: E501
+ sides (int): [optional] # noqa: E501
+ area (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:
+ for arg in args:
+ if isinstance(arg, dict):
+ kwargs.update(arg)
+ else:
+ 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)
+ if var_name in self.read_only_vars:
+ raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate "
+ f"class with read only attributes.")
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/triangle.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/triangle.py
new file mode 100644
index 00000000000..34029a961fd
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/triangle.py
@@ -0,0 +1,328 @@
+"""
+ 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,
+ OpenApiModel
+)
+from petstore_api.exceptions import ApiAttributeError
+
+
+def lazy_import():
+ from petstore_api.model.polygon import Polygon
+ from petstore_api.model.triangle_all_of import TriangleAllOf
+ globals()['Polygon'] = Polygon
+ globals()['TriangleAllOf'] = TriangleAllOf
+
+
+class Triangle(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 = {
+ ('type',): {
+ 'TRIANGLE': "Triangle",
+ },
+ }
+
+ 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 {
+ 'type': (str,), # noqa: E501
+ 'area': (str,), # noqa: E501
+ 'sides': (int,), # noqa: E501
+ }
+
+ @cached_property
+ def discriminator():
+ return None
+
+
+ attribute_map = {
+ 'type': 'type', # noqa: E501
+ 'area': 'area', # noqa: E501
+ 'sides': 'sides', # noqa: E501
+ }
+
+ read_only_vars = {
+ }
+
+ @classmethod
+ @convert_js_args_to_python_args
+ def _from_openapi_data(cls, *args, **kwargs): # noqa: E501
+ """Triangle - a model defined in OpenAPI
+
+ Keyword Args:
+ type (str): defaults to "Triangle", must be one of ["Triangle", ] # 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,)
+ area (str): [optional] # noqa: E501
+ sides (int): [optional] # noqa: E501
+ """
+
+ type = kwargs.get('type', "Triangle")
+ _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', ())
+
+ self = super(OpenApiModel, cls).__new__(cls)
+
+ if args:
+ for arg in args:
+ if isinstance(arg, dict):
+ kwargs.update(arg)
+ else:
+ 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)
+
+ return self
+
+ 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
+ """Triangle - a model defined in OpenAPI
+
+ Keyword Args:
+ type (str): defaults to "Triangle", must be one of ["Triangle", ] # 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,)
+ area (str): [optional] # noqa: E501
+ sides (int): [optional] # noqa: E501
+ """
+
+ type = kwargs.get('type', "Triangle")
+ _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:
+ for arg in args:
+ if isinstance(arg, dict):
+ kwargs.update(arg)
+ else:
+ 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)
+ if var_name in self.read_only_vars:
+ raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate "
+ f"class with read only attributes.")
+
+ @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 because 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': [
+ Polygon,
+ TriangleAllOf,
+ ],
+ 'oneOf': [
+ ],
+ }
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/triangle_all_of.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/triangle_all_of.py
new file mode 100644
index 00000000000..00802c74d36
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/model/triangle_all_of.py
@@ -0,0 +1,268 @@
+"""
+ 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,
+ OpenApiModel
+)
+from petstore_api.exceptions import ApiAttributeError
+
+
+
+class TriangleAllOf(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 = {
+ ('type',): {
+ 'TRIANGLE': "Triangle",
+ },
+ }
+
+ 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 {
+ 'type': (str,), # noqa: E501
+ 'sides': (int,), # noqa: E501
+ 'area': (str,), # noqa: E501
+ }
+
+ @cached_property
+ def discriminator():
+ return None
+
+
+ attribute_map = {
+ 'type': 'type', # noqa: E501
+ 'sides': 'sides', # noqa: E501
+ 'area': 'area', # noqa: E501
+ }
+
+ read_only_vars = {
+ }
+
+ _composed_schemas = {}
+
+ @classmethod
+ @convert_js_args_to_python_args
+ def _from_openapi_data(cls, *args, **kwargs): # noqa: E501
+ """TriangleAllOf - 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,)
+ type (str): [optional] if omitted the server will use the default value of "Triangle" # noqa: E501
+ sides (int): [optional] # noqa: E501
+ area (str): [optional] # noqa: E501
+ """
+
+ _check_type = kwargs.pop('_check_type', True)
+ _spec_property_naming = kwargs.pop('_spec_property_naming', True)
+ _path_to_item = kwargs.pop('_path_to_item', ())
+ _configuration = kwargs.pop('_configuration', None)
+ _visited_composed_classes = kwargs.pop('_visited_composed_classes', ())
+
+ self = super(OpenApiModel, cls).__new__(cls)
+
+ if args:
+ for arg in args:
+ if isinstance(arg, dict):
+ kwargs.update(arg)
+ else:
+ 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)
+ return self
+
+ 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
+ """TriangleAllOf - 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,)
+ type (str): [optional] if omitted the server will use the default value of "Triangle" # noqa: E501
+ sides (int): [optional] # noqa: E501
+ area (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:
+ for arg in args:
+ if isinstance(arg, dict):
+ kwargs.update(arg)
+ else:
+ 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)
+ if var_name in self.read_only_vars:
+ raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate "
+ f"class with read only attributes.")
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/models/__init__.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/models/__init__.py
index 361e2bd9766..06a63ac193e 100644
--- a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/models/__init__.py
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/models/__init__.py
@@ -63,11 +63,18 @@ 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.polygon import Polygon
+from petstore_api.model.polygon_all_of import PolygonAllOf
from petstore_api.model.read_only_first import ReadOnlyFirst
+from petstore_api.model.shape import Shape
from petstore_api.model.special_model_name import SpecialModelName
+from petstore_api.model.square import Square
+from petstore_api.model.square_all_of import SquareAllOf
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.triangle import Triangle
+from petstore_api.model.triangle_all_of import TriangleAllOf
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
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_polygon.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_polygon.py
new file mode 100644
index 00000000000..44c6f5430a5
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_polygon.py
@@ -0,0 +1,39 @@
+"""
+ 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.polygon_all_of import PolygonAllOf
+from petstore_api.model.shape import Shape
+globals()['PolygonAllOf'] = PolygonAllOf
+globals()['Shape'] = Shape
+from petstore_api.model.polygon import Polygon
+
+
+class TestPolygon(unittest.TestCase):
+ """Polygon unit test stubs"""
+
+ def setUp(self):
+ pass
+
+ def tearDown(self):
+ pass
+
+ def testPolygon(self):
+ """Test Polygon"""
+ # FIXME: construct object with mandatory attributes with example values
+ # model = Polygon() # noqa: E501
+ pass
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_polygon_all_of.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_polygon_all_of.py
new file mode 100644
index 00000000000..fb04385d713
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_polygon_all_of.py
@@ -0,0 +1,35 @@
+"""
+ 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.polygon_all_of import PolygonAllOf
+
+
+class TestPolygonAllOf(unittest.TestCase):
+ """PolygonAllOf unit test stubs"""
+
+ def setUp(self):
+ pass
+
+ def tearDown(self):
+ pass
+
+ def testPolygonAllOf(self):
+ """Test PolygonAllOf"""
+ # FIXME: construct object with mandatory attributes with example values
+ # model = PolygonAllOf() # noqa: E501
+ pass
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_shape.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_shape.py
new file mode 100644
index 00000000000..7e1c0659eaa
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_shape.py
@@ -0,0 +1,35 @@
+"""
+ 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.shape import Shape
+
+
+class TestShape(unittest.TestCase):
+ """Shape unit test stubs"""
+
+ def setUp(self):
+ pass
+
+ def tearDown(self):
+ pass
+
+ def testShape(self):
+ """Test Shape"""
+ # FIXME: construct object with mandatory attributes with example values
+ # model = Shape() # noqa: E501
+ pass
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_square.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_square.py
new file mode 100644
index 00000000000..056c248d6a9
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_square.py
@@ -0,0 +1,39 @@
+"""
+ 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.polygon import Polygon
+from petstore_api.model.square_all_of import SquareAllOf
+globals()['Polygon'] = Polygon
+globals()['SquareAllOf'] = SquareAllOf
+from petstore_api.model.square import Square
+
+
+class TestSquare(unittest.TestCase):
+ """Square unit test stubs"""
+
+ def setUp(self):
+ pass
+
+ def tearDown(self):
+ pass
+
+ def testSquare(self):
+ """Test Square"""
+ # FIXME: construct object with mandatory attributes with example values
+ # model = Square() # noqa: E501
+ pass
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_square_all_of.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_square_all_of.py
new file mode 100644
index 00000000000..466d3acbc14
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_square_all_of.py
@@ -0,0 +1,35 @@
+"""
+ 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.square_all_of import SquareAllOf
+
+
+class TestSquareAllOf(unittest.TestCase):
+ """SquareAllOf unit test stubs"""
+
+ def setUp(self):
+ pass
+
+ def tearDown(self):
+ pass
+
+ def testSquareAllOf(self):
+ """Test SquareAllOf"""
+ # FIXME: construct object with mandatory attributes with example values
+ # model = SquareAllOf() # noqa: E501
+ pass
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_triangle.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_triangle.py
new file mode 100644
index 00000000000..433e572eddd
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_triangle.py
@@ -0,0 +1,39 @@
+"""
+ 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.polygon import Polygon
+from petstore_api.model.triangle_all_of import TriangleAllOf
+globals()['Polygon'] = Polygon
+globals()['TriangleAllOf'] = TriangleAllOf
+from petstore_api.model.triangle import Triangle
+
+
+class TestTriangle(unittest.TestCase):
+ """Triangle unit test stubs"""
+
+ def setUp(self):
+ pass
+
+ def tearDown(self):
+ pass
+
+ def testTriangle(self):
+ """Test Triangle"""
+ # FIXME: construct object with mandatory attributes with example values
+ # model = Triangle() # noqa: E501
+ pass
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_triangle_all_of.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_triangle_all_of.py
new file mode 100644
index 00000000000..322d2e802eb
--- /dev/null
+++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_triangle_all_of.py
@@ -0,0 +1,35 @@
+"""
+ 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.triangle_all_of import TriangleAllOf
+
+
+class TestTriangleAllOf(unittest.TestCase):
+ """TriangleAllOf unit test stubs"""
+
+ def setUp(self):
+ pass
+
+ def tearDown(self):
+ pass
+
+ def testTriangleAllOf(self):
+ """Test TriangleAllOf"""
+ # FIXME: construct object with mandatory attributes with example values
+ # model = TriangleAllOf() # noqa: E501
+ pass
+
+
+if __name__ == '__main__':
+ unittest.main()