This repository has been archived by the owner on Dec 25, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Writes nested schemas earlier and uses them later
- Loading branch information
Showing
260 changed files
with
8,008 additions
and
7,369 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
93 changes: 37 additions & 56 deletions
93
...chema-generator/src/main/resources/python/components/schemas/_helper_composed_schemas.hbs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,73 +1,54 @@ | ||
{{#if allOf}} | ||
|
||
class AllOf: | ||
{{#each allOf}} | ||
{{#if refInfo.refClass}} | ||
|
||
{{> components/schemas/_helper_refclass_staticmethod }} | ||
{{else}} | ||
{{> components/schemas/_helper_schema_switch_case identifierPieces=(append identifierPieces "AllOf" jsonPathPiece) }} | ||
{{/if}} | ||
{{/each}} | ||
classes = [ | ||
{{#each allOf}} | ||
{{#if refInfo.refClass}} | ||
{{jsonPathPiece.snakeCase}}, | ||
{{else}} | ||
@staticmethod | ||
def all_of(): | ||
return ( | ||
{{#each allOf}} | ||
{{#if refInfo.refClass}} | ||
{{#if refInfo.refModule}}{{refInfo.refModule}}.{{/if}}{{refInfo.refClass}}, | ||
{{else}} | ||
{{jsonPathPiece.camelCase}}, | ||
{{/if}} | ||
{{/each}} | ||
] | ||
{{/if}} | ||
{{/each}} | ||
) | ||
{{/if}} | ||
{{#if oneOf}} | ||
|
||
class OneOf: | ||
{{#each oneOf}} | ||
{{#if refInfo.refClass}} | ||
|
||
{{> components/schemas/_helper_refclass_staticmethod }} | ||
{{else}} | ||
{{> components/schemas/_helper_schema_switch_case identifierPieces=(append identifierPieces "OneOf" jsonPathPiece) }} | ||
{{/if}} | ||
{{/each}} | ||
classes = [ | ||
{{#each oneOf}} | ||
{{#if refInfo.refClass}} | ||
{{jsonPathPiece.snakeCase}}, | ||
{{else}} | ||
@staticmethod | ||
def one_of(): | ||
return ( | ||
{{#each oneOf}} | ||
{{#if refInfo.refClass}} | ||
{{#if refInfo.refModule}}{{refInfo.refModule}}.{{/if}}{{refInfo.refClass}}, | ||
{{else}} | ||
{{jsonPathPiece.camelCase}}, | ||
{{/if}} | ||
{{/each}} | ||
] | ||
{{/if}} | ||
{{/each}} | ||
) | ||
{{/if}} | ||
{{#if anyOf}} | ||
|
||
class AnyOf: | ||
{{#each anyOf}} | ||
{{#if refInfo.refClass}} | ||
|
||
{{> components/schemas/_helper_refclass_staticmethod }} | ||
{{else}} | ||
{{> components/schemas/_helper_schema_switch_case identifierPieces=(append identifierPieces "AnyOf" jsonPathPiece) }} | ||
{{/if}} | ||
{{/each}} | ||
classes = [ | ||
{{#each anyOf}} | ||
{{#if refInfo.refClass}} | ||
{{jsonPathPiece.snakeCase}}, | ||
{{else}} | ||
@staticmethod | ||
def any_of(): | ||
return ( | ||
{{#each anyOf}} | ||
{{#if refInfo.refClass}} | ||
{{#if refInfo.refModule}}{{refInfo.refModule}}.{{/if}}{{refInfo.refClass}}, | ||
{{else}} | ||
{{jsonPathPiece.camelCase}}, | ||
{{/if}} | ||
{{/each}} | ||
] | ||
{{/if}} | ||
{{/each}} | ||
) | ||
{{/if}} | ||
{{#if not}} | ||
{{#with not}} | ||
{{#if refInfo.refClass}} | ||
|
||
{{> components/schemas/_helper_refclass_staticmethod }} | ||
{{else}} | ||
{{> components/schemas/_helper_schema_switch_case identifierPieces=(append identifierPieces jsonPathPiece) }} | ||
{{/if}} | ||
@staticmethod | ||
def not_(): | ||
{{#if refInfo.refClass}} | ||
return {{#if refInfo.refModule}}{{refInfo.refModule}}.{{/if}}{{refInfo.refClass}} | ||
{{else}} | ||
return {{jsonPathPiece.camelCase}} | ||
{{/if}} | ||
{{/with}} | ||
{{/if}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
...chema-generator/src/main/resources/python/components/schemas/_helper_getitem_property.hbs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
{{#if types}} | ||
{{#eq types.size 1}} | ||
def __getitem__(self, name: {{#if literal}}typing_extensions.Literal["{{{key}}}"]{{else}}{{key}}{{/if}}) -> Schema_{{propertyClass}}.{{jsonPathPiece.camelCase}}[{{> components/schemas/_helper_schema_python_base_types }}]:{{#if overload}} ...{{/if}} | ||
def __getitem__(self, name: {{#if literal}}typing_extensions.Literal["{{{key}}}"]{{else}}{{key}}{{/if}}) -> {{jsonPathPiece.camelCase}}[{{> components/schemas/_helper_schema_python_base_types }}]:{{#if overload}} ...{{/if}} | ||
{{else}} | ||
def __getitem__(self, name: {{#if literal}}typing_extensions.Literal["{{{key}}}"]{{else}}{{key}}{{/if}}) -> Schema_{{propertyClass}}.{{jsonPathPiece.camelCase}}[typing.Union[ | ||
def __getitem__(self, name: {{#if literal}}typing_extensions.Literal["{{{key}}}"]{{else}}{{key}}{{/if}}) -> {{jsonPathPiece.camelCase}}[typing.Union[ | ||
{{> components/schemas/_helper_schema_python_base_types_newline }} | ||
]]:{{#if overload}} ...{{/if}} | ||
{{/eq}} | ||
{{else}} | ||
def __getitem__(self, name: {{#if literal}}typing_extensions.Literal["{{{key}}}"]{{else}}{{key}}{{/if}}) -> Schema_{{propertyClass}}.{{jsonPathPiece.camelCase}}[typing.Union[ | ||
def __getitem__(self, name: {{#if literal}}typing_extensions.Literal["{{{key}}}"]{{else}}{{key}}{{/if}}) -> {{jsonPathPiece.camelCase}}[typing.Union[ | ||
{{> components/schemas/_helper_schema_python_base_types_newline }} | ||
]]:{{#if overload}} ...{{/if}} | ||
{{/if}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 7 additions & 5 deletions
12
...on-schema-generator/src/main/resources/python/components/schemas/_helper_list_partial.hbs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
{{#with items}} | ||
{{#if refInfo.refClass}} | ||
|
||
{{> components/schemas/_helper_refclass_staticmethod }} | ||
{{else}} | ||
{{> components/schemas/_helper_schema_switch_case identifierPieces=(append identifierPieces jsonPathPiece) }} | ||
{{/if}} | ||
@staticmethod | ||
def items(): | ||
{{#if refInfo.refClass}} | ||
return {{#if refInfo.refModule}}{{refInfo.refModule}}.{{/if}}{{refInfo.refClass}} | ||
{{else}} | ||
return {{jsonPathPiece.camelCase}} | ||
{{/if}} | ||
{{/with}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
...enerator/src/main/resources/python/components/schemas/_helper_new_property_value_type.hbs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.