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

Commit 24d43b1

Browse files
committed
Fixes case where response lacks content schemas
1 parent 637fdf5 commit 24d43b1

32 files changed

Lines changed: 61 additions & 63 deletions

File tree

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
{{#if paramName}}
22
{{#if refInfo.refClass}}
3-
{{> components/schemas/_helper_schema_output_ref_type mode="typehint" key=paramName fullRefModule=(join modulePrefix jsonPathPiece.snakeCase "_") endChar="" }}
3+
{{> components/schemas/_helper_schema_output_ref_type mode="typehint" key=paramName fullRefModule=(join "content" modulePrefix jsonPathPiece.snakeCase ".") endChar="" }}
44
{{else}}
5-
{{> components/schemas/_helper_schema_output_type mode="typehint" key=paramName fullRefModule=(join modulePrefix jsonPathPiece.snakeCase "_") endChar="" }}
5+
{{> components/schemas/_helper_schema_output_type mode="typehint" key=paramName fullRefModule=(join "content" modulePrefix jsonPathPiece.snakeCase ".") endChar="" }}
66
{{/if}}
77
{{else}}
88
{{#if refInfo.refClass}}
9-
{{> components/schemas/_helper_schema_output_ref_type mode="unprefixed" fullRefModule=(join modulePrefix jsonPathPiece.snakeCase "_") endChar="," }}
9+
{{> components/schemas/_helper_schema_output_ref_type mode="unprefixed" fullRefModule=(join "content" modulePrefix jsonPathPiece.snakeCase ".") endChar="," }}
1010
{{else}}
11-
{{> components/schemas/_helper_schema_output_type mode="unprefixed" fullRefModule=(join modulePrefix jsonPathPiece.snakeCase "_") endChar="," }}
11+
{{> components/schemas/_helper_schema_output_type mode="unprefixed" fullRefModule=(join "content" modulePrefix jsonPathPiece.snakeCase ".") endChar="," }}
1212
{{/if}}
1313
{{/if}}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
{{jsonPathPiece.camelCase}} = {{refInfo.refModule}}.{{refInfo.refClass}}
1212
{{else}}
1313
from {{packageName}}.shared_imports.response_imports import *
14-
{{#if content}}
14+
{{#if hasContentSchema}}
1515

1616
from . import content
1717
{{/if}}

modules/openapi-json-schema-generator/src/main/resources/python/paths/path/verb/_helper_operation_args_optional.hbs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ body: typing.Union[
77
{{#each content}}
88
{{#with schema}}
99
{{#if refInfo.refClass}}
10-
{{> components/schemas/_helper_schema_output_ref_type mode="unprefixed" fullRefModule=(join "request_body" "content" ../@key.snakeCase "schema" ".") endChar="," }}
10+
{{> components/schemas/_helper_schema_output_ref_type mode="unprefixed" fullRefModule=(join "request_body" ../../../refInfo.refModule "content" ../@key.snakeCase "schema" ".") endChar="," }}
1111
{{else}}
12-
{{> components/schemas/_helper_schema_output_type mode="unprefixed" fullRefModule=(join "request_body" "content" ../@key.snakeCase "schema" ".") endChar="," }}
12+
{{> components/schemas/_helper_schema_output_type mode="unprefixed" fullRefModule=(join "request_body" ../../../refInfo.refModule "content" ../@key.snakeCase "schema" ".") endChar="," }}
1313
{{/if}}
1414
{{/with}}
1515
{{/each}}

modules/openapi-json-schema-generator/src/main/resources/python/paths/path/verb/_helper_operation_args_required.hbs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ body: typing.Union[
77
{{#each content}}
88
{{#with schema}}
99
{{#if refInfo.refClass}}
10-
{{> components/schemas/_helper_schema_output_ref_type mode="unprefixed" fullRefModule=(join "request_body" "content" ../@key.snakeCase "schema" ".") endChar="," }}
10+
{{> components/schemas/_helper_schema_output_ref_type mode="unprefixed" fullRefModule=(join "request_body" ../../../refInfo.refModule "content" ../@key.snakeCase "schema" ".") endChar="," }}
1111
{{else}}
12-
{{> components/schemas/_helper_schema_output_type mode="unprefixed" fullRefModule=(join "request_body" "content" ../@key.snakeCase "schema" ".") endChar="," }}
12+
{{> components/schemas/_helper_schema_output_type mode="unprefixed" fullRefModule=(join "request_body" ../../../refInfo.refModule "content" ../@key.snakeCase "schema" ".") endChar="," }}
1313
{{/if}}
1414
{{/with}}
1515
{{/each}}

samples/openapi3/client/petstore/python/src/petstore_api/components/responses/response_success_inline_content_and_header/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class Params(RequiredParams, OptionalParams):
3636
@dataclasses.dataclass
3737
class ApiSuccessInlineContentAndHeader(api_response.ApiResponse):
3838
response: urllib3.HTTPResponse
39-
body: application_json_schema.SchemaDict
39+
body: content.application_json.schema.SchemaDict
4040
headers: Header.Params
4141

4242

samples/openapi3/client/petstore/python/src/petstore_api/components/responses/response_success_with_json_api_response/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class Params(RequiredParams, OptionalParams):
4848
@dataclasses.dataclass
4949
class ApiSuccessWithJsonApiResponse(api_response.ApiResponse):
5050
response: urllib3.HTTPResponse
51-
body: application_json_schema.api_response.ApiResponseDict
51+
body: content.application_json.schema.api_response.ApiResponseDict
5252
headers: Header.Params
5353

5454

samples/openapi3/client/petstore/python/src/petstore_api/components/responses/response_successful_xml_and_json_array_of_pet/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
class ApiSuccessfulXmlAndJsonArrayOfPet(api_response.ApiResponse):
1414
response: urllib3.HTTPResponse
1515
body: typing.Union[
16-
application_xml_schema.SchemaTuple,
17-
application_json_schema.SchemaTuple,
16+
content.application_xml.schema.SchemaTuple,
17+
content.application_json.schema.SchemaTuple,
1818
]
1919
headers: schemas.Unset = schemas.unset
2020

samples/openapi3/client/petstore/python/src/petstore_api/paths/another_fake_dummy/patch/operation.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class BaseApi(api_client.Api):
3333
def _call_123_test__special_tags(
3434
self,
3535
body: typing.Union[
36-
request_body.content.application_json.schema.client.ClientDict,
36+
request_body.request_body_client.content.application_json.schema.client.ClientDict,
3737
dict,
3838
immutabledict.immutabledict
3939
],
@@ -49,7 +49,7 @@ def _call_123_test__special_tags(
4949
def _call_123_test__special_tags(
5050
self,
5151
body: typing.Union[
52-
request_body.content.application_json.schema.client.ClientDict,
52+
request_body.request_body_client.content.application_json.schema.client.ClientDict,
5353
dict,
5454
immutabledict.immutabledict
5555
],
@@ -64,7 +64,7 @@ def _call_123_test__special_tags(
6464
def _call_123_test__special_tags(
6565
self,
6666
body: typing.Union[
67-
request_body.content.application_json.schema.client.ClientDict,
67+
request_body.request_body_client.content.application_json.schema.client.ClientDict,
6868
dict,
6969
immutabledict.immutabledict
7070
],

samples/openapi3/client/petstore/python/src/petstore_api/paths/another_fake_dummy/patch/responses/response_200/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
@dataclasses.dataclass
1313
class ApiResponseFor200(api_response.ApiResponse):
1414
response: urllib3.HTTPResponse
15-
body: application_json_schema.client.ClientDict
15+
body: content.application_json.schema.client.ClientDict
1616
headers: schemas.Unset = schemas.unset
1717

1818

samples/openapi3/client/petstore/python/src/petstore_api/paths/fake/patch/operation.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class BaseApi(api_client.Api):
3333
def _client_model(
3434
self,
3535
body: typing.Union[
36-
request_body.content.application_json.schema.client.ClientDict,
36+
request_body.request_body_client.content.application_json.schema.client.ClientDict,
3737
dict,
3838
immutabledict.immutabledict
3939
],
@@ -49,7 +49,7 @@ def _client_model(
4949
def _client_model(
5050
self,
5151
body: typing.Union[
52-
request_body.content.application_json.schema.client.ClientDict,
52+
request_body.request_body_client.content.application_json.schema.client.ClientDict,
5353
dict,
5454
immutabledict.immutabledict
5555
],
@@ -64,7 +64,7 @@ def _client_model(
6464
def _client_model(
6565
self,
6666
body: typing.Union[
67-
request_body.content.application_json.schema.client.ClientDict,
67+
request_body.request_body_client.content.application_json.schema.client.ClientDict,
6868
dict,
6969
immutabledict.immutabledict
7070
],

0 commit comments

Comments
 (0)