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
22 commits
Select commit Hold shift + click to select a range
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
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,3 @@ class AnyofWithBaseSchema(
str,
})
any_of: AnyOf = dataclasses.field(default_factory=lambda: schemas.tuple_to_instance(AnyOf)) # type: ignore

Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,3 @@ class OneofWithBaseSchema(
str,
})
one_of: OneOf = dataclasses.field(default_factory=lambda: schemas.tuple_to_instance(OneOf)) # type: ignore

Original file line number Diff line number Diff line change
Expand Up @@ -178,16 +178,14 @@ class _1(

@dataclasses.dataclass(frozen=True)
class OneofWithRequired(
schemas.Schema[schemas.immutabledict, tuple]
schemas.Schema[schemas.immutabledict[str, schemas.OUTPUT_BASE_TYPES], tuple]
):
"""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.
"""
types: typing.FrozenSet[typing.Type] = frozenset({
schemas.immutabledict,
})
types: typing.FrozenSet[typing.Type] = frozenset({schemas.immutabledict})
one_of: OneOf = dataclasses.field(default_factory=lambda: schemas.tuple_to_instance(OneOf)) # type: ignore

@classmethod
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ class Alpha(
int,
})
inclusive_maximum: typing.Union[int, float] = 3
default: typing.Union[int, float] = 5
Properties = typing.TypedDict(
'Properties',
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,4 @@
from __future__ import annotations
from unit_test_api.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary]



@dataclasses.dataclass(frozen=True)
class UniqueitemsFalseValidation(
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
unique_items: bool = False

UniqueitemsFalseValidation: typing_extensions.TypeAlias = schemas.AnyTypeSchema
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,7 @@ class AbstractStepMessage(

Abstract Step
"""
types: typing.FrozenSet[typing.Type] = frozenset({
schemas.immutabledict,
})
types: typing.FrozenSet[typing.Type] = frozenset({schemas.immutabledict})
required: typing.FrozenSet[str] = frozenset({
"description",
"discriminator",
Expand All @@ -123,7 +121,7 @@ class AbstractStepMessage(
typing.Type
] = dataclasses.field(
default_factory=lambda: {
schemas.immutabledict: AbstractStepMessageDict,
schemas.immutabledict: AbstractStepMessageDict
}
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,16 +257,14 @@ def validate(

@dataclasses.dataclass(frozen=True)
class AdditionalPropertiesValidator(
schemas.Schema[schemas.immutabledict, tuple]
schemas.Schema[schemas.immutabledict[str, schemas.OUTPUT_BASE_TYPES], tuple]
):
"""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.
"""
types: typing.FrozenSet[typing.Type] = frozenset({
schemas.immutabledict,
})
types: typing.FrozenSet[typing.Type] = frozenset({schemas.immutabledict})
all_of: AllOf = dataclasses.field(default_factory=lambda: schemas.tuple_to_instance(AllOf)) # type: ignore

@classmethod
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,3 @@ class ComposedBool(
schemas.Bool,
})
all_of: AllOf = dataclasses.field(default_factory=lambda: schemas.tuple_to_instance(AllOf)) # type: ignore

Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,3 @@ class ComposedNone(
type(None),
})
all_of: AllOf = dataclasses.field(default_factory=lambda: schemas.tuple_to_instance(AllOf)) # type: ignore

Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,3 @@ class ComposedNumber(
int,
})
all_of: AllOf = dataclasses.field(default_factory=lambda: schemas.tuple_to_instance(AllOf)) # type: ignore

Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,14 @@

@dataclasses.dataclass(frozen=True)
class ComposedObject(
schemas.Schema[schemas.immutabledict, tuple]
schemas.Schema[schemas.immutabledict[str, schemas.OUTPUT_BASE_TYPES], tuple]
):
"""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.
"""
types: typing.FrozenSet[typing.Type] = frozenset({
schemas.immutabledict,
})
types: typing.FrozenSet[typing.Type] = frozenset({schemas.immutabledict})
all_of: AllOf = dataclasses.field(default_factory=lambda: schemas.tuple_to_instance(AllOf)) # type: ignore

@classmethod
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,3 @@ class ComposedString(
str,
})
all_of: AllOf = dataclasses.field(default_factory=lambda: schemas.tuple_to_instance(AllOf)) # type: ignore

Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ class IntegerEnumWithDefaultValue(
int,
})
format: str = 'int'
default: typing.Literal[0] = 0
enum_value_to_name: typing.Mapping[typing.Union[int, float, str, schemas.Bool, None], str] = dataclasses.field(
default_factory=lambda: {
0: "POSITIVE_0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,7 @@ class ObjWithRequiredProps(

Do not edit the class manually.
"""
types: typing.FrozenSet[typing.Type] = frozenset({
schemas.immutabledict,
})
types: typing.FrozenSet[typing.Type] = frozenset({schemas.immutabledict})
required: typing.FrozenSet[str] = frozenset({
"a",
})
Expand All @@ -86,7 +84,7 @@ class ObjWithRequiredProps(
typing.Type
] = dataclasses.field(
default_factory=lambda: {
schemas.immutabledict: ObjWithRequiredPropsDict,
schemas.immutabledict: ObjWithRequiredPropsDict
}
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,16 +96,7 @@ def validate(
],
validated_arg
)


@dataclasses.dataclass(frozen=True)
class Complete(
schemas.BoolSchema
):
types: typing.FrozenSet[typing.Type] = frozenset({
schemas.Bool,
})
default: typing.Literal[False] = False
Complete: typing_extensions.TypeAlias = schemas.BoolSchema
Properties = typing.TypedDict(
'Properties',
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,14 @@

@dataclasses.dataclass(frozen=True)
class ParentPet(
schemas.Schema[schemas.immutabledict, tuple]
schemas.Schema[schemas.immutabledict[str, schemas.OUTPUT_BASE_TYPES], tuple]
):
"""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.
"""
types: typing.FrozenSet[typing.Type] = frozenset({
schemas.immutabledict,
})
types: typing.FrozenSet[typing.Type] = frozenset({schemas.immutabledict})
discriminator: typing.Mapping[str, typing.Mapping[str, typing.Type[schemas.Schema]]] = dataclasses.field(
default_factory=lambda: {
'pet_type': {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -689,6 +689,10 @@ public static boolean isModelWithPropertiesOnly(Schema schema) {
return false;
}

/*
Remove this in the 4.0.0 release because it is unused
*/
@Deprecated
public static boolean hasValidation(Schema sc) {
return (
sc.getMaxItems() != null ||
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,10 @@ public class CodegenSchema {
public String pathFromDocRoot = null;
public boolean isInline = false;

/*
Remove this in the 4.0.0 release because it is unused
*/
@Deprecated
public boolean hasValidation() {
return maxItems != null || minItems != null || minProperties != null || maxProperties != null || minLength != null || maxLength != null || multipleOf != null || patternInfo != null || minimum != null || maximum != null || exclusiveMinimum != null || exclusiveMaximum != null || uniqueItems != null;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{{#with additionalProperties}}
additional_properties: typing.Type[{{#if refInfo.refClass}}{{#if refInfo.refModule}}{{refInfo.refModule}}.{{/if}}{{refInfo.refClass}}{{else}}{{jsonPathPiece.camelCase}}{{/if}}] = dataclasses.field(default_factory=lambda: {{#if refInfo.refClass}}{{#if refInfo.refModule}}{{refInfo.refModule}}.{{/if}}{{refInfo.refClass}}{{else}}{{jsonPathPiece.camelCase}}{{/if}}) # type: ignore
{{/with}}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
all_of: {{allOf.jsonPathPiece.camelCase}} = dataclasses.field(default_factory=lambda: schemas.tuple_to_instance({{allOf.jsonPathPiece.camelCase}})) # type: ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
any_of: {{anyOf.jsonPathPiece.camelCase}} = dataclasses.field(default_factory=lambda: schemas.tuple_to_instance({{anyOf.jsonPathPiece.camelCase}})) # type: ignore

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ const_value_to_name: typing.Mapping[typing.Union[int, float, str, schemas.Bool,
{{/each}}
}
)
const = {{constInfo.jsonPathPiece.camelCase}}
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
{{#if contains}}
{{#with contains}}
{{#with contains}}
contains: typing.Type[{{#if refInfo.refClass}}{{#if refInfo.refModule}}{{refInfo.refModule}}.{{/if}}{{refInfo.refClass}}{{else}}{{jsonPathPiece.camelCase}}{{/if}}] = dataclasses.field(default_factory=lambda: {{#if refInfo.refClass}}{{#if refInfo.refModule}}{{refInfo.refModule}}.{{/if}}{{refInfo.refClass}}{{else}}{{jsonPathPiece.camelCase}}{{/if}}) # type: ignore
{{/with}}
{{#if maxContains}}
{{/with}}
{{#neq maxContains null}}
max_contains: typing.Literal[{{maxContains}}] = {{maxContains}}
{{/if}}
{{#if minContains}}
{{/neq}}
{{#neq minContains null}}
min_contains: typing.Literal[{{minContains}}] = {{minContains}}
{{/if}}
{{/if}}
{{/neq}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{{#with defaultValue}}
{{#eq type "string"}}
default: typing.Literal["{{{value}}}"] = "{{{value}}}"
{{/eq}}
{{#eq type "number"}}
default: typing.Union[int, float] = {{{value}}}
{{/eq}}
{{#eq type "integer"}}
default: typing.Literal[{{{value}}}] = {{{value}}}
{{/eq}}
{{#eq type "boolean"}}
{{#if value}}
default: typing.Literal[True] = True
{{else}}
default: typing.Literal[False] = False
{{/if}}
{{/eq}}
{{#eq type "null"}}
default: None = None
{{/eq}}
{{/with}}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{{#with discriminator}}
discriminator: typing.Mapping[str, typing.Mapping[str, typing.Type[schemas.Schema]]] = dataclasses.field(
default_factory=lambda: {
'{{{propertyName.original}}}': {
{{#each mappedModels}}
'{{mappingName}}': {{{modelName}}},
{{/each}}
}
}
)
{{/with}}
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ enum_value_to_name: typing.Mapping[typing.Union[int, float, str, schemas.Bool, N
{{/each}}
}
)
enums = {{enumInfo.jsonPathPiece.camelCase}}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
format: str = '{{format}}'
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
max_items: int = {{maxItems}}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
max_length: int = {{maxLength}}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
max_properties: int = {{maxProperties}}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{{#if exclusiveMaximum}}exclusive_maximum{{/if}}inclusive_maximum{{#unless exclusiveMaximum}}{{/unless}}: typing.Union[int, float] = {{maximum}}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
min_items: int = {{minItems}}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
min_length: int = {{minLength}}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
min_properties: int = {{minProperties}}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{{#if exclusiveMinimum}}exclusive_minimum{{/if}}inclusive_minimum{{#unless exclusiveMinimum}}{{/unless}}: typing.Union[int, float] = {{minimum}}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
multiple_of: typing.Union[int, float] = {{multipleOf}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{{#with not}}
not_: typing.Type[{{#if refInfo.refClass}}{{#if refInfo.refModule}}{{refInfo.refModule}}.{{/if}}{{refInfo.refClass}}{{else}}{{jsonPathPiece.camelCase}}{{/if}}] = dataclasses.field(default_factory=lambda: {{#if refInfo.refClass}}{{#if refInfo.refModule}}{{refInfo.refModule}}.{{/if}}{{refInfo.refClass}}{{else}}{{jsonPathPiece.camelCase}}{{/if}}) # type: ignore
{{/with}}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
one_of: {{oneOf.jsonPathPiece.camelCase}} = dataclasses.field(default_factory=lambda: schemas.tuple_to_instance({{oneOf.jsonPathPiece.camelCase}})) # type: ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
pattern: schemas.PatternInfo = schemas.PatternInfo(
{{#with patternInfo}}
pattern=r'{{{pattern}}}'{{#if flags}},{{/if}} # noqa: E501
{{#if flags}}
{{#eq flags.size 1}}
flags={{#each flags}}re.{{#eq this "i"}}I{{/eq}}{{#eq this "m"}}M{{/eq}}{{#eq this "s"}}S{{/eq}}{{#eq this "u"}}U{{/eq}}{{/each}},
{{else}}
flags=(
{{#each flags}}
{{#eq this "i"}}
re.I{{#unless @last}} |{{/unless}}
{{/eq}}
{{#eq this "m"}}
re.M{{#unless @last}} |{{/unless}}
{{/eq}}
{{#eq this "s"}}
re.S{{#unless @last}} |{{/unless}}
{{/eq}}
{{#eq this "u"}}
re.U{{#unless @last}} |{{/unless}}
{{/eq}}
{{/each}}
)
{{/eq}}
{{/if}}
{{/with}}
)
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
properties: {{properties.jsonPathPiece.camelCase}} = dataclasses.field(default_factory=lambda: schemas.typed_dict_to_instance({{properties.jsonPathPiece.camelCase}})) # type: ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
required: typing.FrozenSet[str] = frozenset({
{{#each requiredProperties}}
"{{{@key.original}}}",
{{/each}}
})
Loading