Skip to content
This repository was archived by the owner on Dec 25, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/generators/java.md
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|Required|✓|OAS2,OAS3
|Type|✓|OAS2,OAS3
|UnevaluatedItems|✗|OAS3
|UnevaluatedProperties|✗|OAS3
|UniqueItems|✓|OAS2,OAS3
|Xml|✗|OAS2,OAS3

Expand Down
1 change: 1 addition & 0 deletions docs/generators/jaxrs-jersey.md
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|Required|✓|OAS2,OAS3
|Type|✓|OAS2,OAS3
|UnevaluatedItems|✗|OAS3
|UnevaluatedProperties|✗|OAS3
|UniqueItems|✓|OAS2,OAS3
|Xml|✗|OAS2,OAS3

Expand Down
1 change: 1 addition & 0 deletions docs/generators/jmeter.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|Required|✓|OAS2,OAS3
|Type|✓|OAS2,OAS3
|UnevaluatedItems|✗|OAS3
|UnevaluatedProperties|✗|OAS3
|UniqueItems|✓|OAS2,OAS3
|Xml|✗|OAS2,OAS3

Expand Down
1 change: 1 addition & 0 deletions docs/generators/kotlin.md
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|Required|✓|OAS2,OAS3
|Type|✓|OAS2,OAS3
|UnevaluatedItems|✗|OAS3
|UnevaluatedProperties|✗|OAS3
|UniqueItems|✓|OAS2,OAS3
|Xml|✗|OAS2,OAS3

Expand Down
1 change: 1 addition & 0 deletions docs/generators/python.md
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|Required|✓|OAS2,OAS3
|Type|✓|OAS2,OAS3
|UnevaluatedItems|✓|OAS3
|UnevaluatedProperties|✓|OAS3
|UniqueItems|✓|OAS2,OAS3
|Xml|✗|OAS2,OAS3

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@
'required': 'required',
'types': 'type',
'unique_items': 'uniqueItems',
'unevaluated_items': 'unevaluatedItems'
'unevaluated_items': 'unevaluatedItems',
'unevaluated_properties': 'unevaluatedProperties'
}

class SchemaConfiguration:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def _validate(
used_val = (val, contains_qty)
elif keyword == 'items':
used_val = (val, prefix_items_length)
elif keyword == 'unevaluated_items':
elif keyword in {'unevaluated_items', 'unevaluated_properties'}:
used_val = (val, path_to_schemas)
else:
used_val = val
Expand Down Expand Up @@ -1217,6 +1217,32 @@ def validate_unevaluated_items(
return path_to_schemas


def validate_unevaluated_properties(
arg: typing.Any,
unevaluated_properties_validated_path_to_schemas: typing.Tuple[typing.Type[SchemaValidator], PathToSchemasType],
cls: typing.Type,
validation_metadata: ValidationMetadata,
) -> typing.Optional[PathToSchemasType]:
if not isinstance(arg, immutabledict):
return None
path_to_schemas: PathToSchemasType = {}
module_namespace = vars(sys.modules[cls.__module__])
schema = _get_class(unevaluated_properties_validated_path_to_schemas[0], module_namespace)
validated_path_to_schemas = unevaluated_properties_validated_path_to_schemas[1]
for property_name, val in arg.items():
path_to_item = validation_metadata.path_to_item + (property_name,)
if path_to_item in validated_path_to_schemas:
continue
property_validation_metadata = ValidationMetadata(
path_to_item=path_to_item,
configuration=validation_metadata.configuration,
validated_path_to_schemas=validation_metadata.validated_path_to_schemas
)
other_path_to_schemas = schema._validate(val, validation_metadata=property_validation_metadata)
update(path_to_schemas, other_path_to_schemas)
return path_to_schemas


validator_type = typing.Callable[[typing.Any, typing.Any, type, ValidationMetadata], typing.Optional[PathToSchemasType]]
json_schema_keyword_to_validator: typing.Mapping[str, validator_type] = {
'types': validate_types,
Expand Down Expand Up @@ -1253,5 +1279,6 @@ def validate_unevaluated_items(
'property_names': validate_property_names,
'pattern_properties': validate_pattern_properties,
'prefix_items': validate_prefix_items,
'unevaluated_items': validate_unevaluated_items
'unevaluated_items': validate_unevaluated_items,
'unevaluated_properties': validate_unevaluated_properties
}
12 changes: 12 additions & 0 deletions samples/client/3_1_0_json_schema/python/.openapi-generator/FILES
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,20 @@ docs/components/schema/any_type_unevaluated_items_false.md
docs/components/schema/any_type_unevaluated_items_false_with_prefix_items.md
docs/components/schema/any_type_unevaluated_items_string.md
docs/components/schema/any_type_unevaluated_items_true.md
docs/components/schema/any_type_unevaluated_properties_false.md
docs/components/schema/any_type_unevaluated_properties_false_with_properties.md
docs/components/schema/any_type_unevaluated_properties_string.md
docs/components/schema/any_type_unevaluated_properties_true.md
docs/components/schema/array_contains_value.md
docs/components/schema/array_max_contains_value.md
docs/components/schema/array_min_contains_value.md
docs/components/schema/array_prefix_items.md
docs/components/schema/array_unevaluated_items_false_with_prefix_items.md
docs/components/schema/object_dependent_required.md
docs/components/schema/object_dependent_schemas.md
docs/components/schema/object_pattern_properties.md
docs/components/schema/object_property_names.md
docs/components/schema/object_unevaluated_properties_false_with_properties.md
docs/components/schema/string_const_string.md
docs/paths/some_path/get.md
docs/paths/some_path/get/responses/response_200/content/application_json/schema.md
Expand Down Expand Up @@ -58,14 +64,20 @@ src/json_schema_api/components/schema/any_type_unevaluated_items_false.py
src/json_schema_api/components/schema/any_type_unevaluated_items_false_with_prefix_items.py
src/json_schema_api/components/schema/any_type_unevaluated_items_string.py
src/json_schema_api/components/schema/any_type_unevaluated_items_true.py
src/json_schema_api/components/schema/any_type_unevaluated_properties_false.py
src/json_schema_api/components/schema/any_type_unevaluated_properties_false_with_properties.py
src/json_schema_api/components/schema/any_type_unevaluated_properties_string.py
src/json_schema_api/components/schema/any_type_unevaluated_properties_true.py
src/json_schema_api/components/schema/array_contains_value.py
src/json_schema_api/components/schema/array_max_contains_value.py
src/json_schema_api/components/schema/array_min_contains_value.py
src/json_schema_api/components/schema/array_prefix_items.py
src/json_schema_api/components/schema/array_unevaluated_items_false_with_prefix_items.py
src/json_schema_api/components/schema/object_dependent_required.py
src/json_schema_api/components/schema/object_dependent_schemas.py
src/json_schema_api/components/schema/object_pattern_properties.py
src/json_schema_api/components/schema/object_property_names.py
src/json_schema_api/components/schema/object_unevaluated_properties_false_with_properties.py
src/json_schema_api/components/schema/string_const_string.py
src/json_schema_api/components/schemas/__init__.py
src/json_schema_api/configurations/__init__.py
Expand Down
6 changes: 6 additions & 0 deletions samples/client/3_1_0_json_schema/python/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,14 +186,20 @@ Class | Description
[AnyTypeUnevaluatedItemsFalseWithPrefixItems](docs/components/schema/any_type_unevaluated_items_false_with_prefix_items.md) |
[AnyTypeUnevaluatedItemsString](docs/components/schema/any_type_unevaluated_items_string.md) |
[AnyTypeUnevaluatedItemsTrue](docs/components/schema/any_type_unevaluated_items_true.md) |
[AnyTypeUnevaluatedPropertiesFalse](docs/components/schema/any_type_unevaluated_properties_false.md) |
[AnyTypeUnevaluatedPropertiesFalseWithProperties](docs/components/schema/any_type_unevaluated_properties_false_with_properties.md) |
[AnyTypeUnevaluatedPropertiesString](docs/components/schema/any_type_unevaluated_properties_string.md) |
[AnyTypeUnevaluatedPropertiesTrue](docs/components/schema/any_type_unevaluated_properties_true.md) |
[ArrayContainsValue](docs/components/schema/array_contains_value.md) |
[ArrayMaxContainsValue](docs/components/schema/array_max_contains_value.md) |
[ArrayMinContainsValue](docs/components/schema/array_min_contains_value.md) |
[ArrayPrefixItems](docs/components/schema/array_prefix_items.md) |
[ArrayUnevaluatedItemsFalseWithPrefixItems](docs/components/schema/array_unevaluated_items_false_with_prefix_items.md) |
[ObjectDependentRequired](docs/components/schema/object_dependent_required.md) |
[ObjectDependentSchemas](docs/components/schema/object_dependent_schemas.md) |
[ObjectPatternProperties](docs/components/schema/object_pattern_properties.md) |
[ObjectPropertyNames](docs/components/schema/object_property_names.md) |
[ObjectUnevaluatedPropertiesFalseWithProperties](docs/components/schema/object_unevaluated_properties_false_with_properties.md) |
[StringConstString](docs/components/schema/string_const_string.md) |

## Notes for Large OpenAPI documents
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# AnyTypeUnevaluatedPropertiesFalse
json_schema_api.components.schema.any_type_unevaluated_properties_false
```
type: schemas.Schema
```

## validate method
Input Type | Return Type | Notes
------------ | ------------- | -------------
dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO |

[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md)
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# AnyTypeUnevaluatedPropertiesFalseWithProperties
json_schema_api.components.schema.any_type_unevaluated_properties_false_with_properties
```
type: schemas.Schema
```

## validate method
Input Type | Return Type | Notes
------------ | ------------- | -------------
[AnyTypeUnevaluatedPropertiesFalseWithPropertiesDictInput](#anytypeunevaluatedpropertiesfalsewithpropertiesdictinput), [AnyTypeUnevaluatedPropertiesFalseWithPropertiesDict](#anytypeunevaluatedpropertiesfalsewithpropertiesdict), str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | [AnyTypeUnevaluatedPropertiesFalseWithPropertiesDict](#anytypeunevaluatedpropertiesfalsewithpropertiesdict), str, float, int, bool, None, tuple, bytes, io.FileIO |

## AnyTypeUnevaluatedPropertiesFalseWithPropertiesDictInput
```
type: typing.Mapping[str, schemas.INPUT_TYPES_ALL]
```
Key | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**someProp** | str | | [optional]
**any_string_name** | dict, schemas.immutabledict, list, tuple, decimal.Decimal, float, int, str, datetime.date, datetime.datetime, uuid.UUID, bool, None, bytes, io.FileIO, io.BufferedReader, schemas.FileIO | any string name can be used but the value must be the correct type | [optional]

## AnyTypeUnevaluatedPropertiesFalseWithPropertiesDict
```
base class: schemas.immutabledict[str, str]

```
### __new__ method
Keyword Argument | Type | Description | Notes
---------------- | ---- | ----------- | -----
**someProp** | str, schemas.Unset | | [optional]
**kwargs** | schemas.immutabledict, tuple, float, int, str, bool, None, bytes, schemas.FileIO | any string name can be used but the value must be the correct type | [optional] typed value is accessed with the get_additional_property_ method

### properties
Property | Type | Description | Notes
-------- | ---- | ----------- | -----
**someProp** | str, schemas.Unset | | [optional]

### methods
Method | Input Type | Return Type | Notes
------ | ---------- | ----------- | ------
from_dict_ | [AnyTypeUnevaluatedPropertiesFalseWithPropertiesDictInput](#anytypeunevaluatedpropertiesfalsewithpropertiesdictinput), [AnyTypeUnevaluatedPropertiesFalseWithPropertiesDict](#anytypeunevaluatedpropertiesfalsewithpropertiesdict), str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | [AnyTypeUnevaluatedPropertiesFalseWithPropertiesDict](#anytypeunevaluatedpropertiesfalsewithpropertiesdict), str, float, int, bool, None, tuple, bytes, io.FileIO | a constructor
get_additional_property_ | str | schemas.immutabledict, tuple, float, int, str, bool, None, bytes, schemas.FileIO, schemas.Unset }} | provides type safety for additional properties

[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md)
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# AnyTypeUnevaluatedPropertiesString
json_schema_api.components.schema.any_type_unevaluated_properties_string
```
type: schemas.Schema
```

## validate method
Input Type | Return Type | Notes
------------ | ------------- | -------------
dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO |

[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md)
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# AnyTypeUnevaluatedPropertiesTrue
json_schema_api.components.schema.any_type_unevaluated_properties_true
```
type: schemas.Schema
```

## validate method
Input Type | Return Type | Notes
------------ | ------------- | -------------
dict, schemas.immutabledict, str, datetime.date, datetime.datetime, uuid.UUID, int, float, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader | schemas.immutabledict, str, float, int, bool, None, tuple, bytes, io.FileIO |

[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md)
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# ArrayUnevaluatedItemsFalseWithPrefixItems
json_schema_api.components.schema.array_unevaluated_items_false_with_prefix_items
```
type: schemas.Schema
```

## validate method
Input Type | Return Type | Notes
------------ | ------------- | -------------
list, tuple | tuple |

[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md)
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# ObjectUnevaluatedPropertiesFalseWithProperties
json_schema_api.components.schema.object_unevaluated_properties_false_with_properties
```
type: schemas.Schema
```

## validate method
Input Type | Return Type | Notes
------------ | ------------- | -------------
[ObjectUnevaluatedPropertiesFalseWithPropertiesDictInput](#objectunevaluatedpropertiesfalsewithpropertiesdictinput), [ObjectUnevaluatedPropertiesFalseWithPropertiesDict](#objectunevaluatedpropertiesfalsewithpropertiesdict) | [ObjectUnevaluatedPropertiesFalseWithPropertiesDict](#objectunevaluatedpropertiesfalsewithpropertiesdict) |

## ObjectUnevaluatedPropertiesFalseWithPropertiesDictInput
```
type: typing.Mapping[str, schemas.INPUT_TYPES_ALL]
```
Key | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**someProp** | str | | [optional]
**any_string_name** | dict, schemas.immutabledict, list, tuple, decimal.Decimal, float, int, str, datetime.date, datetime.datetime, uuid.UUID, bool, None, bytes, io.FileIO, io.BufferedReader, schemas.FileIO | any string name can be used but the value must be the correct type | [optional]

## ObjectUnevaluatedPropertiesFalseWithPropertiesDict
```
base class: schemas.immutabledict[str, str]

```
### __new__ method
Keyword Argument | Type | Description | Notes
---------------- | ---- | ----------- | -----
**someProp** | str, schemas.Unset | | [optional]
**kwargs** | schemas.immutabledict, tuple, float, int, str, bool, None, bytes, schemas.FileIO | any string name can be used but the value must be the correct type | [optional] typed value is accessed with the get_additional_property_ method

### properties
Property | Type | Description | Notes
-------- | ---- | ----------- | -----
**someProp** | str, schemas.Unset | | [optional]

### methods
Method | Input Type | Return Type | Notes
------ | ---------- | ----------- | ------
from_dict_ | [ObjectUnevaluatedPropertiesFalseWithPropertiesDictInput](#objectunevaluatedpropertiesfalsewithpropertiesdictinput), [ObjectUnevaluatedPropertiesFalseWithPropertiesDict](#objectunevaluatedpropertiesfalsewithpropertiesdict) | [ObjectUnevaluatedPropertiesFalseWithPropertiesDict](#objectunevaluatedpropertiesfalsewithpropertiesdict) | a constructor
get_additional_property_ | str | schemas.immutabledict, tuple, float, int, str, bool, None, bytes, schemas.FileIO, schemas.Unset }} | provides type safety for additional properties

[[Back to top]](#top) [[Back to Component Schemas]](../../../README.md#Component-Schemas) [[Back to README]](../../../README.md)
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# coding: utf-8

"""
Example
No description provided (generated by Openapi JSON Schema Generator https://github.com/openapi-json-schema-tools/openapi-json-schema-generator) # noqa: E501
The version of the OpenAPI document: 1.0.0
Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator
"""

from __future__ import annotations
from json_schema_api.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary]

_Not: typing_extensions.TypeAlias = schemas.AnyTypeSchema


@dataclasses.dataclass(frozen=True)
class UnevaluatedProperties(
schemas.AnyTypeSchema[schemas.immutabledict[str, schemas.OUTPUT_BASE_TYPES], typing.Tuple[schemas.OUTPUT_BASE_TYPES, ...]],
):
# any type
not_: typing.Type[_Not] = dataclasses.field(default_factory=lambda: _Not) # type: ignore



@dataclasses.dataclass(frozen=True)
class AnyTypeUnevaluatedPropertiesFalse(
schemas.AnyTypeSchema[schemas.immutabledict[str, schemas.OUTPUT_BASE_TYPES], typing.Tuple[schemas.OUTPUT_BASE_TYPES, ...]],
):
"""NOTE: This class is auto generated by OpenAPI JSON Schema Generator.
Ref: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator

Do not edit the class manually.
"""
# any type
unevaluated_properties: typing.Type[UnevaluatedProperties] = dataclasses.field(default_factory=lambda: UnevaluatedProperties) # type: ignore

Loading