Skip to content
This repository was archived by the owner on Dec 25, 2024. It is now read-only.

Commit 637fdf5

Browse files
committed
Fixes content imports
1 parent b20b047 commit 637fdf5

85 files changed

Lines changed: 179 additions & 213 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{{#if paramName}}{{paramName}}: {{#eq paramName "schema"}}typing_extensions.TypeAlias = {{/eq}}{{/if}}{{#if modulePrefix}}{{modulePrefix}}_{{/if}}{{jsonPathPiece.snakeCase}}.{{jsonPathPiece.camelCase}}{{#unless paramName}},{{/unless}}
1+
{{#if paramName}}{{paramName}}: typing_extensions.TypeAlias = {{/if}}content.{{contentTypeModule}}.{{jsonPathPiece.snakeCase}}.{{jsonPathPiece.camelCase}}

modules/openapi-json-schema-generator/src/main/resources/python/components/_helper_param_or_header_instance.hbs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,19 +25,17 @@ class {{jsonPathPiece.camelCase}}(api_client.{{#if noName}}Header{{/if}}{{#eq in
2525
style=api_client.ParameterStyle.DEEP_OBJECT
2626
{{/eq}}
2727
{{/if}}
28-
{{#if schema}}
29-
{{#with schema}}
30-
{{> components/_helper_content_schema_type paramName="schema" modulePrefix=null }}
31-
{{/with}}
32-
{{/if}}
28+
{{#with schema}}
29+
schema: typing_extensions.TypeAlias = {{jsonPathPiece.snakeCase}}.{{jsonPathPiece.camelCase}}
30+
{{/with}}
3331
{{#if content}}
3432
{{#each content}}
3533

3634

3735
class {{@key.camelCase}}MediaType(api_client.MediaType):
3836
{{#with this}}
3937
{{#with schema}}
40-
{{> components/_helper_content_schema_type paramName="schema" modulePrefix=../@key.snakeCase }}
38+
{{> components/_helper_content_schema_type paramName="schema" contentTypeModule=../@key.snakeCase }}
4139
{{/with}}
4240
{{/with}}
4341
{{/each}}

modules/openapi-json-schema-generator/src/main/resources/python/components/headers/header.hbs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,7 @@ from . import {{jsonPathPiece.snakeCase}}
1818
{{/with}}
1919
{{else}}
2020
{{#if content}}
21-
22-
{{#each content}}
23-
{{#with this}}
24-
{{#with schema}}
25-
from .content.{{../@key.snakeCase}} import {{jsonPathPiece.snakeCase}} as {{../@key.snakeCase}}_{{jsonPathPiece.snakeCase}}
26-
{{/with}}
27-
{{/with}}
28-
{{/each}}
21+
from . import content
2922
{{/if}}
3023
{{/if}}
3124

modules/openapi-json-schema-generator/src/main/resources/python/components/parameters/parameter.hbs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,7 @@ from . import {{jsonPathPiece.snakeCase}}
1919
{{else}}
2020
{{#if content}}
2121

22-
{{#each content}}
23-
{{#with this}}
24-
{{#with schema}}
25-
from .content.{{../@key.snakeCase}} import {{jsonPathPiece.snakeCase}} as {{../@key.snakeCase}}_{{jsonPathPiece.snakeCase}}
26-
{{/with}}
27-
{{/with}}
28-
{{/each}}
22+
from . import content
2923
{{/if}}
3024
{{/if}}
3125

modules/openapi-json-schema-generator/src/main/resources/python/components/request_bodies/request_body.hbs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,9 @@
1212
{{else}}
1313
from {{packageName}}.shared_imports.header_imports import *
1414

15-
{{#each content}}
16-
{{#with this}}
17-
{{#with schema}}
18-
from .content.{{../@key.snakeCase}} import {{jsonPathPiece.snakeCase}} as {{../@key.snakeCase}}_{{jsonPathPiece.snakeCase}}
19-
{{/with}}
20-
{{/with}}
21-
{{/each}}
15+
{{#if content}}
16+
from . import content
17+
{{/if}}
2218

2319
class {{jsonPathPiece.camelCase}}(api_client.RequestBody):
2420
{{#each content}}
@@ -27,7 +23,7 @@ class {{jsonPathPiece.camelCase}}(api_client.RequestBody):
2723
class {{@key.camelCase}}MediaType(api_client.MediaType):
2824
{{#with this}}
2925
{{#with schema}}
30-
{{> components/_helper_content_schema_type paramName="schema" modulePrefix=../@key.snakeCase }}
26+
{{> components/_helper_content_schema_type paramName="schema" contentTypeModule=../@key.snakeCase }}
3127
{{/with}}
3228
{{/with}}
3329
{{/each}}

modules/openapi-json-schema-generator/src/main/resources/python/components/responses/response.hbs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,7 @@
1313
from {{packageName}}.shared_imports.response_imports import *
1414
{{#if content}}
1515

16-
{{#each content}}
17-
{{#with this.schema}}
18-
from .content.{{../@key.snakeCase}} import {{jsonPathPiece.snakeCase}} as {{../@key.snakeCase}}_{{jsonPathPiece.snakeCase}}
19-
{{/with}}
20-
{{/each}}
16+
from . import content
2117
{{/if}}
2218
{{#if headers}}
2319
{{#unless content}}
@@ -115,7 +111,7 @@ class {{jsonPathPiece.camelCase}}(api_client.OpenApiResponse[Api{{jsonPathPiece.
115111
class {{@key.camelCase}}MediaType(api_client.MediaType):
116112
{{#with this}}
117113
{{#with schema}}
118-
{{> components/_helper_content_schema_type paramName="schema" modulePrefix=../@key.snakeCase }}
114+
{{> components/_helper_content_schema_type paramName="schema" contentTypeModule=../@key.snakeCase }}
119115
{{else}}
120116
pass
121117
{{/with}}

samples/openapi3/client/petstore/python/src/petstore_api/components/headers/header_int32_json_content_type_header/__init__.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,15 @@
55
"""
66

77
from petstore_api.shared_imports.header_imports import *
8-
9-
from .content.application_json import schema as application_json_schema
8+
from . import content
109

1110

1211
class Int32JsonContentTypeHeader(api_client.HeaderParameterWithoutName):
1312
style = api_client.ParameterStyle.SIMPLE
1413

1514

1615
class ApplicationJsonMediaType(api_client.MediaType):
17-
schema: typing_extensions.TypeAlias = application_json_schema.Schema
16+
schema: typing_extensions.TypeAlias = content.application_json.schema.Schema
1817
Content = typing_extensions.TypedDict(
1918
'Content',
2019
{

samples/openapi3/client/petstore/python/src/petstore_api/components/headers/header_ref_content_schema_header/__init__.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,15 @@
55
"""
66

77
from petstore_api.shared_imports.header_imports import *
8-
9-
from .content.application_json import schema as application_json_schema
8+
from . import content
109

1110

1211
class RefContentSchemaHeader(api_client.HeaderParameterWithoutName):
1312
style = api_client.ParameterStyle.SIMPLE
1413

1514

1615
class ApplicationJsonMediaType(api_client.MediaType):
17-
schema: typing_extensions.TypeAlias = application_json_schema.Schema
16+
schema: typing_extensions.TypeAlias = content.application_json.schema.Schema
1817
Content = typing_extensions.TypedDict(
1918
'Content',
2019
{

samples/openapi3/client/petstore/python/src/petstore_api/components/parameters/parameter_component_ref_schema_string_with_validation/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@
66

77
from petstore_api.shared_imports.header_imports import *
88

9-
from .content.application_json import schema as application_json_schema
9+
from . import content
1010

1111

1212
class ComponentRefSchemaStringWithValidation(api_client.PathParameter):
1313
name = "CRSstringWithValidation"
1414

1515

1616
class ApplicationJsonMediaType(api_client.MediaType):
17-
schema: typing_extensions.TypeAlias = application_json_schema.Schema
17+
schema: typing_extensions.TypeAlias = content.application_json.schema.Schema
1818
Content = typing_extensions.TypedDict(
1919
'Content',
2020
{

samples/openapi3/client/petstore/python/src/petstore_api/components/request_bodies/request_body_client/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66

77
from petstore_api.shared_imports.header_imports import *
88

9-
from .content.application_json import schema as application_json_schema
9+
from . import content
1010

1111
class Client(api_client.RequestBody):
1212

1313

1414
class ApplicationJsonMediaType(api_client.MediaType):
15-
schema: typing_extensions.TypeAlias = application_json_schema.Schema
15+
schema: typing_extensions.TypeAlias = content.application_json.schema.Schema
1616
Content = typing_extensions.TypedDict(
1717
'Content',
1818
{

0 commit comments

Comments
 (0)