From cc9bd6eb69ec5a3df2d9a3cd1136075e1dff71e0 Mon Sep 17 00:00:00 2001 From: Justin Black Date: Fri, 7 Apr 2023 10:18:35 -0700 Subject: [PATCH 1/3] Adds type hints for path/query/cookie/header params in endpoint code samples --- .../path/verb/_helper_operation_doc_example.hbs | 17 ++++++++++------- .../petstore/python/.openapi-generator/VERSION | 2 +- .../petstore/python/docs/paths/fake/delete.md | 9 +++++---- .../petstore/python/docs/paths/fake/get.md | 5 +++-- .../paths/fake_body_with_query_params/put.md | 3 ++- .../paths/fake_case_sensitive_params/put.md | 3 ++- .../docs/paths/fake_delete_coffee_id/delete.md | 3 ++- .../docs/paths/fake_inline_composition/post.md | 3 ++- .../python/docs/paths/fake_obj_in_query/get.md | 3 ++- .../post.md | 15 ++++++++------- .../post.md | 3 ++- .../get.md | 3 ++- .../docs/paths/fake_ref_obj_in_query/get.md | 3 ++- .../docs/paths/fake_test_query_paramters/put.md | 3 ++- .../python/docs/paths/pet_find_by_status/get.md | 3 ++- .../python/docs/paths/pet_find_by_tags/get.md | 3 ++- .../python/docs/paths/pet_pet_id/delete.md | 7 ++++--- .../python/docs/paths/pet_pet_id/get.md | 3 ++- .../python/docs/paths/pet_pet_id/post.md | 3 ++- .../docs/paths/pet_pet_id_upload_image/post.md | 3 ++- .../docs/paths/store_order_order_id/delete.md | 3 ++- .../docs/paths/store_order_order_id/get.md | 3 ++- .../python/docs/paths/user_login/get.md | 3 ++- .../python/docs/paths/user_username/delete.md | 3 ++- .../python/docs/paths/user_username/get.md | 3 ++- .../python/docs/paths/user_username/put.md | 3 ++- .../test_paths/test_fake/test_get.py | 5 +++-- 27 files changed, 74 insertions(+), 46 deletions(-) diff --git a/modules/openapi-json-schema-generator/src/main/resources/python/paths/path/verb/_helper_operation_doc_example.hbs b/modules/openapi-json-schema-generator/src/main/resources/python/paths/path/verb/_helper_operation_doc_example.hbs index 39b21c25f82..7794cb33ad6 100644 --- a/modules/openapi-json-schema-generator/src/main/resources/python/paths/path/verb/_helper_operation_doc_example.hbs +++ b/modules/openapi-json-schema-generator/src/main/resources/python/paths/path/verb/_helper_operation_doc_example.hbs @@ -10,6 +10,9 @@ from {{packageName}}.{{apiPackage}}.tags import {{moduleName}} {{/if}} {{/each}} {{/if}} +{{#or pathParams queryParams headerParams cookieParams}} +from {{packageName}}.paths.{{path.snakeCase}}.{{jsonPathPiece.original}} import operation +{{/or}} {{#each imports}} {{{.}}} {{/each}} @@ -31,7 +34,7 @@ with {{{packageName}}}.ApiClient(used_configuration) as api_client: # example passing only required values which don't have defaults set {{#if pathParams}} - path_params = { + path_params: operation.RequestPathParameters.Params = { {{#each pathParams}} {{#if refInfo}} {{#if getDeepestRef.required}} @@ -46,7 +49,7 @@ with {{{packageName}}}.ApiClient(used_configuration) as api_client: } {{/if}} {{#if queryParams}} - query_params = { + query_params: operation.RequestQueryParameters.Params = { {{#each queryParams}} {{#if refInfo}} {{#if getDeepestRef.required}} @@ -61,7 +64,7 @@ with {{{packageName}}}.ApiClient(used_configuration) as api_client: } {{/if}} {{#if cookieParams}} - cookie_params = { + cookie_params: operation.RequestCookieParameters.Params = { {{#each cookieParams}} {{#if refInfo}} {{#if getDeepestRef.required}} @@ -76,7 +79,7 @@ with {{{packageName}}}.ApiClient(used_configuration) as api_client: } {{/if}} {{#if headerParams}} - header_params = { + header_params: operation.RequestHeaderParameters.Params = { {{#each headerParams}} {{#if refInfo}} {{#if getDeepestRef.required}} @@ -169,7 +172,7 @@ with {{{packageName}}}.ApiClient(used_configuration) as api_client: } {{/if}} {{#if queryParams}} - query_params = { + query_params: operation.RequestQueryParameters.Params = { {{#each queryParams}} {{#if refInfo}} '{{getDeepestRef.name}}': {{{getDeepestRef.example}}}, @@ -180,7 +183,7 @@ with {{{packageName}}}.ApiClient(used_configuration) as api_client: } {{/if}} {{#if cookieParams}} - cookie_params = { + cookie_params: operation.RequestCookieParameters.Params = { {{#each cookieParams}} {{#if refInfo}} '{{getDeepestRef.name}}': {{{getDeepestRef.example}}}, @@ -191,7 +194,7 @@ with {{{packageName}}}.ApiClient(used_configuration) as api_client: } {{/if}} {{#if headerParams}} - header_params = { + header_params: operation.RequestHeaderParameters.Params = { {{#each headerParams}} {{#if refInfo}} '{{getDeepestRef.name}}': {{{getDeepestRef.example}}}, diff --git a/samples/openapi3/client/petstore/python/.openapi-generator/VERSION b/samples/openapi3/client/petstore/python/.openapi-generator/VERSION index 359a5b952d4..717311e32e3 100644 --- a/samples/openapi3/client/petstore/python/.openapi-generator/VERSION +++ b/samples/openapi3/client/petstore/python/.openapi-generator/VERSION @@ -1 +1 @@ -2.0.0 \ No newline at end of file +unset \ No newline at end of file diff --git a/samples/openapi3/client/petstore/python/docs/paths/fake/delete.md b/samples/openapi3/client/petstore/python/docs/paths/fake/delete.md index aedb2cebb8c..a7640f36abe 100644 --- a/samples/openapi3/client/petstore/python/docs/paths/fake/delete.md +++ b/samples/openapi3/client/petstore/python/docs/paths/fake/delete.md @@ -169,6 +169,7 @@ server_index | Class | Description import petstore_api from petstore_api.configurations import api_configuration from petstore_api.apis.tags import fake_api +from petstore_api.paths.fake.delete import operation from pprint import pprint # security_index 0 from petstore_api.components.security_schemes import security_scheme_bearer_test @@ -189,11 +190,11 @@ with petstore_api.ApiClient(used_configuration) as api_client: api_instance = fake_api.FakeApi(api_client) # example passing only required values which don't have defaults set - query_params = { + query_params: operation.RequestQueryParameters.Params = { 'required_string_group': "required_string_group_example", 'required_int64_group': 1, } - header_params = { + header_params: operation.RequestHeaderParameters.Params = { 'required_boolean_group': "true", } try: @@ -207,13 +208,13 @@ with petstore_api.ApiClient(used_configuration) as api_client: print("Exception when calling FakeApi->group_parameters: %s\n" % e) # example passing only optional values - query_params = { + query_params: operation.RequestQueryParameters.Params = { 'required_string_group': "required_string_group_example", 'required_int64_group': 1, 'string_group': "string_group_example", 'int64_group': 1, } - header_params = { + header_params: operation.RequestHeaderParameters.Params = { 'required_boolean_group': "true", 'boolean_group': "true", } diff --git a/samples/openapi3/client/petstore/python/docs/paths/fake/get.md b/samples/openapi3/client/petstore/python/docs/paths/fake/get.md index 445e96a7c1a..277d5f45275 100644 --- a/samples/openapi3/client/petstore/python/docs/paths/fake/get.md +++ b/samples/openapi3/client/petstore/python/docs/paths/fake/get.md @@ -229,6 +229,7 @@ server_index | Class | Description import petstore_api from petstore_api.configurations import api_configuration from petstore_api.apis.tags import fake_api +from petstore_api.paths.fake.get import operation from pprint import pprint used_configuration = api_configuration.ApiConfiguration( ) @@ -238,7 +239,7 @@ with petstore_api.ApiClient(used_configuration) as api_client: api_instance = fake_api.FakeApi(api_client) # example passing only optional values - query_params = { + query_params: operation.RequestQueryParameters.Params = { 'enum_query_string_array': [ "$" ], @@ -246,7 +247,7 @@ with petstore_api.ApiClient(used_configuration) as api_client: 'enum_query_integer': 1, 'enum_query_double': 1.1, } - header_params = { + header_params: operation.RequestHeaderParameters.Params = { 'enum_header_string_array': [ "$" ], diff --git a/samples/openapi3/client/petstore/python/docs/paths/fake_body_with_query_params/put.md b/samples/openapi3/client/petstore/python/docs/paths/fake_body_with_query_params/put.md index e9cfa1a6308..3c608e29f79 100644 --- a/samples/openapi3/client/petstore/python/docs/paths/fake_body_with_query_params/put.md +++ b/samples/openapi3/client/petstore/python/docs/paths/fake_body_with_query_params/put.md @@ -91,6 +91,7 @@ server_index | Class | Description import petstore_api from petstore_api.configurations import api_configuration from petstore_api.apis.tags import fake_api +from petstore_api.paths.fake_body_with_query_params.put import operation from pprint import pprint used_configuration = api_configuration.ApiConfiguration( ) @@ -100,7 +101,7 @@ with petstore_api.ApiClient(used_configuration) as api_client: api_instance = fake_api.FakeApi(api_client) # example passing only required values which don't have defaults set - query_params = { + query_params: operation.RequestQueryParameters.Params = { 'query': "query_example", } body = user.User( diff --git a/samples/openapi3/client/petstore/python/docs/paths/fake_case_sensitive_params/put.md b/samples/openapi3/client/petstore/python/docs/paths/fake_case_sensitive_params/put.md index 03c094a9f2f..57c5148cb4d 100644 --- a/samples/openapi3/client/petstore/python/docs/paths/fake_case_sensitive_params/put.md +++ b/samples/openapi3/client/petstore/python/docs/paths/fake_case_sensitive_params/put.md @@ -96,6 +96,7 @@ server_index | Class | Description import petstore_api from petstore_api.configurations import api_configuration from petstore_api.apis.tags import fake_api +from petstore_api.paths.fake_case_sensitive_params.put import operation from pprint import pprint used_configuration = api_configuration.ApiConfiguration( ) @@ -105,7 +106,7 @@ with petstore_api.ApiClient(used_configuration) as api_client: api_instance = fake_api.FakeApi(api_client) # example passing only required values which don't have defaults set - query_params = { + query_params: operation.RequestQueryParameters.Params = { 'someVar': "someVar_example", 'SomeVar': "SomeVar_example", 'some_var': "some_var_example", diff --git a/samples/openapi3/client/petstore/python/docs/paths/fake_delete_coffee_id/delete.md b/samples/openapi3/client/petstore/python/docs/paths/fake_delete_coffee_id/delete.md index b638d2c7c5b..62d32bc4cca 100644 --- a/samples/openapi3/client/petstore/python/docs/paths/fake_delete_coffee_id/delete.md +++ b/samples/openapi3/client/petstore/python/docs/paths/fake_delete_coffee_id/delete.md @@ -93,6 +93,7 @@ server_index | Class | Description import petstore_api from petstore_api.configurations import api_configuration from petstore_api.apis.tags import fake_api +from petstore_api.paths.fake_delete_coffee_id.delete import operation from pprint import pprint used_configuration = api_configuration.ApiConfiguration( ) @@ -102,7 +103,7 @@ with petstore_api.ApiClient(used_configuration) as api_client: api_instance = fake_api.FakeApi(api_client) # example passing only required values which don't have defaults set - path_params = { + path_params: operation.RequestPathParameters.Params = { 'id': "id_example", } try: diff --git a/samples/openapi3/client/petstore/python/docs/paths/fake_inline_composition/post.md b/samples/openapi3/client/petstore/python/docs/paths/fake_inline_composition/post.md index cd203a70923..7393154a317 100644 --- a/samples/openapi3/client/petstore/python/docs/paths/fake_inline_composition/post.md +++ b/samples/openapi3/client/petstore/python/docs/paths/fake_inline_composition/post.md @@ -263,6 +263,7 @@ server_index | Class | Description import petstore_api from petstore_api.configurations import api_configuration from petstore_api.apis.tags import fake_api +from petstore_api.paths.fake_inline_composition.post import operation from pprint import pprint used_configuration = api_configuration.ApiConfiguration( ) @@ -272,7 +273,7 @@ with petstore_api.ApiClient(used_configuration) as api_client: api_instance = fake_api.FakeApi(api_client) # example passing only optional values - query_params = { + query_params: operation.RequestQueryParameters.Params = { 'compositionAtRoot': None, 'compositionInProperty': dict( some_prop=None, diff --git a/samples/openapi3/client/petstore/python/docs/paths/fake_obj_in_query/get.md b/samples/openapi3/client/petstore/python/docs/paths/fake_obj_in_query/get.md index 08b4c974b19..3539a9eb19e 100644 --- a/samples/openapi3/client/petstore/python/docs/paths/fake_obj_in_query/get.md +++ b/samples/openapi3/client/petstore/python/docs/paths/fake_obj_in_query/get.md @@ -85,6 +85,7 @@ server_index | Class | Description import petstore_api from petstore_api.configurations import api_configuration from petstore_api.apis.tags import fake_api +from petstore_api.paths.fake_obj_in_query.get import operation from pprint import pprint used_configuration = api_configuration.ApiConfiguration( ) @@ -94,7 +95,7 @@ with petstore_api.ApiClient(used_configuration) as api_client: api_instance = fake_api.FakeApi(api_client) # example passing only optional values - query_params = { + query_params: operation.RequestQueryParameters.Params = { 'mapBean': dict( keyword="keyword_example", ), diff --git a/samples/openapi3/client/petstore/python/docs/paths/fake_parameter_collisions1_abab_self_ab/post.md b/samples/openapi3/client/petstore/python/docs/paths/fake_parameter_collisions1_abab_self_ab/post.md index 854ef458d37..e81c0bf0661 100644 --- a/samples/openapi3/client/petstore/python/docs/paths/fake_parameter_collisions1_abab_self_ab/post.md +++ b/samples/openapi3/client/petstore/python/docs/paths/fake_parameter_collisions1_abab_self_ab/post.md @@ -325,6 +325,7 @@ server_index | Class | Description import petstore_api from petstore_api.configurations import api_configuration from petstore_api.apis.tags import fake_api +from petstore_api.paths.fake_parameter_collisions1_abab_self_ab.post import operation from pprint import pprint used_configuration = api_configuration.ApiConfiguration( ) @@ -334,18 +335,18 @@ with petstore_api.ApiClient(used_configuration) as api_client: api_instance = fake_api.FakeApi(api_client) # example passing only required values which don't have defaults set - path_params = { + path_params: operation.RequestPathParameters.Params = { '1': "1_example", 'aB': "aB_example", 'Ab': "Ab_example", 'self': "self_example", 'A-B': "A-B_example", } - query_params = { + query_params: operation.RequestQueryParameters.Params = { } - cookie_params = { + cookie_params: operation.RequestCookieParameters.Params = { } - header_params = { + header_params: operation.RequestHeaderParameters.Params = { } try: # parameter collision case @@ -367,21 +368,21 @@ with petstore_api.ApiClient(used_configuration) as api_client: 'self': "self_example", 'A-B': "A-B_example", } - query_params = { + query_params: operation.RequestQueryParameters.Params = { '1': "1_example", 'aB': "aB_example", 'Ab': "Ab_example", 'self': "self_example", 'A-B': "A-B_example", } - cookie_params = { + cookie_params: operation.RequestCookieParameters.Params = { '1': "1_example", 'aB': "aB_example", 'Ab': "Ab_example", 'self': "self_example", 'A-B': "A-B_example", } - header_params = { + header_params: operation.RequestHeaderParameters.Params = { '1': "1_example", 'aB': "aB_example", 'self': "self_example", diff --git a/samples/openapi3/client/petstore/python/docs/paths/fake_pet_id_upload_image_with_required_file/post.md b/samples/openapi3/client/petstore/python/docs/paths/fake_pet_id_upload_image_with_required_file/post.md index 74ff2d11c98..a1de2fa1966 100644 --- a/samples/openapi3/client/petstore/python/docs/paths/fake_pet_id_upload_image_with_required_file/post.md +++ b/samples/openapi3/client/petstore/python/docs/paths/fake_pet_id_upload_image_with_required_file/post.md @@ -143,6 +143,7 @@ server_index | Class | Description import petstore_api from petstore_api.configurations import api_configuration from petstore_api.apis.tags import pet_api +from petstore_api.paths.fake_pet_id_upload_image_with_required_file.post import operation from pprint import pprint # security_index 0 from petstore_api.components.security_schemes import security_scheme_petstore_auth @@ -162,7 +163,7 @@ with petstore_api.ApiClient(used_configuration) as api_client: api_instance = pet_api.PetApi(api_client) # example passing only required values which don't have defaults set - path_params = { + path_params: operation.RequestPathParameters.Params = { 'petId': 1, } try: diff --git a/samples/openapi3/client/petstore/python/docs/paths/fake_query_param_with_json_content_type/get.md b/samples/openapi3/client/petstore/python/docs/paths/fake_query_param_with_json_content_type/get.md index e3b7d1dc8c5..8728fb28fe3 100644 --- a/samples/openapi3/client/petstore/python/docs/paths/fake_query_param_with_json_content_type/get.md +++ b/samples/openapi3/client/petstore/python/docs/paths/fake_query_param_with_json_content_type/get.md @@ -109,6 +109,7 @@ server_index | Class | Description import petstore_api from petstore_api.configurations import api_configuration from petstore_api.apis.tags import fake_api +from petstore_api.paths.fake_query_param_with_json_content_type.get import operation from pprint import pprint used_configuration = api_configuration.ApiConfiguration( ) @@ -118,7 +119,7 @@ with petstore_api.ApiClient(used_configuration) as api_client: api_instance = fake_api.FakeApi(api_client) # example passing only required values which don't have defaults set - query_params = { + query_params: operation.RequestQueryParameters.Params = { 'someParam': , } try: diff --git a/samples/openapi3/client/petstore/python/docs/paths/fake_ref_obj_in_query/get.md b/samples/openapi3/client/petstore/python/docs/paths/fake_ref_obj_in_query/get.md index fd0f2812b51..c9cd1e5da55 100644 --- a/samples/openapi3/client/petstore/python/docs/paths/fake_ref_obj_in_query/get.md +++ b/samples/openapi3/client/petstore/python/docs/paths/fake_ref_obj_in_query/get.md @@ -79,6 +79,7 @@ server_index | Class | Description import petstore_api from petstore_api.configurations import api_configuration from petstore_api.apis.tags import fake_api +from petstore_api.paths.fake_ref_obj_in_query.get import operation from pprint import pprint used_configuration = api_configuration.ApiConfiguration( ) @@ -88,7 +89,7 @@ with petstore_api.ApiClient(used_configuration) as api_client: api_instance = fake_api.FakeApi(api_client) # example passing only optional values - query_params = { + query_params: operation.RequestQueryParameters.Params = { 'mapBean': foo.Foo( bar=bar.Bar("bar"), ), diff --git a/samples/openapi3/client/petstore/python/docs/paths/fake_test_query_paramters/put.md b/samples/openapi3/client/petstore/python/docs/paths/fake_test_query_paramters/put.md index 3056cbaf06f..396069c0c34 100644 --- a/samples/openapi3/client/petstore/python/docs/paths/fake_test_query_paramters/put.md +++ b/samples/openapi3/client/petstore/python/docs/paths/fake_test_query_paramters/put.md @@ -151,6 +151,7 @@ server_index | Class | Description import petstore_api from petstore_api.configurations import api_configuration from petstore_api.apis.tags import fake_api +from petstore_api.paths.fake_test_query_paramters.put import operation from pprint import pprint used_configuration = api_configuration.ApiConfiguration( ) @@ -160,7 +161,7 @@ with petstore_api.ApiClient(used_configuration) as api_client: api_instance = fake_api.FakeApi(api_client) # example passing only required values which don't have defaults set - query_params = { + query_params: operation.RequestQueryParameters.Params = { 'pipe': [ "pipe_example" ], diff --git a/samples/openapi3/client/petstore/python/docs/paths/pet_find_by_status/get.md b/samples/openapi3/client/petstore/python/docs/paths/pet_find_by_status/get.md index b38fdda373a..be4403d9294 100644 --- a/samples/openapi3/client/petstore/python/docs/paths/pet_find_by_status/get.md +++ b/samples/openapi3/client/petstore/python/docs/paths/pet_find_by_status/get.md @@ -129,6 +129,7 @@ Key | Type | Description | Notes import petstore_api from petstore_api.configurations import api_configuration from petstore_api.apis.tags import pet_api +from petstore_api.paths.pet_find_by_status.get import operation from pprint import pprint # security_index 0 from petstore_api.components.security_schemes import security_scheme_api_key @@ -185,7 +186,7 @@ with petstore_api.ApiClient(used_configuration) as api_client: api_instance = pet_api.PetApi(api_client) # example passing only required values which don't have defaults set - query_params = { + query_params: operation.RequestQueryParameters.Params = { 'status': [ "available" ], diff --git a/samples/openapi3/client/petstore/python/docs/paths/pet_find_by_tags/get.md b/samples/openapi3/client/petstore/python/docs/paths/pet_find_by_tags/get.md index 43c5022e6e7..d2e6e55400d 100644 --- a/samples/openapi3/client/petstore/python/docs/paths/pet_find_by_tags/get.md +++ b/samples/openapi3/client/petstore/python/docs/paths/pet_find_by_tags/get.md @@ -114,6 +114,7 @@ server_index | Class | Description import petstore_api from petstore_api.configurations import api_configuration from petstore_api.apis.tags import pet_api +from petstore_api.paths.pet_find_by_tags.get import operation from pprint import pprint # security_index 0 from petstore_api.components.security_schemes import security_scheme_http_signature_test @@ -160,7 +161,7 @@ with petstore_api.ApiClient(used_configuration) as api_client: api_instance = pet_api.PetApi(api_client) # example passing only required values which don't have defaults set - query_params = { + query_params: operation.RequestQueryParameters.Params = { 'tags': [ "tags_example" ], diff --git a/samples/openapi3/client/petstore/python/docs/paths/pet_pet_id/delete.md b/samples/openapi3/client/petstore/python/docs/paths/pet_pet_id/delete.md index 31a4a506cd3..e32ba8b5881 100644 --- a/samples/openapi3/client/petstore/python/docs/paths/pet_pet_id/delete.md +++ b/samples/openapi3/client/petstore/python/docs/paths/pet_pet_id/delete.md @@ -126,6 +126,7 @@ server_index | Class | Description import petstore_api from petstore_api.configurations import api_configuration from petstore_api.apis.tags import pet_api +from petstore_api.paths.pet_pet_id.delete import operation from pprint import pprint # security_index 0 from petstore_api.components.security_schemes import security_scheme_api_key @@ -155,10 +156,10 @@ with petstore_api.ApiClient(used_configuration) as api_client: api_instance = pet_api.PetApi(api_client) # example passing only required values which don't have defaults set - path_params = { + path_params: operation.RequestPathParameters.Params = { 'petId': 1, } - header_params = { + header_params: operation.RequestHeaderParameters.Params = { } try: # Deletes a pet @@ -174,7 +175,7 @@ with petstore_api.ApiClient(used_configuration) as api_client: path_params = { 'petId': 1, } - header_params = { + header_params: operation.RequestHeaderParameters.Params = { 'api_key': "api_key_example", } try: diff --git a/samples/openapi3/client/petstore/python/docs/paths/pet_pet_id/get.md b/samples/openapi3/client/petstore/python/docs/paths/pet_pet_id/get.md index 08cd88a646d..c1c422e13c4 100644 --- a/samples/openapi3/client/petstore/python/docs/paths/pet_pet_id/get.md +++ b/samples/openapi3/client/petstore/python/docs/paths/pet_pet_id/get.md @@ -154,6 +154,7 @@ server_index | Class | Description import petstore_api from petstore_api.configurations import api_configuration from petstore_api.apis.tags import pet_api +from petstore_api.paths.pet_pet_id.get import operation from pprint import pprint # security_index 0 from petstore_api.components.security_schemes import security_scheme_api_key @@ -174,7 +175,7 @@ with petstore_api.ApiClient(used_configuration) as api_client: api_instance = pet_api.PetApi(api_client) # example passing only required values which don't have defaults set - path_params = { + path_params: operation.RequestPathParameters.Params = { 'petId': 1, } try: diff --git a/samples/openapi3/client/petstore/python/docs/paths/pet_pet_id/post.md b/samples/openapi3/client/petstore/python/docs/paths/pet_pet_id/post.md index ff345f026cb..631003e0942 100644 --- a/samples/openapi3/client/petstore/python/docs/paths/pet_pet_id/post.md +++ b/samples/openapi3/client/petstore/python/docs/paths/pet_pet_id/post.md @@ -130,6 +130,7 @@ server_index | Class | Description import petstore_api from petstore_api.configurations import api_configuration from petstore_api.apis.tags import pet_api +from petstore_api.paths.pet_pet_id.post import operation from pprint import pprint # security_index 0 from petstore_api.components.security_schemes import security_scheme_api_key @@ -159,7 +160,7 @@ with petstore_api.ApiClient(used_configuration) as api_client: api_instance = pet_api.PetApi(api_client) # example passing only required values which don't have defaults set - path_params = { + path_params: operation.RequestPathParameters.Params = { 'petId': 1, } try: diff --git a/samples/openapi3/client/petstore/python/docs/paths/pet_pet_id_upload_image/post.md b/samples/openapi3/client/petstore/python/docs/paths/pet_pet_id_upload_image/post.md index af2af3bd0cf..b44f8637500 100644 --- a/samples/openapi3/client/petstore/python/docs/paths/pet_pet_id_upload_image/post.md +++ b/samples/openapi3/client/petstore/python/docs/paths/pet_pet_id_upload_image/post.md @@ -118,6 +118,7 @@ server_index | Class | Description import petstore_api from petstore_api.configurations import api_configuration from petstore_api.apis.tags import pet_api +from petstore_api.paths.pet_pet_id_upload_image.post import operation from pprint import pprint # security_index 0 from petstore_api.components.security_schemes import security_scheme_petstore_auth @@ -137,7 +138,7 @@ with petstore_api.ApiClient(used_configuration) as api_client: api_instance = pet_api.PetApi(api_client) # example passing only required values which don't have defaults set - path_params = { + path_params: operation.RequestPathParameters.Params = { 'petId': 1, } try: diff --git a/samples/openapi3/client/petstore/python/docs/paths/store_order_order_id/delete.md b/samples/openapi3/client/petstore/python/docs/paths/store_order_order_id/delete.md index 65d92b8b0b5..d1940363207 100644 --- a/samples/openapi3/client/petstore/python/docs/paths/store_order_order_id/delete.md +++ b/samples/openapi3/client/petstore/python/docs/paths/store_order_order_id/delete.md @@ -105,6 +105,7 @@ server_index | Class | Description import petstore_api from petstore_api.configurations import api_configuration from petstore_api.apis.tags import store_api +from petstore_api.paths.store_order_order_id.delete import operation from pprint import pprint used_configuration = api_configuration.ApiConfiguration( ) @@ -114,7 +115,7 @@ with petstore_api.ApiClient(used_configuration) as api_client: api_instance = store_api.StoreApi(api_client) # example passing only required values which don't have defaults set - path_params = { + path_params: operation.RequestPathParameters.Params = { 'order_id': "order_id_example", } try: diff --git a/samples/openapi3/client/petstore/python/docs/paths/store_order_order_id/get.md b/samples/openapi3/client/petstore/python/docs/paths/store_order_order_id/get.md index 2778fffbe50..d58992d9dfe 100644 --- a/samples/openapi3/client/petstore/python/docs/paths/store_order_order_id/get.md +++ b/samples/openapi3/client/petstore/python/docs/paths/store_order_order_id/get.md @@ -139,6 +139,7 @@ server_index | Class | Description import petstore_api from petstore_api.configurations import api_configuration from petstore_api.apis.tags import store_api +from petstore_api.paths.store_order_order_id.get import operation from pprint import pprint used_configuration = api_configuration.ApiConfiguration( ) @@ -148,7 +149,7 @@ with petstore_api.ApiClient(used_configuration) as api_client: api_instance = store_api.StoreApi(api_client) # example passing only required values which don't have defaults set - path_params = { + path_params: operation.RequestPathParameters.Params = { 'order_id': 1, } try: diff --git a/samples/openapi3/client/petstore/python/docs/paths/user_login/get.md b/samples/openapi3/client/petstore/python/docs/paths/user_login/get.md index e525d21c750..10f5acb493b 100644 --- a/samples/openapi3/client/petstore/python/docs/paths/user_login/get.md +++ b/samples/openapi3/client/petstore/python/docs/paths/user_login/get.md @@ -178,6 +178,7 @@ server_index | Class | Description import petstore_api from petstore_api.configurations import api_configuration from petstore_api.apis.tags import user_api +from petstore_api.paths.user_login.get import operation from pprint import pprint used_configuration = api_configuration.ApiConfiguration( ) @@ -187,7 +188,7 @@ with petstore_api.ApiClient(used_configuration) as api_client: api_instance = user_api.UserApi(api_client) # example passing only required values which don't have defaults set - query_params = { + query_params: operation.RequestQueryParameters.Params = { 'username': "username_example", 'password': "password_example", } diff --git a/samples/openapi3/client/petstore/python/docs/paths/user_username/delete.md b/samples/openapi3/client/petstore/python/docs/paths/user_username/delete.md index 5f10a694961..96795fe829b 100644 --- a/samples/openapi3/client/petstore/python/docs/paths/user_username/delete.md +++ b/samples/openapi3/client/petstore/python/docs/paths/user_username/delete.md @@ -81,6 +81,7 @@ server_index | Class | Description import petstore_api from petstore_api.configurations import api_configuration from petstore_api.apis.tags import user_api +from petstore_api.paths.user_username.delete import operation from pprint import pprint used_configuration = api_configuration.ApiConfiguration( ) @@ -90,7 +91,7 @@ with petstore_api.ApiClient(used_configuration) as api_client: api_instance = user_api.UserApi(api_client) # example passing only required values which don't have defaults set - path_params = { + path_params: operation.RequestPathParameters.Params = { 'username': "username_example", } try: diff --git a/samples/openapi3/client/petstore/python/docs/paths/user_username/get.md b/samples/openapi3/client/petstore/python/docs/paths/user_username/get.md index b7311b646b1..d5874d7a7ae 100644 --- a/samples/openapi3/client/petstore/python/docs/paths/user_username/get.md +++ b/samples/openapi3/client/petstore/python/docs/paths/user_username/get.md @@ -126,6 +126,7 @@ server_index | Class | Description import petstore_api from petstore_api.configurations import api_configuration from petstore_api.apis.tags import user_api +from petstore_api.paths.user_username.get import operation from pprint import pprint used_configuration = api_configuration.ApiConfiguration( ) @@ -135,7 +136,7 @@ with petstore_api.ApiClient(used_configuration) as api_client: api_instance = user_api.UserApi(api_client) # example passing only required values which don't have defaults set - path_params = { + path_params: operation.RequestPathParameters.Params = { 'username': "username_example", } try: diff --git a/samples/openapi3/client/petstore/python/docs/paths/user_username/put.md b/samples/openapi3/client/petstore/python/docs/paths/user_username/put.md index 74d3e281e5f..290597873ef 100644 --- a/samples/openapi3/client/petstore/python/docs/paths/user_username/put.md +++ b/samples/openapi3/client/petstore/python/docs/paths/user_username/put.md @@ -112,6 +112,7 @@ server_index | Class | Description import petstore_api from petstore_api.configurations import api_configuration from petstore_api.apis.tags import user_api +from petstore_api.paths.user_username.put import operation from pprint import pprint used_configuration = api_configuration.ApiConfiguration( ) @@ -121,7 +122,7 @@ with petstore_api.ApiClient(used_configuration) as api_client: api_instance = user_api.UserApi(api_client) # example passing only required values which don't have defaults set - path_params = { + path_params: operation.RequestPathParameters.Params = { 'username': "username_example", } body = user.User( diff --git a/samples/openapi3/client/petstore/python/tests_manual/test_paths/test_fake/test_get.py b/samples/openapi3/client/petstore/python/tests_manual/test_paths/test_fake/test_get.py index 8f5b412e503..eab517b41d0 100644 --- a/samples/openapi3/client/petstore/python/tests_manual/test_paths/test_fake/test_get.py +++ b/samples/openapi3/client/petstore/python/tests_manual/test_paths/test_fake/test_get.py @@ -33,7 +33,8 @@ def test_passed_in_header_overrides_default(self, mock_request): mock_request.return_value = self.response(b'') api = get.ApiForGet(api_client=self.used_api_client) - api_response = api.get(header_params={'enum_header_string': '-efg'}) + header_params: get.RequestHeaderParameters.Params = {'enum_header_string': '-efg'} + api_response = api.get(header_params) self.assert_pool_manager_request_called_with( mock_request, f'http://petstore.swagger.io:80/v2/fake', @@ -82,7 +83,7 @@ def test_response_exception_info(self, mock_request): with self.assertRaises(petstore_api.ApiException) as cm: api_response = api.get() - exc: petstore_api.ApiException[get.ApiResponseFor404] = cm.exception + exc: petstore_api.ApiException[get.response_404.ResponseFor404] = cm.exception expected_status = 404 expected_reason = '404' self.assertEqual(exc.status, expected_status) From 5e086b39da9b54222e25606e303041bfd5a640b7 Mon Sep 17 00:00:00 2001 From: Justin Black Date: Fri, 7 Apr 2023 10:33:47 -0700 Subject: [PATCH 2/3] Samples regen --- .../python/docs/apis/tags/DefaultApi.md | 10 ---------- .../client/petstore/python/.openapi-generator/VERSION | 2 +- 2 files changed, 1 insertion(+), 11 deletions(-) delete mode 100644 samples/openapi3/client/features/nonCompliantUseDiscriminatorIfCompositionFails/python/docs/apis/tags/DefaultApi.md diff --git a/samples/openapi3/client/features/nonCompliantUseDiscriminatorIfCompositionFails/python/docs/apis/tags/DefaultApi.md b/samples/openapi3/client/features/nonCompliantUseDiscriminatorIfCompositionFails/python/docs/apis/tags/DefaultApi.md deleted file mode 100644 index fdf429d9389..00000000000 --- a/samples/openapi3/client/features/nonCompliantUseDiscriminatorIfCompositionFails/python/docs/apis/tags/DefaultApi.md +++ /dev/null @@ -1,10 +0,0 @@ - -# this_package.apis.tags.default_api.DefaultApi - -All URIs are relative to *http://localhost:3000* - -Method | HTTP request | Description -------------- | ------------- | ------------- -[**post_operators**](default_api/post_operators.md) | **post** /operators | - -[[Back to top]](#top) [[Back to Endpoints]](../../../README.md#Endpoints) [[Back to README]](../../../README.md) diff --git a/samples/openapi3/client/petstore/python/.openapi-generator/VERSION b/samples/openapi3/client/petstore/python/.openapi-generator/VERSION index 717311e32e3..359a5b952d4 100644 --- a/samples/openapi3/client/petstore/python/.openapi-generator/VERSION +++ b/samples/openapi3/client/petstore/python/.openapi-generator/VERSION @@ -1 +1 @@ -unset \ No newline at end of file +2.0.0 \ No newline at end of file From d2fccc9ff4429fc05e4c4432c7161834c2a58e0d Mon Sep 17 00:00:00 2001 From: Justin Black Date: Fri, 7 Apr 2023 10:41:17 -0700 Subject: [PATCH 3/3] Simplifies makefiles --- samples/openapi3/client/3_0_3_unit_test/python/Makefile | 3 --- .../python/Makefile | 3 --- samples/openapi3/client/features/security/python/Makefile | 3 --- samples/openapi3/client/petstore/python/Makefile | 3 --- .../python/tests_manual/test_paths/test_fake/test_get.py | 2 +- 5 files changed, 1 insertion(+), 13 deletions(-) diff --git a/samples/openapi3/client/3_0_3_unit_test/python/Makefile b/samples/openapi3/client/3_0_3_unit_test/python/Makefile index 863c380ebef..b73277d308c 100644 --- a/samples/openapi3/client/3_0_3_unit_test/python/Makefile +++ b/samples/openapi3/client/3_0_3_unit_test/python/Makefile @@ -1,10 +1,7 @@ -REQUIREMENTS_FILE=dev-requirements.txt -REQUIREMENTS_OUT=dev-requirements.txt.log SETUP_OUT=*.egg-info VENV=venv clean: - rm -rf $(REQUIREMENTS_OUT) rm -rf $(SETUP_OUT) rm -rf $(VENV) rm -rf .tox diff --git a/samples/openapi3/client/features/nonCompliantUseDiscriminatorIfCompositionFails/python/Makefile b/samples/openapi3/client/features/nonCompliantUseDiscriminatorIfCompositionFails/python/Makefile index 863c380ebef..b73277d308c 100644 --- a/samples/openapi3/client/features/nonCompliantUseDiscriminatorIfCompositionFails/python/Makefile +++ b/samples/openapi3/client/features/nonCompliantUseDiscriminatorIfCompositionFails/python/Makefile @@ -1,10 +1,7 @@ -REQUIREMENTS_FILE=dev-requirements.txt -REQUIREMENTS_OUT=dev-requirements.txt.log SETUP_OUT=*.egg-info VENV=venv clean: - rm -rf $(REQUIREMENTS_OUT) rm -rf $(SETUP_OUT) rm -rf $(VENV) rm -rf .tox diff --git a/samples/openapi3/client/features/security/python/Makefile b/samples/openapi3/client/features/security/python/Makefile index 863c380ebef..b73277d308c 100644 --- a/samples/openapi3/client/features/security/python/Makefile +++ b/samples/openapi3/client/features/security/python/Makefile @@ -1,10 +1,7 @@ -REQUIREMENTS_FILE=dev-requirements.txt -REQUIREMENTS_OUT=dev-requirements.txt.log SETUP_OUT=*.egg-info VENV=venv clean: - rm -rf $(REQUIREMENTS_OUT) rm -rf $(SETUP_OUT) rm -rf $(VENV) rm -rf .tox diff --git a/samples/openapi3/client/petstore/python/Makefile b/samples/openapi3/client/petstore/python/Makefile index 863c380ebef..b73277d308c 100644 --- a/samples/openapi3/client/petstore/python/Makefile +++ b/samples/openapi3/client/petstore/python/Makefile @@ -1,10 +1,7 @@ -REQUIREMENTS_FILE=dev-requirements.txt -REQUIREMENTS_OUT=dev-requirements.txt.log SETUP_OUT=*.egg-info VENV=venv clean: - rm -rf $(REQUIREMENTS_OUT) rm -rf $(SETUP_OUT) rm -rf $(VENV) rm -rf .tox diff --git a/samples/openapi3/client/petstore/python/tests_manual/test_paths/test_fake/test_get.py b/samples/openapi3/client/petstore/python/tests_manual/test_paths/test_fake/test_get.py index eab517b41d0..6deda2d7391 100644 --- a/samples/openapi3/client/petstore/python/tests_manual/test_paths/test_fake/test_get.py +++ b/samples/openapi3/client/petstore/python/tests_manual/test_paths/test_fake/test_get.py @@ -34,7 +34,7 @@ def test_passed_in_header_overrides_default(self, mock_request): api = get.ApiForGet(api_client=self.used_api_client) header_params: get.RequestHeaderParameters.Params = {'enum_header_string': '-efg'} - api_response = api.get(header_params) + api_response = api.get(header_params=header_params) self.assert_pool_manager_request_called_with( mock_request, f'http://petstore.swagger.io:80/v2/fake',