From ca4a86ea550df3205ef6dd4509d7d3c5a32ca51b Mon Sep 17 00:00:00 2001 From: Justin Black Date: Thu, 14 Jul 2022 09:57:43 -0700 Subject: [PATCH] Turns on json-schema python-exp anyOf + oneOf unit tests (#12864) * Spec updated to anyof only * All tests turned on * Revert version file * Adds oneOf tests also --- .../unit_test_spec/3_0_3_unit_test_spec.yaml | 200 ++++++++++++++++++ .../3_0/unit_test_spec/spec_writer.py | 16 +- .../.openapi-generator/FILES | 30 +++ .../python-experimental/README.md | 10 + .../python-experimental/docs/Anyof.md | 9 + .../docs/AnyofComplexTypes.md | 9 + .../docs/AnyofWithBaseSchema.md | 8 + .../docs/AnyofWithOneEmptySchema.md | 9 + .../NestedAnyofToCheckValidationSemantics.md | 9 + .../NestedOneofToCheckValidationSemantics.md | 9 + .../python-experimental/docs/Oneof.md | 9 + .../docs/OneofComplexTypes.md | 9 + .../docs/OneofWithBaseSchema.md | 8 + .../docs/OneofWithEmptySchema.md | 9 + .../python-experimental/test/test_anyof.py | 54 +++++ .../test/test_anyof_complex_types.py | 70 ++++++ .../test/test_anyof_with_base_schema.py | 48 +++++ .../test/test_anyof_with_one_empty_schema.py | 39 ++++ ...ted_anyof_to_check_validation_semantics.py | 40 ++++ ...ted_oneof_to_check_validation_semantics.py | 40 ++++ .../python-experimental/test/test_oneof.py | 55 +++++ .../test/test_oneof_complex_types.py | 71 +++++++ .../test/test_oneof_with_base_schema.py | 48 +++++ .../test/test_oneof_with_empty_schema.py | 40 ++++ .../unit_test_api/model/anyof.py | 137 ++++++++++++ .../model/anyof_complex_types.py | 163 ++++++++++++++ .../model/anyof_with_base_schema.py | 156 ++++++++++++++ .../model/anyof_with_one_empty_schema.py | 117 ++++++++++ ...ted_anyof_to_check_validation_semantics.py | 156 ++++++++++++++ ...ted_oneof_to_check_validation_semantics.py | 156 ++++++++++++++ .../unit_test_api/model/oneof.py | 137 ++++++++++++ .../model/oneof_complex_types.py | 163 ++++++++++++++ .../model/oneof_with_base_schema.py | 156 ++++++++++++++ .../model/oneof_with_empty_schema.py | 117 ++++++++++ .../unit_test_api/models/__init__.py | 10 + 35 files changed, 2314 insertions(+), 3 deletions(-) create mode 100644 samples/openapi3/client/3_0_3_unit_test/python-experimental/docs/Anyof.md create mode 100644 samples/openapi3/client/3_0_3_unit_test/python-experimental/docs/AnyofComplexTypes.md create mode 100644 samples/openapi3/client/3_0_3_unit_test/python-experimental/docs/AnyofWithBaseSchema.md create mode 100644 samples/openapi3/client/3_0_3_unit_test/python-experimental/docs/AnyofWithOneEmptySchema.md create mode 100644 samples/openapi3/client/3_0_3_unit_test/python-experimental/docs/NestedAnyofToCheckValidationSemantics.md create mode 100644 samples/openapi3/client/3_0_3_unit_test/python-experimental/docs/NestedOneofToCheckValidationSemantics.md create mode 100644 samples/openapi3/client/3_0_3_unit_test/python-experimental/docs/Oneof.md create mode 100644 samples/openapi3/client/3_0_3_unit_test/python-experimental/docs/OneofComplexTypes.md create mode 100644 samples/openapi3/client/3_0_3_unit_test/python-experimental/docs/OneofWithBaseSchema.md create mode 100644 samples/openapi3/client/3_0_3_unit_test/python-experimental/docs/OneofWithEmptySchema.md create mode 100644 samples/openapi3/client/3_0_3_unit_test/python-experimental/test/test_anyof.py create mode 100644 samples/openapi3/client/3_0_3_unit_test/python-experimental/test/test_anyof_complex_types.py create mode 100644 samples/openapi3/client/3_0_3_unit_test/python-experimental/test/test_anyof_with_base_schema.py create mode 100644 samples/openapi3/client/3_0_3_unit_test/python-experimental/test/test_anyof_with_one_empty_schema.py create mode 100644 samples/openapi3/client/3_0_3_unit_test/python-experimental/test/test_nested_anyof_to_check_validation_semantics.py create mode 100644 samples/openapi3/client/3_0_3_unit_test/python-experimental/test/test_nested_oneof_to_check_validation_semantics.py create mode 100644 samples/openapi3/client/3_0_3_unit_test/python-experimental/test/test_oneof.py create mode 100644 samples/openapi3/client/3_0_3_unit_test/python-experimental/test/test_oneof_complex_types.py create mode 100644 samples/openapi3/client/3_0_3_unit_test/python-experimental/test/test_oneof_with_base_schema.py create mode 100644 samples/openapi3/client/3_0_3_unit_test/python-experimental/test/test_oneof_with_empty_schema.py create mode 100644 samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/anyof.py create mode 100644 samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/anyof_complex_types.py create mode 100644 samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/anyof_with_base_schema.py create mode 100644 samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/anyof_with_one_empty_schema.py create mode 100644 samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/nested_anyof_to_check_validation_semantics.py create mode 100644 samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/nested_oneof_to_check_validation_semantics.py create mode 100644 samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/oneof.py create mode 100644 samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/oneof_complex_types.py create mode 100644 samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/oneof_with_base_schema.py create mode 100644 samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/oneof_with_empty_schema.py diff --git a/modules/openapi-generator/src/test/resources/3_0/unit_test_spec/3_0_3_unit_test_spec.yaml b/modules/openapi-generator/src/test/resources/3_0/unit_test_spec/3_0_3_unit_test_spec.yaml index 690720dc013f..d3ff930a9087 100644 --- a/modules/openapi-generator/src/test/resources/3_0/unit_test_spec/3_0_3_unit_test_spec.yaml +++ b/modules/openapi-generator/src/test/resources/3_0/unit_test_spec/3_0_3_unit_test_spec.yaml @@ -85,6 +85,35 @@ components: - multipleOf: 3 oneOf: - multipleOf: 5 + Anyof: + anyOf: + - type: integer + - minimum: 2 + AnyofWithBaseSchema: + type: string + anyOf: + - maxLength: 2 + - minLength: 4 + AnyofComplexTypes: + anyOf: + - properties: + bar: + type: integer + required: + - bar + - properties: + foo: + type: string + required: + - foo + AnyofWithOneEmptySchema: + anyOf: + - type: number + - {} + NestedAnyofToCheckValidationSemantics: + anyOf: + - anyOf: + - type: 'null' InvalidStringValueForDefault: properties: bar: @@ -207,6 +236,35 @@ components: properties: foo: not: {} + Oneof: + oneOf: + - type: integer + - minimum: 2 + OneofWithBaseSchema: + type: string + oneOf: + - minLength: 2 + - maxLength: 4 + OneofComplexTypes: + oneOf: + - properties: + bar: + type: integer + required: + - bar + - properties: + foo: + type: string + required: + - foo + OneofWithEmptySchema: + oneOf: + - type: number + - {} + NestedOneofToCheckValidationSemantics: + oneOf: + - oneOf: + - type: 'null' PatternValidation: pattern: ^a*$ PatternIsNotAnchored: @@ -468,6 +526,77 @@ components: description: 'allOf: true, anyOf: true, oneOf: true' data: 30 valid: true + Anyof: + FirstAnyofValid: + description: first anyOf valid + data: 1 + valid: true + SecondAnyofValid: + description: second anyOf valid + data: 2.5 + valid: true + BothAnyofValid: + description: both anyOf valid + data: 3 + valid: true + NeitherAnyofValid: + description: neither anyOf valid + data: 1.5 + valid: false + AnyofWithBaseSchema: + MismatchBaseSchema: + description: mismatch base schema + data: 3 + valid: false + OneAnyofValid: + description: one anyOf valid + data: foobar + valid: true + BothAnyofInvalid: + description: both anyOf invalid + data: foo + valid: false + AnyofComplexTypes: + FirstAnyofValidComplex: + description: first anyOf valid (complex) + data: + bar: 2 + valid: true + SecondAnyofValidComplex: + description: second anyOf valid (complex) + data: + foo: baz + valid: true + BothAnyofValidComplex: + description: both anyOf valid (complex) + data: + foo: baz + bar: 2 + valid: true + NeitherAnyofValidComplex: + description: neither anyOf valid (complex) + data: + foo: 2 + bar: quux + valid: false + AnyofWithOneEmptySchema: + StringIsValid: + description: string is valid + data: foo + valid: true + NumberIsValid: + description: number is valid + data: 123 + valid: true + NestedAnyofToCheckValidationSemantics: + NullIsValid: + description: null is valid + data: null + valid: true + AnythingNonNullIsInvalid: + description: anything non-null is invalid + data: 123 + valid: false InvalidStringValueForDefault: ValidWhenPropertyIsSpecified: description: valid when property is specified @@ -1182,6 +1311,77 @@ components: bar: 1 baz: 2 valid: true + Oneof: + FirstOneofValid: + description: first oneOf valid + data: 1 + valid: true + SecondOneofValid: + description: second oneOf valid + data: 2.5 + valid: true + BothOneofValid: + description: both oneOf valid + data: 3 + valid: false + NeitherOneofValid: + description: neither oneOf valid + data: 1.5 + valid: false + OneofWithBaseSchema: + MismatchBaseSchema: + description: mismatch base schema + data: 3 + valid: false + OneOneofValid: + description: one oneOf valid + data: foobar + valid: true + BothOneofValid: + description: both oneOf valid + data: foo + valid: false + OneofComplexTypes: + FirstOneofValidComplex: + description: first oneOf valid (complex) + data: + bar: 2 + valid: true + SecondOneofValidComplex: + description: second oneOf valid (complex) + data: + foo: baz + valid: true + BothOneofValidComplex: + description: both oneOf valid (complex) + data: + foo: baz + bar: 2 + valid: false + NeitherOneofValidComplex: + description: neither oneOf valid (complex) + data: + foo: 2 + bar: quux + valid: false + OneofWithEmptySchema: + OneValidValid: + description: one valid - valid + data: foo + valid: true + BothValidInvalid: + description: both valid - invalid + data: 123 + valid: false + NestedOneofToCheckValidationSemantics: + NullIsValid: + description: null is valid + data: null + valid: true + AnythingNonNullIsInvalid: + description: anything non-null is invalid + data: 123 + valid: false PatternValidation: AMatchingPatternIsValid: description: a matching pattern is valid diff --git a/modules/openapi-generator/src/test/resources/3_0/unit_test_spec/spec_writer.py b/modules/openapi-generator/src/test/resources/3_0/unit_test_spec/spec_writer.py index ec52bb122ba6..c4843877a19f 100644 --- a/modules/openapi-generator/src/test/resources/3_0/unit_test_spec/spec_writer.py +++ b/modules/openapi-generator/src/test/resources/3_0/unit_test_spec/spec_writer.py @@ -113,6 +113,11 @@ FILEPATH_TO_EXCLUDED_CASE_AND_REASON = { 'allOf with boolean schemas, some false': ExclusionReason.v303_does_not_support_boolean_schemas_in_location, 'allOf with boolean schemas, all false': ExclusionReason.v303_does_not_support_boolean_schemas_in_location, }, + (json_schema_test_draft, 'anyOf.json'): { + 'anyOf with boolean schemas, all true': ExclusionReason.v303_does_not_support_boolean_schemas_in_location, + 'anyOf with boolean schemas, some true': ExclusionReason.v303_does_not_support_boolean_schemas_in_location, + 'anyOf with boolean schemas, all false': ExclusionReason.v303_does_not_support_boolean_schemas_in_location, + }, (json_schema_test_draft, 'default.json'): { 'invalid type for default': ExclusionReason.v303_requires_that_the_default_value_is_an_allowed_type, }, @@ -140,6 +145,11 @@ FILEPATH_TO_EXCLUDED_CASE_AND_REASON = { }, (json_schema_test_draft, 'oneOf.json'): { 'oneOf with missing optional property': ExclusionReason.v303_does_not_support_boolean_schemas_in_location, + 'oneOf with boolean schemas, all true': ExclusionReason.v303_does_not_support_boolean_schemas_in_location, + 'oneOf with boolean schemas, one true': ExclusionReason.v303_does_not_support_boolean_schemas_in_location, + 'oneOf with boolean schemas, more than one true': ExclusionReason.v303_does_not_support_boolean_schemas_in_location, + 'oneOf with boolean schemas, all false': ExclusionReason.v303_does_not_support_boolean_schemas_in_location, + 'oneOf with required': ExclusionReason.required_vars_missing_for_anytype_schema_bug, }, (json_schema_test_draft, 'properties.json'): { 'properties, patternProperties, additionalProperties interaction': ExclusionReason.v303_does_not_support_patternProperties, @@ -218,8 +228,8 @@ FILEPATH_TO_EXCLUDE_REASON = { JSON_SCHEMA_TEST_FILE_TO_FOLDERS = { 'additionalItems.json': (json_schema_test_draft,), 'additionalProperties.json': (json_schema_test_draft,), - 'allOf.json': (json_schema_test_draft,), # activate later after fixing composition processing -# 'anyOf.json': (json_schema_test_draft,), # activate later after fixing composition processing + 'allOf.json': (json_schema_test_draft,), + 'anyOf.json': (json_schema_test_draft,), 'boolean_schema.json': (json_schema_test_draft,), 'const.json': (json_schema_test_draft,), 'contains.json': (json_schema_test_draft,), @@ -243,7 +253,7 @@ JSON_SCHEMA_TEST_FILE_TO_FOLDERS = { 'minProperties.json': (json_schema_test_draft,), 'multipleOf.json': (json_schema_test_draft,), 'not.json': (json_schema_test_draft,), -# 'oneOf.json': (json_schema_test_draft,), # activate after fixing this + 'oneOf.json': (json_schema_test_draft,), 'pattern.json': (json_schema_test_draft,), 'patternProperties.json': (json_schema_test_draft,), 'properties.json': (json_schema_test_draft,), diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/.openapi-generator/FILES b/samples/openapi3/client/3_0_3_unit_test/python-experimental/.openapi-generator/FILES index e3b0e78dd7ce..e470d78a1490 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/.openapi-generator/FILES +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/.openapi-generator/FILES @@ -14,6 +14,10 @@ docs/AllofWithOneEmptySchema.md docs/AllofWithTheFirstEmptySchema.md docs/AllofWithTheLastEmptySchema.md docs/AllofWithTwoEmptySchemas.md +docs/Anyof.md +docs/AnyofComplexTypes.md +docs/AnyofWithBaseSchema.md +docs/AnyofWithOneEmptySchema.md docs/ArrayTypeMatchesArrays.md docs/BooleanTypeMatchesBooleans.md docs/ByInt.md @@ -48,12 +52,18 @@ docs/MinlengthValidation.md docs/MinpropertiesValidation.md docs/ModelNot.md docs/NestedAllofToCheckValidationSemantics.md +docs/NestedAnyofToCheckValidationSemantics.md docs/NestedItems.md +docs/NestedOneofToCheckValidationSemantics.md docs/NotMoreComplexSchema.md docs/NulCharactersInStrings.md docs/NullTypeMatchesOnlyTheNullObject.md docs/NumberTypeMatchesNumbers.md docs/ObjectPropertiesValidation.md +docs/Oneof.md +docs/OneofComplexTypes.md +docs/OneofWithBaseSchema.md +docs/OneofWithEmptySchema.md docs/PatternIsNotAnchored.md docs/PatternValidation.md docs/PropertiesWithEscapedCharacters.md @@ -93,6 +103,10 @@ test/test_allof_with_one_empty_schema.py test/test_allof_with_the_first_empty_schema.py test/test_allof_with_the_last_empty_schema.py test/test_allof_with_two_empty_schemas.py +test/test_anyof.py +test/test_anyof_complex_types.py +test/test_anyof_with_base_schema.py +test/test_anyof_with_one_empty_schema.py test/test_array_type_matches_arrays.py test/test_boolean_type_matches_booleans.py test/test_by_int.py @@ -127,12 +141,18 @@ test/test_minlength_validation.py test/test_minproperties_validation.py test/test_model_not.py test/test_nested_allof_to_check_validation_semantics.py +test/test_nested_anyof_to_check_validation_semantics.py test/test_nested_items.py +test/test_nested_oneof_to_check_validation_semantics.py test/test_not_more_complex_schema.py test/test_nul_characters_in_strings.py test/test_null_type_matches_only_the_null_object.py test/test_number_type_matches_numbers.py test/test_object_properties_validation.py +test/test_oneof.py +test/test_oneof_complex_types.py +test/test_oneof_with_base_schema.py +test/test_oneof_with_empty_schema.py test/test_pattern_is_not_anchored.py test/test_pattern_validation.py test/test_properties_with_escaped_characters.py @@ -174,6 +194,10 @@ unit_test_api/model/allof_with_one_empty_schema.py unit_test_api/model/allof_with_the_first_empty_schema.py unit_test_api/model/allof_with_the_last_empty_schema.py unit_test_api/model/allof_with_two_empty_schemas.py +unit_test_api/model/anyof.py +unit_test_api/model/anyof_complex_types.py +unit_test_api/model/anyof_with_base_schema.py +unit_test_api/model/anyof_with_one_empty_schema.py unit_test_api/model/array_type_matches_arrays.py unit_test_api/model/boolean_type_matches_booleans.py unit_test_api/model/by_int.py @@ -208,12 +232,18 @@ unit_test_api/model/minlength_validation.py unit_test_api/model/minproperties_validation.py unit_test_api/model/model_not.py unit_test_api/model/nested_allof_to_check_validation_semantics.py +unit_test_api/model/nested_anyof_to_check_validation_semantics.py unit_test_api/model/nested_items.py +unit_test_api/model/nested_oneof_to_check_validation_semantics.py unit_test_api/model/not_more_complex_schema.py unit_test_api/model/nul_characters_in_strings.py unit_test_api/model/null_type_matches_only_the_null_object.py unit_test_api/model/number_type_matches_numbers.py unit_test_api/model/object_properties_validation.py +unit_test_api/model/oneof.py +unit_test_api/model/oneof_complex_types.py +unit_test_api/model/oneof_with_base_schema.py +unit_test_api/model/oneof_with_empty_schema.py unit_test_api/model/pattern_is_not_anchored.py unit_test_api/model/pattern_validation.py unit_test_api/model/properties_with_escaped_characters.py diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/README.md b/samples/openapi3/client/3_0_3_unit_test/python-experimental/README.md index 260575301cdf..8f38f97e69e8 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/README.md +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/README.md @@ -74,6 +74,10 @@ Class | Method | HTTP request | Description - [AllofWithTheFirstEmptySchema](docs/AllofWithTheFirstEmptySchema.md) - [AllofWithTheLastEmptySchema](docs/AllofWithTheLastEmptySchema.md) - [AllofWithTwoEmptySchemas](docs/AllofWithTwoEmptySchemas.md) + - [Anyof](docs/Anyof.md) + - [AnyofComplexTypes](docs/AnyofComplexTypes.md) + - [AnyofWithBaseSchema](docs/AnyofWithBaseSchema.md) + - [AnyofWithOneEmptySchema](docs/AnyofWithOneEmptySchema.md) - [ArrayTypeMatchesArrays](docs/ArrayTypeMatchesArrays.md) - [BooleanTypeMatchesBooleans](docs/BooleanTypeMatchesBooleans.md) - [ByInt](docs/ByInt.md) @@ -108,12 +112,18 @@ Class | Method | HTTP request | Description - [MinpropertiesValidation](docs/MinpropertiesValidation.md) - [ModelNot](docs/ModelNot.md) - [NestedAllofToCheckValidationSemantics](docs/NestedAllofToCheckValidationSemantics.md) + - [NestedAnyofToCheckValidationSemantics](docs/NestedAnyofToCheckValidationSemantics.md) - [NestedItems](docs/NestedItems.md) + - [NestedOneofToCheckValidationSemantics](docs/NestedOneofToCheckValidationSemantics.md) - [NotMoreComplexSchema](docs/NotMoreComplexSchema.md) - [NulCharactersInStrings](docs/NulCharactersInStrings.md) - [NullTypeMatchesOnlyTheNullObject](docs/NullTypeMatchesOnlyTheNullObject.md) - [NumberTypeMatchesNumbers](docs/NumberTypeMatchesNumbers.md) - [ObjectPropertiesValidation](docs/ObjectPropertiesValidation.md) + - [Oneof](docs/Oneof.md) + - [OneofComplexTypes](docs/OneofComplexTypes.md) + - [OneofWithBaseSchema](docs/OneofWithBaseSchema.md) + - [OneofWithEmptySchema](docs/OneofWithEmptySchema.md) - [PatternIsNotAnchored](docs/PatternIsNotAnchored.md) - [PatternValidation](docs/PatternValidation.md) - [PropertiesWithEscapedCharacters](docs/PropertiesWithEscapedCharacters.md) diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/docs/Anyof.md b/samples/openapi3/client/3_0_3_unit_test/python-experimental/docs/Anyof.md new file mode 100644 index 000000000000..2a5107e980ce --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/docs/Anyof.md @@ -0,0 +1,9 @@ +# Anyof + +#### Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/docs/AnyofComplexTypes.md b/samples/openapi3/client/3_0_3_unit_test/python-experimental/docs/AnyofComplexTypes.md new file mode 100644 index 000000000000..a6a3dcfa534c --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/docs/AnyofComplexTypes.md @@ -0,0 +1,9 @@ +# AnyofComplexTypes + +#### Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/docs/AnyofWithBaseSchema.md b/samples/openapi3/client/3_0_3_unit_test/python-experimental/docs/AnyofWithBaseSchema.md new file mode 100644 index 000000000000..cf00c6413dc5 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/docs/AnyofWithBaseSchema.md @@ -0,0 +1,8 @@ +# AnyofWithBaseSchema + +Type | Description | Notes +------------- | ------------- | ------------- +**str** | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/docs/AnyofWithOneEmptySchema.md b/samples/openapi3/client/3_0_3_unit_test/python-experimental/docs/AnyofWithOneEmptySchema.md new file mode 100644 index 000000000000..2d3666e55b2f --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/docs/AnyofWithOneEmptySchema.md @@ -0,0 +1,9 @@ +# AnyofWithOneEmptySchema + +#### Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/docs/NestedAnyofToCheckValidationSemantics.md b/samples/openapi3/client/3_0_3_unit_test/python-experimental/docs/NestedAnyofToCheckValidationSemantics.md new file mode 100644 index 000000000000..d95966736d71 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/docs/NestedAnyofToCheckValidationSemantics.md @@ -0,0 +1,9 @@ +# NestedAnyofToCheckValidationSemantics + +#### Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/docs/NestedOneofToCheckValidationSemantics.md b/samples/openapi3/client/3_0_3_unit_test/python-experimental/docs/NestedOneofToCheckValidationSemantics.md new file mode 100644 index 000000000000..06ba0d5e9e4c --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/docs/NestedOneofToCheckValidationSemantics.md @@ -0,0 +1,9 @@ +# NestedOneofToCheckValidationSemantics + +#### Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/docs/Oneof.md b/samples/openapi3/client/3_0_3_unit_test/python-experimental/docs/Oneof.md new file mode 100644 index 000000000000..e42f38aff346 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/docs/Oneof.md @@ -0,0 +1,9 @@ +# Oneof + +#### Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/docs/OneofComplexTypes.md b/samples/openapi3/client/3_0_3_unit_test/python-experimental/docs/OneofComplexTypes.md new file mode 100644 index 000000000000..e26c501afdcd --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/docs/OneofComplexTypes.md @@ -0,0 +1,9 @@ +# OneofComplexTypes + +#### Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/docs/OneofWithBaseSchema.md b/samples/openapi3/client/3_0_3_unit_test/python-experimental/docs/OneofWithBaseSchema.md new file mode 100644 index 000000000000..f80a4e8b6570 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/docs/OneofWithBaseSchema.md @@ -0,0 +1,8 @@ +# OneofWithBaseSchema + +Type | Description | Notes +------------- | ------------- | ------------- +**str** | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/docs/OneofWithEmptySchema.md b/samples/openapi3/client/3_0_3_unit_test/python-experimental/docs/OneofWithEmptySchema.md new file mode 100644 index 000000000000..1310a70f3039 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/docs/OneofWithEmptySchema.md @@ -0,0 +1,9 @@ +# OneofWithEmptySchema + +#### Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/test/test_anyof.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/test/test_anyof.py new file mode 100644 index 000000000000..197c3449a9e4 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/test/test_anyof.py @@ -0,0 +1,54 @@ +# coding: utf-8 + +""" + openapi 3.0.3 sample spec + + sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501 + + The version of the OpenAPI document: 0.0.1 + Generated by: https://openapi-generator.tech +""" + +import unittest + +import unit_test_api +from unit_test_api.model.anyof import Anyof +from unit_test_api import configuration + + +class TestAnyof(unittest.TestCase): + """Anyof unit test stubs""" + _configuration = configuration.Configuration() + + def test_second_anyof_valid_passes(self): + # second anyOf valid + Anyof._from_openapi_data( + 2.5, + _configuration=self._configuration + ) + + def test_neither_anyof_valid_fails(self): + # neither anyOf valid + with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): + Anyof._from_openapi_data( + 1.5, + _configuration=self._configuration + ) + + def test_both_anyof_valid_passes(self): + # both anyOf valid + Anyof._from_openapi_data( + 3, + _configuration=self._configuration + ) + + def test_first_anyof_valid_passes(self): + # first anyOf valid + Anyof._from_openapi_data( + 1, + _configuration=self._configuration + ) + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/test/test_anyof_complex_types.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/test/test_anyof_complex_types.py new file mode 100644 index 000000000000..eeb533e61960 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/test/test_anyof_complex_types.py @@ -0,0 +1,70 @@ +# coding: utf-8 + +""" + openapi 3.0.3 sample spec + + sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501 + + The version of the OpenAPI document: 0.0.1 + Generated by: https://openapi-generator.tech +""" + +import unittest + +import unit_test_api +from unit_test_api.model.anyof_complex_types import AnyofComplexTypes +from unit_test_api import configuration + + +class TestAnyofComplexTypes(unittest.TestCase): + """AnyofComplexTypes unit test stubs""" + _configuration = configuration.Configuration() + + def test_second_anyof_valid_complex_passes(self): + # second anyOf valid (complex) + AnyofComplexTypes._from_openapi_data( + { + "foo": + "baz", + }, + _configuration=self._configuration + ) + + def test_neither_anyof_valid_complex_fails(self): + # neither anyOf valid (complex) + with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): + AnyofComplexTypes._from_openapi_data( + { + "foo": + 2, + "bar": + "quux", + }, + _configuration=self._configuration + ) + + def test_both_anyof_valid_complex_passes(self): + # both anyOf valid (complex) + AnyofComplexTypes._from_openapi_data( + { + "foo": + "baz", + "bar": + 2, + }, + _configuration=self._configuration + ) + + def test_first_anyof_valid_complex_passes(self): + # first anyOf valid (complex) + AnyofComplexTypes._from_openapi_data( + { + "bar": + 2, + }, + _configuration=self._configuration + ) + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/test/test_anyof_with_base_schema.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/test/test_anyof_with_base_schema.py new file mode 100644 index 000000000000..96e03720d645 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/test/test_anyof_with_base_schema.py @@ -0,0 +1,48 @@ +# coding: utf-8 + +""" + openapi 3.0.3 sample spec + + sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501 + + The version of the OpenAPI document: 0.0.1 + Generated by: https://openapi-generator.tech +""" + +import unittest + +import unit_test_api +from unit_test_api.model.anyof_with_base_schema import AnyofWithBaseSchema +from unit_test_api import configuration + + +class TestAnyofWithBaseSchema(unittest.TestCase): + """AnyofWithBaseSchema unit test stubs""" + _configuration = configuration.Configuration() + + def test_one_anyof_valid_passes(self): + # one anyOf valid + AnyofWithBaseSchema._from_openapi_data( + "foobar", + _configuration=self._configuration + ) + + def test_both_anyof_invalid_fails(self): + # both anyOf invalid + with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): + AnyofWithBaseSchema._from_openapi_data( + "foo", + _configuration=self._configuration + ) + + def test_mismatch_base_schema_fails(self): + # mismatch base schema + with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): + AnyofWithBaseSchema._from_openapi_data( + 3, + _configuration=self._configuration + ) + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/test/test_anyof_with_one_empty_schema.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/test/test_anyof_with_one_empty_schema.py new file mode 100644 index 000000000000..dcb2c0ea80a5 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/test/test_anyof_with_one_empty_schema.py @@ -0,0 +1,39 @@ +# coding: utf-8 + +""" + openapi 3.0.3 sample spec + + sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501 + + The version of the OpenAPI document: 0.0.1 + Generated by: https://openapi-generator.tech +""" + +import unittest + +import unit_test_api +from unit_test_api.model.anyof_with_one_empty_schema import AnyofWithOneEmptySchema +from unit_test_api import configuration + + +class TestAnyofWithOneEmptySchema(unittest.TestCase): + """AnyofWithOneEmptySchema unit test stubs""" + _configuration = configuration.Configuration() + + def test_string_is_valid_passes(self): + # string is valid + AnyofWithOneEmptySchema._from_openapi_data( + "foo", + _configuration=self._configuration + ) + + def test_number_is_valid_passes(self): + # number is valid + AnyofWithOneEmptySchema._from_openapi_data( + 123, + _configuration=self._configuration + ) + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/test/test_nested_anyof_to_check_validation_semantics.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/test/test_nested_anyof_to_check_validation_semantics.py new file mode 100644 index 000000000000..9790a71c84e4 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/test/test_nested_anyof_to_check_validation_semantics.py @@ -0,0 +1,40 @@ +# coding: utf-8 + +""" + openapi 3.0.3 sample spec + + sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501 + + The version of the OpenAPI document: 0.0.1 + Generated by: https://openapi-generator.tech +""" + +import unittest + +import unit_test_api +from unit_test_api.model.nested_anyof_to_check_validation_semantics import NestedAnyofToCheckValidationSemantics +from unit_test_api import configuration + + +class TestNestedAnyofToCheckValidationSemantics(unittest.TestCase): + """NestedAnyofToCheckValidationSemantics unit test stubs""" + _configuration = configuration.Configuration() + + def test_anything_non_null_is_invalid_fails(self): + # anything non-null is invalid + with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): + NestedAnyofToCheckValidationSemantics._from_openapi_data( + 123, + _configuration=self._configuration + ) + + def test_null_is_valid_passes(self): + # null is valid + NestedAnyofToCheckValidationSemantics._from_openapi_data( + None, + _configuration=self._configuration + ) + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/test/test_nested_oneof_to_check_validation_semantics.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/test/test_nested_oneof_to_check_validation_semantics.py new file mode 100644 index 000000000000..48f2ffeb026c --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/test/test_nested_oneof_to_check_validation_semantics.py @@ -0,0 +1,40 @@ +# coding: utf-8 + +""" + openapi 3.0.3 sample spec + + sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501 + + The version of the OpenAPI document: 0.0.1 + Generated by: https://openapi-generator.tech +""" + +import unittest + +import unit_test_api +from unit_test_api.model.nested_oneof_to_check_validation_semantics import NestedOneofToCheckValidationSemantics +from unit_test_api import configuration + + +class TestNestedOneofToCheckValidationSemantics(unittest.TestCase): + """NestedOneofToCheckValidationSemantics unit test stubs""" + _configuration = configuration.Configuration() + + def test_anything_non_null_is_invalid_fails(self): + # anything non-null is invalid + with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): + NestedOneofToCheckValidationSemantics._from_openapi_data( + 123, + _configuration=self._configuration + ) + + def test_null_is_valid_passes(self): + # null is valid + NestedOneofToCheckValidationSemantics._from_openapi_data( + None, + _configuration=self._configuration + ) + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/test/test_oneof.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/test/test_oneof.py new file mode 100644 index 000000000000..5daa47d179f7 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/test/test_oneof.py @@ -0,0 +1,55 @@ +# coding: utf-8 + +""" + openapi 3.0.3 sample spec + + sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501 + + The version of the OpenAPI document: 0.0.1 + Generated by: https://openapi-generator.tech +""" + +import unittest + +import unit_test_api +from unit_test_api.model.oneof import Oneof +from unit_test_api import configuration + + +class TestOneof(unittest.TestCase): + """Oneof unit test stubs""" + _configuration = configuration.Configuration() + + def test_second_oneof_valid_passes(self): + # second oneOf valid + Oneof._from_openapi_data( + 2.5, + _configuration=self._configuration + ) + + def test_both_oneof_valid_fails(self): + # both oneOf valid + with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): + Oneof._from_openapi_data( + 3, + _configuration=self._configuration + ) + + def test_first_oneof_valid_passes(self): + # first oneOf valid + Oneof._from_openapi_data( + 1, + _configuration=self._configuration + ) + + def test_neither_oneof_valid_fails(self): + # neither oneOf valid + with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): + Oneof._from_openapi_data( + 1.5, + _configuration=self._configuration + ) + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/test/test_oneof_complex_types.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/test/test_oneof_complex_types.py new file mode 100644 index 000000000000..16e639618c3b --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/test/test_oneof_complex_types.py @@ -0,0 +1,71 @@ +# coding: utf-8 + +""" + openapi 3.0.3 sample spec + + sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501 + + The version of the OpenAPI document: 0.0.1 + Generated by: https://openapi-generator.tech +""" + +import unittest + +import unit_test_api +from unit_test_api.model.oneof_complex_types import OneofComplexTypes +from unit_test_api import configuration + + +class TestOneofComplexTypes(unittest.TestCase): + """OneofComplexTypes unit test stubs""" + _configuration = configuration.Configuration() + + def test_first_oneof_valid_complex_passes(self): + # first oneOf valid (complex) + OneofComplexTypes._from_openapi_data( + { + "bar": + 2, + }, + _configuration=self._configuration + ) + + def test_neither_oneof_valid_complex_fails(self): + # neither oneOf valid (complex) + with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): + OneofComplexTypes._from_openapi_data( + { + "foo": + 2, + "bar": + "quux", + }, + _configuration=self._configuration + ) + + def test_both_oneof_valid_complex_fails(self): + # both oneOf valid (complex) + with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): + OneofComplexTypes._from_openapi_data( + { + "foo": + "baz", + "bar": + 2, + }, + _configuration=self._configuration + ) + + def test_second_oneof_valid_complex_passes(self): + # second oneOf valid (complex) + OneofComplexTypes._from_openapi_data( + { + "foo": + "baz", + }, + _configuration=self._configuration + ) + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/test/test_oneof_with_base_schema.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/test/test_oneof_with_base_schema.py new file mode 100644 index 000000000000..52e075c47c37 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/test/test_oneof_with_base_schema.py @@ -0,0 +1,48 @@ +# coding: utf-8 + +""" + openapi 3.0.3 sample spec + + sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501 + + The version of the OpenAPI document: 0.0.1 + Generated by: https://openapi-generator.tech +""" + +import unittest + +import unit_test_api +from unit_test_api.model.oneof_with_base_schema import OneofWithBaseSchema +from unit_test_api import configuration + + +class TestOneofWithBaseSchema(unittest.TestCase): + """OneofWithBaseSchema unit test stubs""" + _configuration = configuration.Configuration() + + def test_both_oneof_valid_fails(self): + # both oneOf valid + with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): + OneofWithBaseSchema._from_openapi_data( + "foo", + _configuration=self._configuration + ) + + def test_mismatch_base_schema_fails(self): + # mismatch base schema + with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): + OneofWithBaseSchema._from_openapi_data( + 3, + _configuration=self._configuration + ) + + def test_one_oneof_valid_passes(self): + # one oneOf valid + OneofWithBaseSchema._from_openapi_data( + "foobar", + _configuration=self._configuration + ) + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/test/test_oneof_with_empty_schema.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/test/test_oneof_with_empty_schema.py new file mode 100644 index 000000000000..66b9d79990d8 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/test/test_oneof_with_empty_schema.py @@ -0,0 +1,40 @@ +# coding: utf-8 + +""" + openapi 3.0.3 sample spec + + sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501 + + The version of the OpenAPI document: 0.0.1 + Generated by: https://openapi-generator.tech +""" + +import unittest + +import unit_test_api +from unit_test_api.model.oneof_with_empty_schema import OneofWithEmptySchema +from unit_test_api import configuration + + +class TestOneofWithEmptySchema(unittest.TestCase): + """OneofWithEmptySchema unit test stubs""" + _configuration = configuration.Configuration() + + def test_both_valid_invalid_fails(self): + # both valid - invalid + with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)): + OneofWithEmptySchema._from_openapi_data( + 123, + _configuration=self._configuration + ) + + def test_one_valid_valid_passes(self): + # one valid - valid + OneofWithEmptySchema._from_openapi_data( + "foo", + _configuration=self._configuration + ) + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/anyof.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/anyof.py new file mode 100644 index 000000000000..b1d4591b5589 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/anyof.py @@ -0,0 +1,137 @@ +# coding: utf-8 + +""" + openapi 3.0.3 sample spec + + sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501 + + The version of the OpenAPI document: 0.0.1 + Generated by: https://openapi-generator.tech +""" + +import re # noqa: F401 +import sys # noqa: F401 +import typing # noqa: F401 +import functools # noqa: F401 + +from frozendict import frozendict # noqa: F401 + +import decimal # noqa: F401 +from datetime import date, datetime # noqa: F401 +from frozendict import frozendict # noqa: F401 + +from unit_test_api.schemas import ( # noqa: F401 + AnyTypeSchema, + ComposedSchema, + DictSchema, + ListSchema, + StrSchema, + IntSchema, + Int32Schema, + Int64Schema, + Float32Schema, + Float64Schema, + NumberSchema, + UUIDSchema, + DateSchema, + DateTimeSchema, + DecimalSchema, + BoolSchema, + BinarySchema, + NoneSchema, + none_type, + Configuration, + Unset, + unset, + ComposedBase, + ListBase, + DictBase, + NoneBase, + StrBase, + IntBase, + Int32Base, + Int64Base, + Float32Base, + Float64Base, + NumberBase, + UUIDBase, + DateBase, + DateTimeBase, + BoolBase, + BinaryBase, + Schema, + NoneClass, + BoolClass, + _SchemaValidator, + _SchemaTypeChecker, + _SchemaEnumMaker +) + + +class Anyof( + ComposedSchema +): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + @classmethod + @property + @functools.cache + def _composed_schemas(cls): + # 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 + anyOf_0 = IntSchema + + + class anyOf_1( + _SchemaValidator( + inclusive_minimum=2, + ), + AnyTypeSchema + ): + + def __new__( + cls, + *args: typing.Union[dict, frozendict, str, date, datetime, int, float, decimal.Decimal, None, list, tuple, bytes], + _configuration: typing.Optional[Configuration] = None, + **kwargs: typing.Type[Schema], + ) -> 'anyOf_1': + return super().__new__( + cls, + *args, + _configuration=_configuration, + **kwargs, + ) + return { + 'allOf': [ + ], + 'oneOf': [ + ], + 'anyOf': [ + anyOf_0, + anyOf_1, + ], + 'not': + None + } + + def __new__( + cls, + *args: typing.Union[dict, frozendict, str, date, datetime, int, float, decimal.Decimal, None, list, tuple, bytes], + _configuration: typing.Optional[Configuration] = None, + **kwargs: typing.Type[Schema], + ) -> 'Anyof': + return super().__new__( + cls, + *args, + _configuration=_configuration, + **kwargs, + ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/anyof_complex_types.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/anyof_complex_types.py new file mode 100644 index 000000000000..918cb35d65c3 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/anyof_complex_types.py @@ -0,0 +1,163 @@ +# coding: utf-8 + +""" + openapi 3.0.3 sample spec + + sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501 + + The version of the OpenAPI document: 0.0.1 + Generated by: https://openapi-generator.tech +""" + +import re # noqa: F401 +import sys # noqa: F401 +import typing # noqa: F401 +import functools # noqa: F401 + +from frozendict import frozendict # noqa: F401 + +import decimal # noqa: F401 +from datetime import date, datetime # noqa: F401 +from frozendict import frozendict # noqa: F401 + +from unit_test_api.schemas import ( # noqa: F401 + AnyTypeSchema, + ComposedSchema, + DictSchema, + ListSchema, + StrSchema, + IntSchema, + Int32Schema, + Int64Schema, + Float32Schema, + Float64Schema, + NumberSchema, + UUIDSchema, + DateSchema, + DateTimeSchema, + DecimalSchema, + BoolSchema, + BinarySchema, + NoneSchema, + none_type, + Configuration, + Unset, + unset, + ComposedBase, + ListBase, + DictBase, + NoneBase, + StrBase, + IntBase, + Int32Base, + Int64Base, + Float32Base, + Float64Base, + NumberBase, + UUIDBase, + DateBase, + DateTimeBase, + BoolBase, + BinaryBase, + Schema, + NoneClass, + BoolClass, + _SchemaValidator, + _SchemaTypeChecker, + _SchemaEnumMaker +) + + +class AnyofComplexTypes( + ComposedSchema +): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + @classmethod + @property + @functools.cache + def _composed_schemas(cls): + # 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 + + + class anyOf_0( + AnyTypeSchema + ): + _required_property_names = set(( + 'bar', + )) + bar = IntSchema + + def __new__( + cls, + *args: typing.Union[dict, frozendict, str, date, datetime, int, float, decimal.Decimal, None, list, tuple, bytes], + bar: bar, + _configuration: typing.Optional[Configuration] = None, + **kwargs: typing.Type[Schema], + ) -> 'anyOf_0': + return super().__new__( + cls, + *args, + bar=bar, + _configuration=_configuration, + **kwargs, + ) + + + class anyOf_1( + AnyTypeSchema + ): + _required_property_names = set(( + 'foo', + )) + foo = StrSchema + + def __new__( + cls, + *args: typing.Union[dict, frozendict, str, date, datetime, int, float, decimal.Decimal, None, list, tuple, bytes], + foo: foo, + _configuration: typing.Optional[Configuration] = None, + **kwargs: typing.Type[Schema], + ) -> 'anyOf_1': + return super().__new__( + cls, + *args, + foo=foo, + _configuration=_configuration, + **kwargs, + ) + return { + 'allOf': [ + ], + 'oneOf': [ + ], + 'anyOf': [ + anyOf_0, + anyOf_1, + ], + 'not': + None + } + + def __new__( + cls, + *args: typing.Union[dict, frozendict, str, date, datetime, int, float, decimal.Decimal, None, list, tuple, bytes], + _configuration: typing.Optional[Configuration] = None, + **kwargs: typing.Type[Schema], + ) -> 'AnyofComplexTypes': + return super().__new__( + cls, + *args, + _configuration=_configuration, + **kwargs, + ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/anyof_with_base_schema.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/anyof_with_base_schema.py new file mode 100644 index 000000000000..48f7374cb292 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/anyof_with_base_schema.py @@ -0,0 +1,156 @@ +# coding: utf-8 + +""" + openapi 3.0.3 sample spec + + sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501 + + The version of the OpenAPI document: 0.0.1 + Generated by: https://openapi-generator.tech +""" + +import re # noqa: F401 +import sys # noqa: F401 +import typing # noqa: F401 +import functools # noqa: F401 + +from frozendict import frozendict # noqa: F401 + +import decimal # noqa: F401 +from datetime import date, datetime # noqa: F401 +from frozendict import frozendict # noqa: F401 + +from unit_test_api.schemas import ( # noqa: F401 + AnyTypeSchema, + ComposedSchema, + DictSchema, + ListSchema, + StrSchema, + IntSchema, + Int32Schema, + Int64Schema, + Float32Schema, + Float64Schema, + NumberSchema, + UUIDSchema, + DateSchema, + DateTimeSchema, + DecimalSchema, + BoolSchema, + BinarySchema, + NoneSchema, + none_type, + Configuration, + Unset, + unset, + ComposedBase, + ListBase, + DictBase, + NoneBase, + StrBase, + IntBase, + Int32Base, + Int64Base, + Float32Base, + Float64Base, + NumberBase, + UUIDBase, + DateBase, + DateTimeBase, + BoolBase, + BinaryBase, + Schema, + NoneClass, + BoolClass, + _SchemaValidator, + _SchemaTypeChecker, + _SchemaEnumMaker +) + + +class AnyofWithBaseSchema( + ComposedBase, + StrSchema +): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + @classmethod + @property + @functools.cache + def _composed_schemas(cls): + # 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 + + + class anyOf_0( + _SchemaValidator( + max_length=2, + ), + AnyTypeSchema + ): + + def __new__( + cls, + *args: typing.Union[dict, frozendict, str, date, datetime, int, float, decimal.Decimal, None, list, tuple, bytes], + _configuration: typing.Optional[Configuration] = None, + **kwargs: typing.Type[Schema], + ) -> 'anyOf_0': + return super().__new__( + cls, + *args, + _configuration=_configuration, + **kwargs, + ) + + + class anyOf_1( + _SchemaValidator( + min_length=4, + ), + AnyTypeSchema + ): + + def __new__( + cls, + *args: typing.Union[dict, frozendict, str, date, datetime, int, float, decimal.Decimal, None, list, tuple, bytes], + _configuration: typing.Optional[Configuration] = None, + **kwargs: typing.Type[Schema], + ) -> 'anyOf_1': + return super().__new__( + cls, + *args, + _configuration=_configuration, + **kwargs, + ) + return { + 'allOf': [ + ], + 'oneOf': [ + ], + 'anyOf': [ + anyOf_0, + anyOf_1, + ], + 'not': + None + } + + def __new__( + cls, + *args: typing.Union[str, ], + _configuration: typing.Optional[Configuration] = None, + ) -> 'AnyofWithBaseSchema': + return super().__new__( + cls, + *args, + _configuration=_configuration, + ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/anyof_with_one_empty_schema.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/anyof_with_one_empty_schema.py new file mode 100644 index 000000000000..ba318600bd41 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/anyof_with_one_empty_schema.py @@ -0,0 +1,117 @@ +# coding: utf-8 + +""" + openapi 3.0.3 sample spec + + sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501 + + The version of the OpenAPI document: 0.0.1 + Generated by: https://openapi-generator.tech +""" + +import re # noqa: F401 +import sys # noqa: F401 +import typing # noqa: F401 +import functools # noqa: F401 + +from frozendict import frozendict # noqa: F401 + +import decimal # noqa: F401 +from datetime import date, datetime # noqa: F401 +from frozendict import frozendict # noqa: F401 + +from unit_test_api.schemas import ( # noqa: F401 + AnyTypeSchema, + ComposedSchema, + DictSchema, + ListSchema, + StrSchema, + IntSchema, + Int32Schema, + Int64Schema, + Float32Schema, + Float64Schema, + NumberSchema, + UUIDSchema, + DateSchema, + DateTimeSchema, + DecimalSchema, + BoolSchema, + BinarySchema, + NoneSchema, + none_type, + Configuration, + Unset, + unset, + ComposedBase, + ListBase, + DictBase, + NoneBase, + StrBase, + IntBase, + Int32Base, + Int64Base, + Float32Base, + Float64Base, + NumberBase, + UUIDBase, + DateBase, + DateTimeBase, + BoolBase, + BinaryBase, + Schema, + NoneClass, + BoolClass, + _SchemaValidator, + _SchemaTypeChecker, + _SchemaEnumMaker +) + + +class AnyofWithOneEmptySchema( + ComposedSchema +): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + @classmethod + @property + @functools.cache + def _composed_schemas(cls): + # 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 + anyOf_0 = NumberSchema + anyOf_1 = AnyTypeSchema + return { + 'allOf': [ + ], + 'oneOf': [ + ], + 'anyOf': [ + anyOf_0, + anyOf_1, + ], + 'not': + None + } + + def __new__( + cls, + *args: typing.Union[dict, frozendict, str, date, datetime, int, float, decimal.Decimal, None, list, tuple, bytes], + _configuration: typing.Optional[Configuration] = None, + **kwargs: typing.Type[Schema], + ) -> 'AnyofWithOneEmptySchema': + return super().__new__( + cls, + *args, + _configuration=_configuration, + **kwargs, + ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/nested_anyof_to_check_validation_semantics.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/nested_anyof_to_check_validation_semantics.py new file mode 100644 index 000000000000..6c01a59bcc85 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/nested_anyof_to_check_validation_semantics.py @@ -0,0 +1,156 @@ +# coding: utf-8 + +""" + openapi 3.0.3 sample spec + + sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501 + + The version of the OpenAPI document: 0.0.1 + Generated by: https://openapi-generator.tech +""" + +import re # noqa: F401 +import sys # noqa: F401 +import typing # noqa: F401 +import functools # noqa: F401 + +from frozendict import frozendict # noqa: F401 + +import decimal # noqa: F401 +from datetime import date, datetime # noqa: F401 +from frozendict import frozendict # noqa: F401 + +from unit_test_api.schemas import ( # noqa: F401 + AnyTypeSchema, + ComposedSchema, + DictSchema, + ListSchema, + StrSchema, + IntSchema, + Int32Schema, + Int64Schema, + Float32Schema, + Float64Schema, + NumberSchema, + UUIDSchema, + DateSchema, + DateTimeSchema, + DecimalSchema, + BoolSchema, + BinarySchema, + NoneSchema, + none_type, + Configuration, + Unset, + unset, + ComposedBase, + ListBase, + DictBase, + NoneBase, + StrBase, + IntBase, + Int32Base, + Int64Base, + Float32Base, + Float64Base, + NumberBase, + UUIDBase, + DateBase, + DateTimeBase, + BoolBase, + BinaryBase, + Schema, + NoneClass, + BoolClass, + _SchemaValidator, + _SchemaTypeChecker, + _SchemaEnumMaker +) + + +class NestedAnyofToCheckValidationSemantics( + ComposedSchema +): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + @classmethod + @property + @functools.cache + def _composed_schemas(cls): + # 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 + + + class anyOf_0( + ComposedSchema + ): + + @classmethod + @property + @functools.cache + def _composed_schemas(cls): + # 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 + anyOf_0 = NoneSchema + return { + 'allOf': [ + ], + 'oneOf': [ + ], + 'anyOf': [ + anyOf_0, + ], + 'not': + None + } + + def __new__( + cls, + *args: typing.Union[dict, frozendict, str, date, datetime, int, float, decimal.Decimal, None, list, tuple, bytes], + _configuration: typing.Optional[Configuration] = None, + **kwargs: typing.Type[Schema], + ) -> 'anyOf_0': + return super().__new__( + cls, + *args, + _configuration=_configuration, + **kwargs, + ) + return { + 'allOf': [ + ], + 'oneOf': [ + ], + 'anyOf': [ + anyOf_0, + ], + 'not': + None + } + + def __new__( + cls, + *args: typing.Union[dict, frozendict, str, date, datetime, int, float, decimal.Decimal, None, list, tuple, bytes], + _configuration: typing.Optional[Configuration] = None, + **kwargs: typing.Type[Schema], + ) -> 'NestedAnyofToCheckValidationSemantics': + return super().__new__( + cls, + *args, + _configuration=_configuration, + **kwargs, + ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/nested_oneof_to_check_validation_semantics.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/nested_oneof_to_check_validation_semantics.py new file mode 100644 index 000000000000..4f7280c4e027 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/nested_oneof_to_check_validation_semantics.py @@ -0,0 +1,156 @@ +# coding: utf-8 + +""" + openapi 3.0.3 sample spec + + sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501 + + The version of the OpenAPI document: 0.0.1 + Generated by: https://openapi-generator.tech +""" + +import re # noqa: F401 +import sys # noqa: F401 +import typing # noqa: F401 +import functools # noqa: F401 + +from frozendict import frozendict # noqa: F401 + +import decimal # noqa: F401 +from datetime import date, datetime # noqa: F401 +from frozendict import frozendict # noqa: F401 + +from unit_test_api.schemas import ( # noqa: F401 + AnyTypeSchema, + ComposedSchema, + DictSchema, + ListSchema, + StrSchema, + IntSchema, + Int32Schema, + Int64Schema, + Float32Schema, + Float64Schema, + NumberSchema, + UUIDSchema, + DateSchema, + DateTimeSchema, + DecimalSchema, + BoolSchema, + BinarySchema, + NoneSchema, + none_type, + Configuration, + Unset, + unset, + ComposedBase, + ListBase, + DictBase, + NoneBase, + StrBase, + IntBase, + Int32Base, + Int64Base, + Float32Base, + Float64Base, + NumberBase, + UUIDBase, + DateBase, + DateTimeBase, + BoolBase, + BinaryBase, + Schema, + NoneClass, + BoolClass, + _SchemaValidator, + _SchemaTypeChecker, + _SchemaEnumMaker +) + + +class NestedOneofToCheckValidationSemantics( + ComposedSchema +): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + @classmethod + @property + @functools.cache + def _composed_schemas(cls): + # 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 + + + class oneOf_0( + ComposedSchema + ): + + @classmethod + @property + @functools.cache + def _composed_schemas(cls): + # 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 + oneOf_0 = NoneSchema + return { + 'allOf': [ + ], + 'oneOf': [ + oneOf_0, + ], + 'anyOf': [ + ], + 'not': + None + } + + def __new__( + cls, + *args: typing.Union[dict, frozendict, str, date, datetime, int, float, decimal.Decimal, None, list, tuple, bytes], + _configuration: typing.Optional[Configuration] = None, + **kwargs: typing.Type[Schema], + ) -> 'oneOf_0': + return super().__new__( + cls, + *args, + _configuration=_configuration, + **kwargs, + ) + return { + 'allOf': [ + ], + 'oneOf': [ + oneOf_0, + ], + 'anyOf': [ + ], + 'not': + None + } + + def __new__( + cls, + *args: typing.Union[dict, frozendict, str, date, datetime, int, float, decimal.Decimal, None, list, tuple, bytes], + _configuration: typing.Optional[Configuration] = None, + **kwargs: typing.Type[Schema], + ) -> 'NestedOneofToCheckValidationSemantics': + return super().__new__( + cls, + *args, + _configuration=_configuration, + **kwargs, + ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/oneof.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/oneof.py new file mode 100644 index 000000000000..70eb394c437f --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/oneof.py @@ -0,0 +1,137 @@ +# coding: utf-8 + +""" + openapi 3.0.3 sample spec + + sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501 + + The version of the OpenAPI document: 0.0.1 + Generated by: https://openapi-generator.tech +""" + +import re # noqa: F401 +import sys # noqa: F401 +import typing # noqa: F401 +import functools # noqa: F401 + +from frozendict import frozendict # noqa: F401 + +import decimal # noqa: F401 +from datetime import date, datetime # noqa: F401 +from frozendict import frozendict # noqa: F401 + +from unit_test_api.schemas import ( # noqa: F401 + AnyTypeSchema, + ComposedSchema, + DictSchema, + ListSchema, + StrSchema, + IntSchema, + Int32Schema, + Int64Schema, + Float32Schema, + Float64Schema, + NumberSchema, + UUIDSchema, + DateSchema, + DateTimeSchema, + DecimalSchema, + BoolSchema, + BinarySchema, + NoneSchema, + none_type, + Configuration, + Unset, + unset, + ComposedBase, + ListBase, + DictBase, + NoneBase, + StrBase, + IntBase, + Int32Base, + Int64Base, + Float32Base, + Float64Base, + NumberBase, + UUIDBase, + DateBase, + DateTimeBase, + BoolBase, + BinaryBase, + Schema, + NoneClass, + BoolClass, + _SchemaValidator, + _SchemaTypeChecker, + _SchemaEnumMaker +) + + +class Oneof( + ComposedSchema +): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + @classmethod + @property + @functools.cache + def _composed_schemas(cls): + # 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 + oneOf_0 = IntSchema + + + class oneOf_1( + _SchemaValidator( + inclusive_minimum=2, + ), + AnyTypeSchema + ): + + def __new__( + cls, + *args: typing.Union[dict, frozendict, str, date, datetime, int, float, decimal.Decimal, None, list, tuple, bytes], + _configuration: typing.Optional[Configuration] = None, + **kwargs: typing.Type[Schema], + ) -> 'oneOf_1': + return super().__new__( + cls, + *args, + _configuration=_configuration, + **kwargs, + ) + return { + 'allOf': [ + ], + 'oneOf': [ + oneOf_0, + oneOf_1, + ], + 'anyOf': [ + ], + 'not': + None + } + + def __new__( + cls, + *args: typing.Union[dict, frozendict, str, date, datetime, int, float, decimal.Decimal, None, list, tuple, bytes], + _configuration: typing.Optional[Configuration] = None, + **kwargs: typing.Type[Schema], + ) -> 'Oneof': + return super().__new__( + cls, + *args, + _configuration=_configuration, + **kwargs, + ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/oneof_complex_types.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/oneof_complex_types.py new file mode 100644 index 000000000000..e3c9861ad492 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/oneof_complex_types.py @@ -0,0 +1,163 @@ +# coding: utf-8 + +""" + openapi 3.0.3 sample spec + + sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501 + + The version of the OpenAPI document: 0.0.1 + Generated by: https://openapi-generator.tech +""" + +import re # noqa: F401 +import sys # noqa: F401 +import typing # noqa: F401 +import functools # noqa: F401 + +from frozendict import frozendict # noqa: F401 + +import decimal # noqa: F401 +from datetime import date, datetime # noqa: F401 +from frozendict import frozendict # noqa: F401 + +from unit_test_api.schemas import ( # noqa: F401 + AnyTypeSchema, + ComposedSchema, + DictSchema, + ListSchema, + StrSchema, + IntSchema, + Int32Schema, + Int64Schema, + Float32Schema, + Float64Schema, + NumberSchema, + UUIDSchema, + DateSchema, + DateTimeSchema, + DecimalSchema, + BoolSchema, + BinarySchema, + NoneSchema, + none_type, + Configuration, + Unset, + unset, + ComposedBase, + ListBase, + DictBase, + NoneBase, + StrBase, + IntBase, + Int32Base, + Int64Base, + Float32Base, + Float64Base, + NumberBase, + UUIDBase, + DateBase, + DateTimeBase, + BoolBase, + BinaryBase, + Schema, + NoneClass, + BoolClass, + _SchemaValidator, + _SchemaTypeChecker, + _SchemaEnumMaker +) + + +class OneofComplexTypes( + ComposedSchema +): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + @classmethod + @property + @functools.cache + def _composed_schemas(cls): + # 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 + + + class oneOf_0( + AnyTypeSchema + ): + _required_property_names = set(( + 'bar', + )) + bar = IntSchema + + def __new__( + cls, + *args: typing.Union[dict, frozendict, str, date, datetime, int, float, decimal.Decimal, None, list, tuple, bytes], + bar: bar, + _configuration: typing.Optional[Configuration] = None, + **kwargs: typing.Type[Schema], + ) -> 'oneOf_0': + return super().__new__( + cls, + *args, + bar=bar, + _configuration=_configuration, + **kwargs, + ) + + + class oneOf_1( + AnyTypeSchema + ): + _required_property_names = set(( + 'foo', + )) + foo = StrSchema + + def __new__( + cls, + *args: typing.Union[dict, frozendict, str, date, datetime, int, float, decimal.Decimal, None, list, tuple, bytes], + foo: foo, + _configuration: typing.Optional[Configuration] = None, + **kwargs: typing.Type[Schema], + ) -> 'oneOf_1': + return super().__new__( + cls, + *args, + foo=foo, + _configuration=_configuration, + **kwargs, + ) + return { + 'allOf': [ + ], + 'oneOf': [ + oneOf_0, + oneOf_1, + ], + 'anyOf': [ + ], + 'not': + None + } + + def __new__( + cls, + *args: typing.Union[dict, frozendict, str, date, datetime, int, float, decimal.Decimal, None, list, tuple, bytes], + _configuration: typing.Optional[Configuration] = None, + **kwargs: typing.Type[Schema], + ) -> 'OneofComplexTypes': + return super().__new__( + cls, + *args, + _configuration=_configuration, + **kwargs, + ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/oneof_with_base_schema.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/oneof_with_base_schema.py new file mode 100644 index 000000000000..09bf4d2d52b0 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/oneof_with_base_schema.py @@ -0,0 +1,156 @@ +# coding: utf-8 + +""" + openapi 3.0.3 sample spec + + sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501 + + The version of the OpenAPI document: 0.0.1 + Generated by: https://openapi-generator.tech +""" + +import re # noqa: F401 +import sys # noqa: F401 +import typing # noqa: F401 +import functools # noqa: F401 + +from frozendict import frozendict # noqa: F401 + +import decimal # noqa: F401 +from datetime import date, datetime # noqa: F401 +from frozendict import frozendict # noqa: F401 + +from unit_test_api.schemas import ( # noqa: F401 + AnyTypeSchema, + ComposedSchema, + DictSchema, + ListSchema, + StrSchema, + IntSchema, + Int32Schema, + Int64Schema, + Float32Schema, + Float64Schema, + NumberSchema, + UUIDSchema, + DateSchema, + DateTimeSchema, + DecimalSchema, + BoolSchema, + BinarySchema, + NoneSchema, + none_type, + Configuration, + Unset, + unset, + ComposedBase, + ListBase, + DictBase, + NoneBase, + StrBase, + IntBase, + Int32Base, + Int64Base, + Float32Base, + Float64Base, + NumberBase, + UUIDBase, + DateBase, + DateTimeBase, + BoolBase, + BinaryBase, + Schema, + NoneClass, + BoolClass, + _SchemaValidator, + _SchemaTypeChecker, + _SchemaEnumMaker +) + + +class OneofWithBaseSchema( + ComposedBase, + StrSchema +): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + @classmethod + @property + @functools.cache + def _composed_schemas(cls): + # 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 + + + class oneOf_0( + _SchemaValidator( + min_length=2, + ), + AnyTypeSchema + ): + + def __new__( + cls, + *args: typing.Union[dict, frozendict, str, date, datetime, int, float, decimal.Decimal, None, list, tuple, bytes], + _configuration: typing.Optional[Configuration] = None, + **kwargs: typing.Type[Schema], + ) -> 'oneOf_0': + return super().__new__( + cls, + *args, + _configuration=_configuration, + **kwargs, + ) + + + class oneOf_1( + _SchemaValidator( + max_length=4, + ), + AnyTypeSchema + ): + + def __new__( + cls, + *args: typing.Union[dict, frozendict, str, date, datetime, int, float, decimal.Decimal, None, list, tuple, bytes], + _configuration: typing.Optional[Configuration] = None, + **kwargs: typing.Type[Schema], + ) -> 'oneOf_1': + return super().__new__( + cls, + *args, + _configuration=_configuration, + **kwargs, + ) + return { + 'allOf': [ + ], + 'oneOf': [ + oneOf_0, + oneOf_1, + ], + 'anyOf': [ + ], + 'not': + None + } + + def __new__( + cls, + *args: typing.Union[str, ], + _configuration: typing.Optional[Configuration] = None, + ) -> 'OneofWithBaseSchema': + return super().__new__( + cls, + *args, + _configuration=_configuration, + ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/oneof_with_empty_schema.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/oneof_with_empty_schema.py new file mode 100644 index 000000000000..1ccdc627c949 --- /dev/null +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/model/oneof_with_empty_schema.py @@ -0,0 +1,117 @@ +# coding: utf-8 + +""" + openapi 3.0.3 sample spec + + sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501 + + The version of the OpenAPI document: 0.0.1 + Generated by: https://openapi-generator.tech +""" + +import re # noqa: F401 +import sys # noqa: F401 +import typing # noqa: F401 +import functools # noqa: F401 + +from frozendict import frozendict # noqa: F401 + +import decimal # noqa: F401 +from datetime import date, datetime # noqa: F401 +from frozendict import frozendict # noqa: F401 + +from unit_test_api.schemas import ( # noqa: F401 + AnyTypeSchema, + ComposedSchema, + DictSchema, + ListSchema, + StrSchema, + IntSchema, + Int32Schema, + Int64Schema, + Float32Schema, + Float64Schema, + NumberSchema, + UUIDSchema, + DateSchema, + DateTimeSchema, + DecimalSchema, + BoolSchema, + BinarySchema, + NoneSchema, + none_type, + Configuration, + Unset, + unset, + ComposedBase, + ListBase, + DictBase, + NoneBase, + StrBase, + IntBase, + Int32Base, + Int64Base, + Float32Base, + Float64Base, + NumberBase, + UUIDBase, + DateBase, + DateTimeBase, + BoolBase, + BinaryBase, + Schema, + NoneClass, + BoolClass, + _SchemaValidator, + _SchemaTypeChecker, + _SchemaEnumMaker +) + + +class OneofWithEmptySchema( + ComposedSchema +): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + @classmethod + @property + @functools.cache + def _composed_schemas(cls): + # 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 + oneOf_0 = NumberSchema + oneOf_1 = AnyTypeSchema + return { + 'allOf': [ + ], + 'oneOf': [ + oneOf_0, + oneOf_1, + ], + 'anyOf': [ + ], + 'not': + None + } + + def __new__( + cls, + *args: typing.Union[dict, frozendict, str, date, datetime, int, float, decimal.Decimal, None, list, tuple, bytes], + _configuration: typing.Optional[Configuration] = None, + **kwargs: typing.Type[Schema], + ) -> 'OneofWithEmptySchema': + return super().__new__( + cls, + *args, + _configuration=_configuration, + **kwargs, + ) diff --git a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/models/__init__.py b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/models/__init__.py index 1761a63a98a1..c794f6ca0942 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/models/__init__.py +++ b/samples/openapi3/client/3_0_3_unit_test/python-experimental/unit_test_api/models/__init__.py @@ -23,6 +23,10 @@ from unit_test_api.model.allof_with_one_empty_schema import AllofWithOneEmptySch from unit_test_api.model.allof_with_the_first_empty_schema import AllofWithTheFirstEmptySchema from unit_test_api.model.allof_with_the_last_empty_schema import AllofWithTheLastEmptySchema from unit_test_api.model.allof_with_two_empty_schemas import AllofWithTwoEmptySchemas +from unit_test_api.model.anyof import Anyof +from unit_test_api.model.anyof_complex_types import AnyofComplexTypes +from unit_test_api.model.anyof_with_base_schema import AnyofWithBaseSchema +from unit_test_api.model.anyof_with_one_empty_schema import AnyofWithOneEmptySchema from unit_test_api.model.array_type_matches_arrays import ArrayTypeMatchesArrays from unit_test_api.model.boolean_type_matches_booleans import BooleanTypeMatchesBooleans from unit_test_api.model.by_int import ByInt @@ -57,12 +61,18 @@ from unit_test_api.model.minlength_validation import MinlengthValidation from unit_test_api.model.minproperties_validation import MinpropertiesValidation from unit_test_api.model.model_not import ModelNot from unit_test_api.model.nested_allof_to_check_validation_semantics import NestedAllofToCheckValidationSemantics +from unit_test_api.model.nested_anyof_to_check_validation_semantics import NestedAnyofToCheckValidationSemantics from unit_test_api.model.nested_items import NestedItems +from unit_test_api.model.nested_oneof_to_check_validation_semantics import NestedOneofToCheckValidationSemantics from unit_test_api.model.not_more_complex_schema import NotMoreComplexSchema from unit_test_api.model.nul_characters_in_strings import NulCharactersInStrings from unit_test_api.model.null_type_matches_only_the_null_object import NullTypeMatchesOnlyTheNullObject from unit_test_api.model.number_type_matches_numbers import NumberTypeMatchesNumbers from unit_test_api.model.object_properties_validation import ObjectPropertiesValidation +from unit_test_api.model.oneof import Oneof +from unit_test_api.model.oneof_complex_types import OneofComplexTypes +from unit_test_api.model.oneof_with_base_schema import OneofWithBaseSchema +from unit_test_api.model.oneof_with_empty_schema import OneofWithEmptySchema from unit_test_api.model.pattern_is_not_anchored import PatternIsNotAnchored from unit_test_api.model.pattern_validation import PatternValidation from unit_test_api.model.properties_with_escaped_characters import PropertiesWithEscapedCharacters