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

Commit 4806ecd

Browse files
authored
Adds pathItem common parameters (#256)
* Regens petstore with 1 new route with 3 verbs * Stores path item parameters * Gens path item param in python * Adds missing init file in path item parameters folder * Moves path item param generation beforeoperation generation * Adds pathItemParameters as input in fromOperation * Adds pathItemParams to operation typeddicts * Fixes path parameter schema types * Uses enum in common param * Stores path item parameters in a list * Adds code to use path item parameters in endpoints * Fixes templates * Refactors parameter schema names, creates ParameterCollection to hold all/path/query/header/cookie params * Removes queryParams * Removes headerParams * Removes cookieParams * Replaces pathItemParameters with collection * Removes pathItemPathParams * Removes pathItemQueryParams * Removes pathItemHeaderParams * Removes pathItemCookieParams * Samples regen * Fixes bug where common parameter had incorrect path * Adds python tests of 3 routes containing pathItem parameters, one where it is overridden * Updates endpoint docs
1 parent 81e1156 commit 4806ecd

File tree

72 files changed

+2997
-381
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+2997
-381
lines changed

Diff for: samples/client/petstore/python/.openapi-generator/FILES

+49
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,14 @@ docs/components/security_schemes/security_scheme_open_id_connect_test.md
193193
docs/components/security_schemes/security_scheme_petstore_auth.md
194194
docs/paths/another_fake_dummy/patch.md
195195
docs/paths/another_fake_dummy/patch/responses/response_200/content/application_json/schema.md
196+
docs/paths/common_param_sub_dir/delete.md
197+
docs/paths/common_param_sub_dir/delete/parameters/parameter_0/schema.md
198+
docs/paths/common_param_sub_dir/delete/parameters/parameter_1/schema.md
199+
docs/paths/common_param_sub_dir/get.md
200+
docs/paths/common_param_sub_dir/get/parameters/parameter_0/schema.md
201+
docs/paths/common_param_sub_dir/parameters/parameter_0/schema.md
202+
docs/paths/common_param_sub_dir/post.md
203+
docs/paths/common_param_sub_dir/post/parameters/parameter_0/schema.md
196204
docs/paths/fake/delete.md
197205
docs/paths/fake/delete/parameters/parameter_0/schema.md
198206
docs/paths/fake/delete/parameters/parameter_1/schema.md
@@ -407,6 +415,7 @@ src/petstore_api/apis/__init__.py
407415
src/petstore_api/apis/path_to_api.py
408416
src/petstore_api/apis/paths/__init__.py
409417
src/petstore_api/apis/paths/another_fake_dummy.py
418+
src/petstore_api/apis/paths/common_param_sub_dir.py
410419
src/petstore_api/apis/paths/fake.py
411420
src/petstore_api/apis/paths/fake_additional_properties_with_array_of_enums.py
412421
src/petstore_api/apis/paths/fake_body_with_file_schema.py
@@ -706,6 +715,39 @@ src/petstore_api/paths/another_fake_dummy/patch/responses/response_200/__init__.
706715
src/petstore_api/paths/another_fake_dummy/patch/responses/response_200/content/__init__.py
707716
src/petstore_api/paths/another_fake_dummy/patch/responses/response_200/content/application_json/__init__.py
708717
src/petstore_api/paths/another_fake_dummy/patch/responses/response_200/content/application_json/schema.py
718+
src/petstore_api/paths/common_param_sub_dir/__init__.py
719+
src/petstore_api/paths/common_param_sub_dir/delete/__init__.py
720+
src/petstore_api/paths/common_param_sub_dir/delete/header_parameters.py
721+
src/petstore_api/paths/common_param_sub_dir/delete/operation.py
722+
src/petstore_api/paths/common_param_sub_dir/delete/parameters/__init__.py
723+
src/petstore_api/paths/common_param_sub_dir/delete/parameters/parameter_0/__init__.py
724+
src/petstore_api/paths/common_param_sub_dir/delete/parameters/parameter_0/schema.py
725+
src/petstore_api/paths/common_param_sub_dir/delete/parameters/parameter_1/__init__.py
726+
src/petstore_api/paths/common_param_sub_dir/delete/parameters/parameter_1/schema.py
727+
src/petstore_api/paths/common_param_sub_dir/delete/path_parameters.py
728+
src/petstore_api/paths/common_param_sub_dir/delete/responses/__init__.py
729+
src/petstore_api/paths/common_param_sub_dir/delete/responses/response_200/__init__.py
730+
src/petstore_api/paths/common_param_sub_dir/get/__init__.py
731+
src/petstore_api/paths/common_param_sub_dir/get/operation.py
732+
src/petstore_api/paths/common_param_sub_dir/get/parameters/__init__.py
733+
src/petstore_api/paths/common_param_sub_dir/get/parameters/parameter_0/__init__.py
734+
src/petstore_api/paths/common_param_sub_dir/get/parameters/parameter_0/schema.py
735+
src/petstore_api/paths/common_param_sub_dir/get/path_parameters.py
736+
src/petstore_api/paths/common_param_sub_dir/get/query_parameters.py
737+
src/petstore_api/paths/common_param_sub_dir/get/responses/__init__.py
738+
src/petstore_api/paths/common_param_sub_dir/get/responses/response_200/__init__.py
739+
src/petstore_api/paths/common_param_sub_dir/parameters/__init__.py
740+
src/petstore_api/paths/common_param_sub_dir/parameters/parameter_0/__init__.py
741+
src/petstore_api/paths/common_param_sub_dir/parameters/parameter_0/schema.py
742+
src/petstore_api/paths/common_param_sub_dir/post/__init__.py
743+
src/petstore_api/paths/common_param_sub_dir/post/header_parameters.py
744+
src/petstore_api/paths/common_param_sub_dir/post/operation.py
745+
src/petstore_api/paths/common_param_sub_dir/post/parameters/__init__.py
746+
src/petstore_api/paths/common_param_sub_dir/post/parameters/parameter_0/__init__.py
747+
src/petstore_api/paths/common_param_sub_dir/post/parameters/parameter_0/schema.py
748+
src/petstore_api/paths/common_param_sub_dir/post/path_parameters.py
749+
src/petstore_api/paths/common_param_sub_dir/post/responses/__init__.py
750+
src/petstore_api/paths/common_param_sub_dir/post/responses/response_200/__init__.py
709751
src/petstore_api/paths/fake/__init__.py
710752
src/petstore_api/paths/fake/delete/__init__.py
711753
src/petstore_api/paths/fake/delete/header_parameters.py
@@ -1610,8 +1652,15 @@ test/test_paths/__init__.py
16101652
test/test_paths/__init__.py
16111653
test/test_paths/__init__.py
16121654
test/test_paths/__init__.py
1655+
test/test_paths/__init__.py
1656+
test/test_paths/__init__.py
1657+
test/test_paths/__init__.py
16131658
test/test_paths/test_another_fake_dummy/__init__.py
16141659
test/test_paths/test_another_fake_dummy/test_patch.py
1660+
test/test_paths/test_common_param_sub_dir/__init__.py
1661+
test/test_paths/test_common_param_sub_dir/test_delete.py
1662+
test/test_paths/test_common_param_sub_dir/test_get.py
1663+
test/test_paths/test_common_param_sub_dir/test_post.py
16151664
test/test_paths/test_fake/__init__.py
16161665
test/test_paths/test_fake/test_delete.py
16171666
test/test_paths/test_fake/test_get.py

Diff for: samples/client/petstore/python/README.md

+3
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,9 @@ HTTP request | Method | Description
172172
------------ | ------ | -------------
173173
/ **get** | [FakeApi](docs/apis/tags/fake_api.md).[slash_route](docs/paths/solidus/get.md) | slash route
174174
/another-fake/dummy **patch** | [AnotherFakeApi](docs/apis/tags/another_fake_api.md).[call_123_test__special_tags](docs/paths/another_fake_dummy/patch.md) | To test special tags
175+
/commonParam/{subDir}/ **delete** | [FakeApi](docs/apis/tags/fake_api.md).[delete_common_param](docs/paths/common_param_sub_dir/delete.md) |
176+
/commonParam/{subDir}/ **get** | [FakeApi](docs/apis/tags/fake_api.md).[get_common_param](docs/paths/common_param_sub_dir/get.md) |
177+
/commonParam/{subDir}/ **post** | [FakeApi](docs/apis/tags/fake_api.md).[post_common_param](docs/paths/common_param_sub_dir/post.md) |
175178
/fake **delete** | [FakeApi](docs/apis/tags/fake_api.md).[group_parameters](docs/paths/fake/delete.md) | Fake endpoint to test group parameters (optional)
176179
/fake **get** | [FakeApi](docs/apis/tags/fake_api.md).[enum_parameters](docs/paths/fake/get.md) | To test enum parameters
177180
/fake **patch** | [FakeApi](docs/apis/tags/fake_api.md).[client_model](docs/paths/fake/patch.md) | To test \"client\" model

Diff for: samples/client/petstore/python/docs/apis/tags/fake_api.md

+3
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,11 @@ Method | Description
1919
[**client_model**](../../paths/fake/patch.md) | To test \"client\" model
2020
[**composed_one_of_different_types**](../../paths/fake_refs_composed_one_of_number_with_validations/post.md) |
2121
[**delete_coffee**](../../paths/fake_delete_coffee_id/delete.md) | Delete coffee
22+
[**delete_common_param**](../../paths/common_param_sub_dir/delete.md) |
2223
[**endpoint_parameters**](../../paths/fake/post.md) | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
2324
[**enum_parameters**](../../paths/fake/get.md) | To test enum parameters
2425
[**fake_health_get**](../../paths/fake_health/get.md) | Health check endpoint
26+
[**get_common_param**](../../paths/common_param_sub_dir/get.md) |
2527
[**group_parameters**](../../paths/fake/delete.md) | Fake endpoint to test group parameters (optional)
2628
[**inline_additional_properties**](../../paths/fake_inline_additional_properties/post.md) | test inline additionalProperties
2729
[**inline_composition**](../../paths/fake_inline_composition/post.md) | testing composed schemas at inline locations
@@ -36,6 +38,7 @@ Method | Description
3638
[**object_in_query**](../../paths/fake_obj_in_query/get.md) | user list
3739
[**object_model_with_ref_props**](../../paths/fake_refs_object_model_with_ref_props/post.md) |
3840
[**parameter_collisions**](../../paths/fake_parameter_collisions1_abab_self_ab/post.md) | parameter collision case
41+
[**post_common_param**](../../paths/common_param_sub_dir/post.md) |
3942
[**query_param_with_json_content_type**](../../paths/fake_query_param_with_json_content_type/get.md) | query param with json content-type
4043
[**query_parameter_collection_format**](../../paths/fake_test_query_paramters/put.md) |
4144
[**redirection**](../../paths/fake_redirection/get.md) | operation with redirection responses
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,181 @@
1+
petstore_api.paths.common_param_sub_dir.operation
2+
# Operation Method Name
3+
4+
| Method Name | Api Class | Notes |
5+
| ----------- | --------- | ----- |
6+
| delete_common_param | [FakeApi](../../apis/tags/fake_api.md) | This api is only for tag=fake |
7+
| delete | ApiForDelete | This api is only for this endpoint |
8+
| delete | CommonParamSubDir | This api is only for path=/commonParam/{subDir}/ |
9+
10+
## Table of Contents
11+
- [General Info](#general-info)
12+
- [Arguments](#arguments)
13+
- [Return Types](#return-types)
14+
- [Servers](#servers)
15+
- [Code Sample](#code-sample)
16+
17+
## General Info
18+
| Field | Value |
19+
| ----- | ----- |
20+
| Description | common param is overwritten |
21+
| Path | "/commonParam/{subDir}/" |
22+
| HTTP Method | delete |
23+
24+
## Arguments
25+
26+
Name | Type | Description | Notes
27+
------------- | ------------- | ------------- | -------------
28+
[header_params](#header_params) | [HeaderParametersDictInput](#headerparameters-headerparametersdictinput), [HeaderParametersDict](#headerparameters-headerparametersdict) | |
29+
[path_params](#path_params) | [PathParametersDictInput](#pathparameters-pathparametersdictinput), [PathParametersDict](#pathparameters-pathparametersdict) | |
30+
server_index | typing.Optional[int] | default is None | Allows one to select a different [server](#servers). If not None, must be one of [0, 1, 2]
31+
stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file
32+
timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client
33+
skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_response.ApiResponseWithoutDeserialization will be returned
34+
### header_params
35+
### HeaderParameters
36+
```
37+
type: schemas.Schema
38+
```
39+
40+
#### validate method
41+
Input Type | Return Type | Notes
42+
------------ | ------------- | -------------
43+
[HeaderParametersDictInput](#headerparameters-headerparametersdictinput), [HeaderParametersDict](#headerparameters-headerparametersdict) | [HeaderParametersDict](#headerparameters-headerparametersdict) |
44+
45+
#### HeaderParameters HeaderParametersDictInput
46+
```
47+
type: typing.TypedDict
48+
```
49+
Key | Type | Description | Notes
50+
------------ | ------------- | ------------- | -------------
51+
**someHeader** | str | | [optional]
52+
53+
#### HeaderParameters HeaderParametersDict
54+
```
55+
base class: schemas.immutabledict[str, str]
56+
57+
```
58+
##### __new__ method
59+
Keyword Argument | Type | Description | Notes
60+
---------------- | ---- | ----------- | -----
61+
**someHeader** | str, schemas.Unset | | [optional]
62+
63+
##### properties
64+
Property | Type | Description | Notes
65+
-------- | ---- | ----------- | -----
66+
**someHeader** | str, schemas.Unset | | [optional]
67+
68+
##### methods
69+
Method | Input Type | Return Type | Notes
70+
------ | ---------- | ----------- | ------
71+
from_dict_ | [HeaderParametersDictInput](#headerparameters-headerparametersdictinput), [HeaderParametersDict](#headerparameters-headerparametersdict) | [HeaderParametersDict](#headerparameters-headerparametersdict) | a constructor
72+
### path_params
73+
### PathParameters
74+
```
75+
type: schemas.Schema
76+
```
77+
78+
#### validate method
79+
Input Type | Return Type | Notes
80+
------------ | ------------- | -------------
81+
[PathParametersDictInput](#pathparameters-pathparametersdictinput), [PathParametersDict](#pathparameters-pathparametersdict) | [PathParametersDict](#pathparameters-pathparametersdict) |
82+
83+
#### PathParameters PathParametersDictInput
84+
```
85+
type: typing.TypedDict
86+
```
87+
Key | Type | Description | Notes
88+
------------ | ------------- | ------------- | -------------
89+
**subDir** | typing.Literal["c", "d"] | |
90+
91+
#### PathParameters PathParametersDict
92+
```
93+
base class: schemas.immutabledict[str, typing.Literal["c", "d"]]
94+
95+
```
96+
##### __new__ method
97+
Keyword Argument | Type | Description | Notes
98+
---------------- | ---- | ----------- | -----
99+
**subDir** | typing.Literal["c", "d"] | |
100+
101+
##### properties
102+
Property | Type | Description | Notes
103+
-------- | ---- | ----------- | -----
104+
**subDir** | typing.Literal["c", "d"] | |
105+
106+
##### methods
107+
Method | Input Type | Return Type | Notes
108+
------ | ---------- | ----------- | ------
109+
from_dict_ | [PathParametersDictInput](#pathparameters-pathparametersdictinput), [PathParametersDict](#pathparameters-pathparametersdict) | [PathParametersDict](#pathparameters-pathparametersdict) | a constructor
110+
111+
## Return Types
112+
113+
HTTP Status Code | Class | Description
114+
------------- | ------------- | -------------
115+
n/a | api_response.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned
116+
200 | [SuccessDescriptionOnly.ApiResponse](../../components/responses/response_success_description_only.md#apiresponse) | Success
117+
118+
## Servers
119+
120+
Set the available servers by defining your used servers in ApiConfiguration.server_info
121+
Then select your server by setting a server index in ApiConfiguration.server_index_info or by
122+
passing server_index in to the endpoint method.
123+
- these servers are the general api servers
124+
- defaults to server_index=0, server.url = http://petstore.swagger.io:80/v2
125+
126+
server_index | Class | Description
127+
------------ | ----- | ------------
128+
0 | [Server0](../../servers/server_0.md) | petstore server
129+
1 | [Server1](../../servers/server_1.md) | The local server
130+
2 | [Server2](../../servers/server_2.md) | staging server with no variables
131+
132+
## Code Sample
133+
134+
```python
135+
import petstore_api
136+
from petstore_api.configurations import api_configuration
137+
from petstore_api.apis.tags import fake_api
138+
from petstore_api.paths.common_param_sub_dir.delete import operation
139+
from pprint import pprint
140+
used_configuration = api_configuration.ApiConfiguration(
141+
)
142+
# Enter a context with an instance of the API client
143+
with petstore_api.ApiClient(used_configuration) as api_client:
144+
# Create an instance of the API class
145+
api_instance = fake_api.FakeApi(api_client)
146+
147+
# example passing only required values which don't have defaults set
148+
path_params: operation.PathParametersDictInput = {
149+
'subDir': "c",
150+
}
151+
header_params: operation.HeaderParametersDictInput = {
152+
}
153+
try:
154+
api_response = api_instance.delete_common_param(
155+
path_params=path_params,
156+
header_params=header_params,
157+
)
158+
pprint(api_response)
159+
except petstore_api.ApiException as e:
160+
print("Exception when calling FakeApi->delete_common_param: %s\n" % e)
161+
162+
# example passing only optional values
163+
path_params = {
164+
'subDir': "c",
165+
}
166+
header_params: operation.HeaderParametersDictInput = {
167+
'someHeader': "someHeader_example",
168+
}
169+
try:
170+
api_response = api_instance.delete_common_param(
171+
path_params=path_params,
172+
header_params=header_params,
173+
)
174+
pprint(api_response)
175+
except petstore_api.ApiException as e:
176+
print("Exception when calling FakeApi->delete_common_param: %s\n" % e)
177+
```
178+
179+
[[Back to top]](#top)
180+
[[Back to FakeApi API]](../../apis/tags/fake_api.md)
181+
[[Back to Endpoints]](../../../README.md#Endpoints) [[Back to README]](../../../README.md)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Schema
2+
petstore_api.paths.common_param_sub_dir.delete.parameters.parameter_0.schema
3+
```
4+
type: schemas.Schema
5+
```
6+
7+
## validate method
8+
Input Type | Return Type | Notes
9+
------------ | ------------- | -------------
10+
str | str |
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Schema
2+
petstore_api.paths.common_param_sub_dir.delete.parameters.parameter_1.schema
3+
```
4+
type: schemas.Schema
5+
```
6+
7+
## validate method
8+
Input Type | Return Type | Notes
9+
------------ | ------------- | -------------
10+
typing.Literal["c", "d"] | typing.Literal["c", "d"] | must be one of ["c", "d"]

0 commit comments

Comments
 (0)