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
Show all changes
36 commits
Select commit Hold shift + click to select a range
235de6d
Adds from_dict_ method
spacether Aug 1, 2023
ef8f964
Adds immutabledict back in
spacether Aug 1, 2023
c81b0cb
Adds types for required and optional properties
spacether Aug 2, 2023
388a01a
Uses new io_type template for required and optional properties
spacether Aug 2, 2023
990c23c
Adds newlines to boolean input types
spacether Aug 2, 2023
acd9954
Adds newlines to binary and none
spacether Aug 2, 2023
9053dd9
Adds newline for literal values
spacether Aug 2, 2023
7fc4dc3
Adds newline for optional str
spacether Aug 2, 2023
0f71d56
Adds newlines for number and integer inputs
spacether Aug 2, 2023
0771c23
Adds remaining io newlines
spacether Aug 2, 2023
5c1bab6
Adds input types to anyType input
spacether Aug 2, 2023
70d13bd
Adds map with no props types
spacether Aug 2, 2023
34e23b6
Adds object input types
spacether Aug 2, 2023
d8b25a0
Adds tuple types when there is not arrayOutputJsonPathPiece
spacether Aug 2, 2023
6fa9a83
Adds array input types
spacether Aug 2, 2023
8cfdad6
Adds arg casting when addProps is false
spacether Aug 2, 2023
5be6cdc
Adds casting to object model input in new method
spacether Aug 2, 2023
62a87d1
Adds new types for kwargs
spacether Aug 2, 2023
3cb92b2
Makes arg_ dict type permissive
spacether Aug 2, 2023
817cf50
Adds _arg dict type in new
spacether Aug 2, 2023
aa95d66
Replaces _helper_property_value_type with _helper_schema_io_type in o…
spacether Aug 2, 2023
8d09c60
Replaces many _helper_property_value_type usages
spacether Aug 2, 2023
c086cc2
Uses schema_io for optional property definition
spacether Aug 2, 2023
beede2a
Updates required properties typeddict to use schema_io template
spacether Aug 2, 2023
d49b44d
Adjusts definition of array model type to use schema_io template
spacether Aug 2, 2023
90e6406
Removes unused templates
spacether Aug 2, 2023
8e41ff1
Fixes array model self reference detection
spacether Aug 3, 2023
a5295d7
Fixes mypy errors by making default literals into literals
spacether Aug 3, 2023
cdd5017
Adjusts comment line for empty map output class
spacether Aug 3, 2023
3ebe80e
Fixes mypy errors by moving new before properties
spacether Aug 4, 2023
20c6a4e
Requires that required arguments are named and not positional
spacether Aug 4, 2023
754edaf
Adds date/datetime/uuid inputs when those formats are specified
spacether Aug 4, 2023
8e00858
Removes reference to deleted input schema template
spacether Aug 4, 2023
53cb42e
Adds io. types for binary input
spacether Aug 4, 2023
4ab89ce
Samples regen
spacether Aug 4, 2023
c7e0b42
Changes node4 image
spacether Aug 4, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ jobs:
nodeNo: "3"
node4:
docker:
- image: fkrull/multi-python
- image: python:3.8
working_directory: ~/OpenAPITools/openapi-json-schema-generator
shell: /bin/bash --login
environment:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2084,6 +2084,7 @@ src/unit_test_api/py.typed
src/unit_test_api/rest.py
src/unit_test_api/schemas/__init__.py
src/unit_test_api/schemas/format.py
src/unit_test_api/schemas/original_immutabledict.py
src/unit_test_api/schemas/schema.py
src/unit_test_api/schemas/schemas.py
src/unit_test_api/schemas/validation.py
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,41 @@ class AdditionalpropertiesAllowsASchemaWhichShouldValidateDict(schemas.immutable
"foo",
"bar",
})
@staticmethod
def from_dict_(
arg: AdditionalpropertiesAllowsASchemaWhichShouldValidateDictInput,
configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None
) -> AdditionalpropertiesAllowsASchemaWhichShouldValidateDict:
return AdditionalpropertiesAllowsASchemaWhichShouldValidate.validate(arg, configuration=configuration)

def __new__(
cls,
*,
foo: typing.Union[
schemas.INPUT_TYPES_ALL,
schemas.OUTPUT_BASE_TYPES,
schemas.Unset
] = schemas.unset,
bar: typing.Union[
schemas.INPUT_TYPES_ALL,
schemas.OUTPUT_BASE_TYPES,
schemas.Unset
] = schemas.unset,
configuration_: typing.Optional[schema_configuration.SchemaConfiguration] = None,
**kwargs: bool,
):
arg_: typing.Dict[str, typing.Any] = {}
for key, val in (
("foo", foo),
("bar", bar),
):
if isinstance(val, schemas.Unset):
continue
arg_[key] = val
arg_.update(kwargs)
used_arg_ = typing.cast(AdditionalpropertiesAllowsASchemaWhichShouldValidateDictInput, arg_)
return AdditionalpropertiesAllowsASchemaWhichShouldValidate.validate(used_arg_, configuration=configuration_)


@property
def foo(self) -> typing.Union[schemas.OUTPUT_BASE_TYPES, schemas.Unset]:
Expand Down Expand Up @@ -60,45 +95,16 @@ def get_additional_property_(self, name: str) -> typing.Union[bool, schemas.Unse
bool,
val
)

def __new__(cls, arg: AdditionalpropertiesAllowsASchemaWhichShouldValidateDictInput, configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None):
return AdditionalpropertiesAllowsASchemaWhichShouldValidate.validate(arg, configuration=configuration)
AdditionalpropertiesAllowsASchemaWhichShouldValidateDictInput = typing.Mapping[
str,
typing.Union[
typing.Union[
dict,
schemas.immutabledict,
str,
datetime.date,
datetime.datetime,
uuid.UUID,
int,
float,
bool,
None,
list,
tuple,
bytes,
io.FileIO,
io.BufferedReader
schemas.INPUT_TYPES_ALL,
schemas.OUTPUT_BASE_TYPES
],
typing.Union[
dict,
schemas.immutabledict,
str,
datetime.date,
datetime.datetime,
uuid.UUID,
int,
float,
bool,
None,
list,
tuple,
bytes,
io.FileIO,
io.BufferedReader
schemas.INPUT_TYPES_ALL,
schemas.OUTPUT_BASE_TYPES
],
bool,
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,41 @@ class AdditionalpropertiesAreAllowedByDefaultDict(schemas.immutabledict[str, sch
"foo",
"bar",
})
@staticmethod
def from_dict_(
arg: AdditionalpropertiesAreAllowedByDefaultDictInput,
configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None
) -> AdditionalpropertiesAreAllowedByDefaultDict:
return AdditionalpropertiesAreAllowedByDefault.validate(arg, configuration=configuration)

def __new__(
cls,
*,
foo: typing.Union[
schemas.INPUT_TYPES_ALL,
schemas.OUTPUT_BASE_TYPES,
schemas.Unset
] = schemas.unset,
bar: typing.Union[
schemas.INPUT_TYPES_ALL,
schemas.OUTPUT_BASE_TYPES,
schemas.Unset
] = schemas.unset,
configuration_: typing.Optional[schema_configuration.SchemaConfiguration] = None,
**kwargs: schemas.INPUT_TYPES_ALL,
):
arg_: typing.Dict[str, typing.Any] = {}
for key, val in (
("foo", foo),
("bar", bar),
):
if isinstance(val, schemas.Unset):
continue
arg_[key] = val
arg_.update(kwargs)
used_arg_ = typing.cast(AdditionalpropertiesAreAllowedByDefaultDictInput, arg_)
return AdditionalpropertiesAreAllowedByDefault.validate(used_arg_, configuration=configuration_)


@property
def foo(self) -> typing.Union[schemas.OUTPUT_BASE_TYPES, schemas.Unset]:
Expand All @@ -53,9 +88,6 @@ def bar(self) -> typing.Union[schemas.OUTPUT_BASE_TYPES, schemas.Unset]:
def get_additional_property_(self, name: str) -> typing.Union[schemas.OUTPUT_BASE_TYPES, schemas.Unset]:
schemas.raise_if_key_known(name, self.__required_keys__, self.__optional_keys__)
return self.get(name, schemas.unset)

def __new__(cls, arg: AdditionalpropertiesAreAllowedByDefaultDictInput, configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None):
return AdditionalpropertiesAreAllowedByDefault.validate(arg, configuration=configuration)
AdditionalpropertiesAreAllowedByDefaultDictInput = typing.Mapping[str, schemas.INPUT_TYPES_ALL]


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,21 @@ class AdditionalpropertiesCanExistByItselfDict(schemas.immutabledict[str, bool])
})
__optional_keys__: typing.FrozenSet[str] = frozenset({
})
def __new__(
cls,
configuration_: typing.Optional[schema_configuration.SchemaConfiguration] = None,
**kwargs: bool,
):
used_kwargs = typing.cast(AdditionalpropertiesCanExistByItselfDictInput, kwargs)
return AdditionalpropertiesCanExistByItself.validate(used_kwargs, configuration=configuration_)

@staticmethod
def from_dict_(
arg: AdditionalpropertiesCanExistByItselfDictInput,
configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None
) -> AdditionalpropertiesCanExistByItselfDict:
return AdditionalpropertiesCanExistByItself.validate(arg, configuration=configuration)


def get_additional_property_(self, name: str) -> typing.Union[bool, schemas.Unset]:
schemas.raise_if_key_known(name, self.__required_keys__, self.__optional_keys__)
Expand All @@ -29,9 +44,6 @@ def get_additional_property_(self, name: str) -> typing.Union[bool, schemas.Unse
bool,
val
)

def __new__(cls, arg: AdditionalpropertiesCanExistByItselfDictInput, configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None):
return AdditionalpropertiesCanExistByItself.validate(arg, configuration=configuration)
AdditionalpropertiesCanExistByItselfDictInput = typing.Mapping[
str,
bool,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,35 @@ class _0Dict(schemas.immutabledict[str, schemas.OUTPUT_BASE_TYPES]):
__optional_keys__: typing.FrozenSet[str] = frozenset({
"foo",
})
@staticmethod
def from_dict_(
arg: _0DictInput,
configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None
) -> _0Dict:
return _0.validate(arg, configuration=configuration)

def __new__(
cls,
*,
foo: typing.Union[
schemas.INPUT_TYPES_ALL,
schemas.OUTPUT_BASE_TYPES,
schemas.Unset
] = schemas.unset,
configuration_: typing.Optional[schema_configuration.SchemaConfiguration] = None,
**kwargs: schemas.INPUT_TYPES_ALL,
):
arg_: typing.Dict[str, typing.Any] = {}
for key, val in (
("foo", foo),
):
if isinstance(val, schemas.Unset):
continue
arg_[key] = val
arg_.update(kwargs)
used_arg_ = typing.cast(_0DictInput, arg_)
return _0.validate(used_arg_, configuration=configuration_)


@property
def foo(self) -> typing.Union[schemas.OUTPUT_BASE_TYPES, schemas.Unset]:
Expand All @@ -41,9 +70,6 @@ def foo(self) -> typing.Union[schemas.OUTPUT_BASE_TYPES, schemas.Unset]:
def get_additional_property_(self, name: str) -> typing.Union[schemas.OUTPUT_BASE_TYPES, schemas.Unset]:
schemas.raise_if_key_known(name, self.__required_keys__, self.__optional_keys__)
return self.get(name, schemas.unset)

def __new__(cls, arg: _0DictInput, configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None):
return _0.validate(arg, configuration=configuration)
_0DictInput = typing.Mapping[str, schemas.INPUT_TYPES_ALL]


Expand Down Expand Up @@ -73,6 +99,21 @@ class AdditionalpropertiesShouldNotLookInApplicatorsDict(schemas.immutabledict[s
})
__optional_keys__: typing.FrozenSet[str] = frozenset({
})
def __new__(
cls,
configuration_: typing.Optional[schema_configuration.SchemaConfiguration] = None,
**kwargs: bool,
):
used_kwargs = typing.cast(AdditionalpropertiesShouldNotLookInApplicatorsDictInput, kwargs)
return AdditionalpropertiesShouldNotLookInApplicators.validate(used_kwargs, configuration=configuration_)

@staticmethod
def from_dict_(
arg: AdditionalpropertiesShouldNotLookInApplicatorsDictInput,
configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None
) -> AdditionalpropertiesShouldNotLookInApplicatorsDict:
return AdditionalpropertiesShouldNotLookInApplicators.validate(arg, configuration=configuration)


def get_additional_property_(self, name: str) -> typing.Union[bool, schemas.Unset]:
schemas.raise_if_key_known(name, self.__required_keys__, self.__optional_keys__)
Expand All @@ -83,9 +124,6 @@ def get_additional_property_(self, name: str) -> typing.Union[bool, schemas.Unse
bool,
val
)

def __new__(cls, arg: AdditionalpropertiesShouldNotLookInApplicatorsDictInput, configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None):
return AdditionalpropertiesShouldNotLookInApplicators.validate(arg, configuration=configuration)
AdditionalpropertiesShouldNotLookInApplicatorsDictInput = typing.Mapping[
str,
bool,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,27 @@ class _0Dict(schemas.immutabledict[str, int]):
})
__optional_keys__: typing.FrozenSet[str] = frozenset({
})
@staticmethod
def from_dict_(
arg: _0DictInput,
configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None
) -> _0Dict:
return _0.validate(arg, configuration=configuration)

def __new__(
cls,
*,
bar: int,
configuration_: typing.Optional[schema_configuration.SchemaConfiguration] = None,
**kwargs: schemas.INPUT_TYPES_ALL,
):
arg_: typing.Dict[str, typing.Any] = {
"bar": bar,
}
arg_.update(kwargs)
used_arg_ = typing.cast(_0DictInput, arg_)
return _0.validate(used_arg_, configuration=configuration_)


@property
def bar(self) -> int:
Expand All @@ -37,9 +58,6 @@ def bar(self) -> int:
def get_additional_property_(self, name: str) -> typing.Union[schemas.OUTPUT_BASE_TYPES, schemas.Unset]:
schemas.raise_if_key_known(name, self.__required_keys__, self.__optional_keys__)
return self.get(name, schemas.unset)

def __new__(cls, arg: _0DictInput, configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None):
return _0.validate(arg, configuration=configuration)
_0DictInput = typing.Mapping[str, schemas.INPUT_TYPES_ALL]


Expand Down Expand Up @@ -77,6 +95,27 @@ class _1Dict(schemas.immutabledict[str, str]):
})
__optional_keys__: typing.FrozenSet[str] = frozenset({
})
@staticmethod
def from_dict_(
arg: _1DictInput,
configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None
) -> _1Dict:
return _1.validate(arg, configuration=configuration)

def __new__(
cls,
*,
foo: str,
configuration_: typing.Optional[schema_configuration.SchemaConfiguration] = None,
**kwargs: schemas.INPUT_TYPES_ALL,
):
arg_: typing.Dict[str, typing.Any] = {
"foo": foo,
}
arg_.update(kwargs)
used_arg_ = typing.cast(_1DictInput, arg_)
return _1.validate(used_arg_, configuration=configuration_)


@property
def foo(self) -> str:
Expand All @@ -88,9 +127,6 @@ def foo(self) -> str:
def get_additional_property_(self, name: str) -> typing.Union[schemas.OUTPUT_BASE_TYPES, schemas.Unset]:
schemas.raise_if_key_known(name, self.__required_keys__, self.__optional_keys__)
return self.get(name, schemas.unset)

def __new__(cls, arg: _1DictInput, configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None):
return _1.validate(arg, configuration=configuration)
_1DictInput = typing.Mapping[str, schemas.INPUT_TYPES_ALL]


Expand Down
Loading