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

Commit 5428fa3

Browse files
authored
Python client, adds test of pem content type send and receive (#353)
* Python petstore client regen with new route * Samples regen
1 parent 3f5c532 commit 5428fa3

File tree

592 files changed

+1199
-770
lines changed

Some content is hidden

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

592 files changed

+1199
-770
lines changed

samples/client/petstore/java/.openapi-generator/FILES

+4
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,8 @@ docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter8/Schema8
228228
docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter9/Schema9.md
229229
docs/paths/fakeparametercollisions1ababselfab/post/requestbody/content/applicationjson/Schema.md
230230
docs/paths/fakeparametercollisions1ababselfab/post/responses/response200/content/applicationjson/Schema.md
231+
docs/paths/fakepemcontenttype/get/requestbody/content/applicationxpemfile/Schema.md
232+
docs/paths/fakepemcontenttype/get/responses/response200/content/applicationxpemfile/Schema.md
231233
docs/paths/fakepetiduploadimagewithrequiredfile/post/parameters/parameter0/Schema0.md
232234
docs/paths/fakepetiduploadimagewithrequiredfile/post/requestbody/content/multipartformdata/Schema.md
233235
docs/paths/fakepetiduploadimagewithrequiredfile/post/responses/response200/content/applicationjson/Schema.md
@@ -558,6 +560,8 @@ src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ab
558560
src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter9/Schema9.java
559561
src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/requestbody/content/applicationjson/Schema.java
560562
src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/responses/response200/content/applicationjson/Schema.java
563+
src/main/java/org/openapijsonschematools/client/paths/fakepemcontenttype/get/requestbody/content/applicationxpemfile/Schema.java
564+
src/main/java/org/openapijsonschematools/client/paths/fakepemcontenttype/get/responses/response200/content/applicationxpemfile/Schema.java
561565
src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/PathParameters.java
562566
src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/parameters/parameter0/Schema0.java
563567
src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/requestbody/content/multipartformdata/Schema.java

samples/client/petstore/java/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: " \
2+
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose.
33

44
This Java package is automatically generated by the [OpenAPI JSON Schema Generator](https://github.com/openapi-json-schema-tools/openapi-json-schema-generator) project:
55

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Schema
2+
public class Schema
3+
4+
A class that contains necessary nested
5+
- schema classes (which validate payloads), extends JsonSchema
6+
7+
## Nested Class Summary
8+
| Modifier and Type | Class and Description |
9+
| ----------------- | ---------------------- |
10+
| static class | [Schema.Schema1](#schema1)<br> schema class |
11+
12+
## Schema1
13+
public static class Schema1<br>
14+
extends StringJsonSchema
15+
16+
A schema class that validates payloads
17+
18+
| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema |
19+
| ------------------------------------------------------------------ |
20+
| validate |
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Schema
2+
public class Schema
3+
4+
A class that contains necessary nested
5+
- schema classes (which validate payloads), extends JsonSchema
6+
7+
## Nested Class Summary
8+
| Modifier and Type | Class and Description |
9+
| ----------------- | ---------------------- |
10+
| static class | [Schema.Schema1](#schema1)<br> schema class |
11+
12+
## Schema1
13+
public static class Schema1<br>
14+
extends StringJsonSchema
15+
16+
A schema class that validates payloads
17+
18+
| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema |
19+
| ------------------------------------------------------------------ |
20+
| validate |
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package org.openapijsonschematools.client.paths.fakepemcontenttype.get.requestbody.content.applicationxpemfile;
2+
import org.checkerframework.checker.nullness.qual.Nullable;
3+
import org.openapijsonschematools.client.schemas.StringJsonSchema;
4+
5+
public class Schema {
6+
// nest classes so all schemas and input/output classes can be public
7+
8+
9+
public static class Schema1 extends StringJsonSchema {
10+
private static @Nullable Schema1 instance = null;
11+
public static Schema1 getInstance() {
12+
if (instance == null) {
13+
instance = new Schema1();
14+
}
15+
return instance;
16+
}
17+
}
18+
19+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package org.openapijsonschematools.client.paths.fakepemcontenttype.get.responses.response200.content.applicationxpemfile;
2+
import org.checkerframework.checker.nullness.qual.Nullable;
3+
import org.openapijsonschematools.client.schemas.StringJsonSchema;
4+
5+
public class Schema {
6+
// nest classes so all schemas and input/output classes can be public
7+
8+
9+
public static class Schema1 extends StringJsonSchema {
10+
private static @Nullable Schema1 instance = null;
11+
public static Schema1 getInstance() {
12+
if (instance == null) {
13+
instance = new Schema1();
14+
}
15+
return instance;
16+
}
17+
}
18+
19+
}

samples/client/petstore/python/.openapi-generator/FILES

+16
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,9 @@ docs/paths/fake_parameter_collisions1_abab_self_ab/post/parameters/parameter_8/s
291291
docs/paths/fake_parameter_collisions1_abab_self_ab/post/parameters/parameter_9/schema.md
292292
docs/paths/fake_parameter_collisions1_abab_self_ab/post/request_body/content/application_json/schema.md
293293
docs/paths/fake_parameter_collisions1_abab_self_ab/post/responses/response_200/content/application_json/schema.md
294+
docs/paths/fake_pem_content_type/get.md
295+
docs/paths/fake_pem_content_type/get/request_body/content/application_x_pem_file/schema.md
296+
docs/paths/fake_pem_content_type/get/responses/response_200/content/application_x_pem_file/schema.md
294297
docs/paths/fake_pet_id_upload_image_with_required_file/post.md
295298
docs/paths/fake_pet_id_upload_image_with_required_file/post/parameters/parameter_0/schema.md
296299
docs/paths/fake_pet_id_upload_image_with_required_file/post/request_body/content/multipart_form_data/schema.md
@@ -437,6 +440,7 @@ src/petstore_api/apis/paths/fake_multiple_response_bodies.py
437440
src/petstore_api/apis/paths/fake_multiple_securities.py
438441
src/petstore_api/apis/paths/fake_obj_in_query.py
439442
src/petstore_api/apis/paths/fake_parameter_collisions1_abab_self_ab.py
443+
src/petstore_api/apis/paths/fake_pem_content_type.py
440444
src/petstore_api/apis/paths/fake_pet_id_upload_image_with_required_file.py
441445
src/petstore_api/apis/paths/fake_query_param_with_json_content_type.py
442446
src/petstore_api/apis/paths/fake_redirection.py
@@ -1061,6 +1065,18 @@ src/petstore_api/paths/fake_parameter_collisions1_abab_self_ab/post/responses/re
10611065
src/petstore_api/paths/fake_parameter_collisions1_abab_self_ab/post/responses/response_200/content/__init__.py
10621066
src/petstore_api/paths/fake_parameter_collisions1_abab_self_ab/post/responses/response_200/content/application_json/__init__.py
10631067
src/petstore_api/paths/fake_parameter_collisions1_abab_self_ab/post/responses/response_200/content/application_json/schema.py
1068+
src/petstore_api/paths/fake_pem_content_type/__init__.py
1069+
src/petstore_api/paths/fake_pem_content_type/get/__init__.py
1070+
src/petstore_api/paths/fake_pem_content_type/get/operation.py
1071+
src/petstore_api/paths/fake_pem_content_type/get/request_body/__init__.py
1072+
src/petstore_api/paths/fake_pem_content_type/get/request_body/content/__init__.py
1073+
src/petstore_api/paths/fake_pem_content_type/get/request_body/content/application_x_pem_file/__init__.py
1074+
src/petstore_api/paths/fake_pem_content_type/get/request_body/content/application_x_pem_file/schema.py
1075+
src/petstore_api/paths/fake_pem_content_type/get/responses/__init__.py
1076+
src/petstore_api/paths/fake_pem_content_type/get/responses/response_200/__init__.py
1077+
src/petstore_api/paths/fake_pem_content_type/get/responses/response_200/content/__init__.py
1078+
src/petstore_api/paths/fake_pem_content_type/get/responses/response_200/content/application_x_pem_file/__init__.py
1079+
src/petstore_api/paths/fake_pem_content_type/get/responses/response_200/content/application_x_pem_file/schema.py
10641080
src/petstore_api/paths/fake_pet_id_upload_image_with_required_file/__init__.py
10651081
src/petstore_api/paths/fake_pet_id_upload_image_with_required_file/post/__init__.py
10661082
src/petstore_api/paths/fake_pet_id_upload_image_with_required_file/post/operation.py

samples/client/petstore/python/README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# petstore-api
2-
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: " \
2+
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose.
33

44
This Python package is automatically generated by the [OpenAPI JSON Schema Generator](https://github.com/openapi-json-schema-tools/openapi-json-schema-generator) project:
55

@@ -195,6 +195,7 @@ HTTP request | Method | Description
195195
/fake/multipleSecurities **get** | [FakeApi](docs/apis/tags/fake_api.md).[multiple_securities](docs/paths/fake_multiple_securities/get.md) | multiple security requirements
196196
/fake/objInQuery **get** | [FakeApi](docs/apis/tags/fake_api.md).[object_in_query](docs/paths/fake_obj_in_query/get.md) | user list
197197
/fake/parameterCollisions/{1}/{aB}/{Ab}/{self}/{A-B}/ **post** | [FakeApi](docs/apis/tags/fake_api.md).[parameter_collisions](docs/paths/fake_parameter_collisions1_abab_self_ab/post.md) | parameter collision case
198+
/fake/pemContentType **get** | [FakeApi](docs/apis/tags/fake_api.md).[pem_content_type](docs/paths/fake_pem_content_type/get.md) | route with tx and rx pem content type
198199
/fake/queryParamWithJsonContentType **get** | [FakeApi](docs/apis/tags/fake_api.md).[query_param_with_json_content_type](docs/paths/fake_query_param_with_json_content_type/get.md) | query param with json content-type
199200
/fake/redirection **get** | [FakeApi](docs/apis/tags/fake_api.md).[redirection](docs/paths/fake_redirection/get.md) | operation with redirection responses
200201
/fake/refObjInQuery **get** | [FakeApi](docs/apis/tags/fake_api.md).[ref_object_in_query](docs/paths/fake_ref_obj_in_query/get.md) | user list

samples/client/petstore/python/docs/apis/tags/fake_api.md

+1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ Method | Description
3838
[**object_in_query**](../../paths/fake_obj_in_query/get.md) | user list
3939
[**object_model_with_ref_props**](../../paths/fake_refs_object_model_with_ref_props/post.md) |
4040
[**parameter_collisions**](../../paths/fake_parameter_collisions1_abab_self_ab/post.md) | parameter collision case
41+
[**pem_content_type**](../../paths/fake_pem_content_type/get.md) | route with tx and rx pem content type
4142
[**post_common_param**](../../paths/common_param_sub_dir/post.md) |
4243
[**query_param_with_json_content_type**](../../paths/fake_query_param_with_json_content_type/get.md) | query param with json content-type
4344
[**query_parameter_collection_format**](../../paths/fake_test_query_paramters/put.md) |
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
petstore_api.paths.fake_pem_content_type.operation
2+
# Operation Method Name
3+
4+
| Method Name | Api Class | Notes |
5+
| ----------- | --------- | ----- |
6+
| pem_content_type | [FakeApi](../../apis/tags/fake_api.md) | This api is only for tag=fake |
7+
| get | ApiForGet | This api is only for this endpoint |
8+
| get | FakePemContentType | This api is only for path=/fake/pemContentType |
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+
| Summary | route with tx and rx pem content type |
21+
| Path | "/fake/pemContentType" |
22+
| HTTP Method | get |
23+
24+
## Arguments
25+
26+
Name | Type | Description | Notes
27+
------------- | ------------- | ------------- | -------------
28+
[body](#requestbody) | typing.Union[str, schemas.Unset] | optional, default is unset |
29+
content_type | str | optional, default is 'application/x-pem-file' | Selects the schema and serialization of the request body. value must be one of ['application/x-pem-file']
30+
accept_content_types | typing.Tuple[str] | default is ("application/x-pem-file", ) | Tells the server the content type(s) that are accepted by the client
31+
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]
32+
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
33+
timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client
34+
skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_response.ApiResponseWithoutDeserialization will be returned
35+
36+
### RequestBody
37+
38+
#### Content Type To Schema
39+
Content-Type | Schema
40+
------------ | -------
41+
"application/x-pem-file" | [content.application_x_pem_file.Schema](#requestbody-content-applicationxpemfile-schema)
42+
43+
#### RequestBody content ApplicationXPemFile Schema
44+
```
45+
type: schemas.Schema
46+
```
47+
48+
##### validate method
49+
Input Type | Return Type | Notes
50+
------------ | ------------- | -------------
51+
str | str |
52+
53+
## Return Types
54+
55+
HTTP Status Code | Class | Description
56+
------------- | ------------- | -------------
57+
n/a | api_response.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned
58+
200 | [ResponseFor200.ApiResponse](#responsefor200-apiresponse) | success
59+
60+
## ResponseFor200
61+
62+
### Description
63+
success
64+
65+
### ResponseFor200 ApiResponse
66+
Name | Type | Description | Notes
67+
------------- | ------------- | ------------- | -------------
68+
response | urllib3.HTTPResponse | Raw response |
69+
[body](#responsefor200-body) | str | |
70+
headers | Unset | headers were not defined |
71+
72+
### ResponseFor200 Body
73+
Content-Type | Schema
74+
------------ | -------
75+
"application/x-pem-file" | [content.application_x_pem_file.Schema](#responsefor200-content-applicationxpemfile-schema)
76+
77+
### Body Details
78+
#### ResponseFor200 content ApplicationXPemFile Schema
79+
```
80+
type: schemas.Schema
81+
```
82+
83+
##### validate method
84+
Input Type | Return Type | Notes
85+
------------ | ------------- | -------------
86+
str | str |
87+
88+
## Servers
89+
90+
Set the available servers by defining your used servers in ApiConfiguration.server_info
91+
Then select your server by setting a server index in ApiConfiguration.server_index_info or by
92+
passing server_index in to the endpoint method.
93+
- these servers are the general api servers
94+
- defaults to server_index=0, server.url = http://petstore.swagger.io:80/v2
95+
96+
server_index | Class | Description
97+
------------ | ----- | ------------
98+
0 | [Server0](../../servers/server_0.md) | petstore server
99+
1 | [Server1](../../servers/server_1.md) | The local server
100+
2 | [Server2](../../servers/server_2.md) | staging server with no variables
101+
102+
## Code Sample
103+
104+
```python
105+
import petstore_api
106+
from petstore_api.configurations import api_configuration
107+
from petstore_api.apis.tags import fake_api
108+
from pprint import pprint
109+
used_configuration = api_configuration.ApiConfiguration(
110+
)
111+
# Enter a context with an instance of the API client
112+
with petstore_api.ApiClient(used_configuration) as api_client:
113+
# Create an instance of the API class
114+
api_instance = fake_api.FakeApi(api_client)
115+
116+
# example passing only optional values
117+
body = "string_example"
118+
try:
119+
# route with tx and rx pem content type
120+
api_response = api_instance.pem_content_type(
121+
body=body,
122+
)
123+
pprint(api_response)
124+
except petstore_api.ApiException as e:
125+
print("Exception when calling FakeApi->pem_content_type: %s\n" % e)
126+
```
127+
128+
[[Back to top]](#top)
129+
[[Back to FakeApi API]](../../apis/tags/fake_api.md)
130+
[[Back to Endpoints]](../../../README.md#Endpoints) [[Back to README]](../../../README.md)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Schema
2+
```
3+
type: schemas.Schema
4+
```
5+
6+
## validate method
7+
Input Type | Return Type | Notes
8+
------------ | ------------- | -------------
9+
str | str |
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Schema
2+
```
3+
type: schemas.Schema
4+
```
5+
6+
## validate method
7+
Input Type | Return Type | Notes
8+
------------ | ------------- | -------------
9+
str | str |

samples/client/petstore/python/src/petstore_api/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
"""
66
OpenAPI Petstore
7-
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: " \ # noqa: E501
7+
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. # noqa: E501
88
The version of the OpenAPI document: 1.0.0
99
Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator
1010
"""

samples/client/petstore/python/src/petstore_api/api_client.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# coding: utf-8
22
"""
33
OpenAPI Petstore
4-
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: " \ # noqa: E501
4+
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. # noqa: E501
55
The version of the OpenAPI document: 1.0.0
66
Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator
77
"""

samples/client/petstore/python/src/petstore_api/api_response.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# coding: utf-8
22
"""
33
OpenAPI Petstore
4-
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: " \ # noqa: E501
4+
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. # noqa: E501
55
The version of the OpenAPI document: 1.0.0
66
Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator
77
"""

samples/client/petstore/python/src/petstore_api/apis/path_to_api.py

+3
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
from petstore_api.apis.paths.fake_multiple_securities import FakeMultipleSecurities
2222
from petstore_api.apis.paths.fake_obj_in_query import FakeObjInQuery
2323
from petstore_api.apis.paths.fake_parameter_collisions1_abab_self_ab import FakeParameterCollisions1AbabSelfAb
24+
from petstore_api.apis.paths.fake_pem_content_type import FakePemContentType
2425
from petstore_api.apis.paths.fake_query_param_with_json_content_type import FakeQueryParamWithJsonContentType
2526
from petstore_api.apis.paths.fake_redirection import FakeRedirection
2627
from petstore_api.apis.paths.fake_ref_obj_in_query import FakeRefObjInQuery
@@ -80,6 +81,7 @@
8081
"/fake/multipleSecurities": typing.Type[FakeMultipleSecurities],
8182
"/fake/objInQuery": typing.Type[FakeObjInQuery],
8283
"/fake/parameterCollisions/{1}/{aB}/{Ab}/{self}/{A-B}/": typing.Type[FakeParameterCollisions1AbabSelfAb],
84+
"/fake/pemContentType": typing.Type[FakePemContentType],
8385
"/fake/queryParamWithJsonContentType": typing.Type[FakeQueryParamWithJsonContentType],
8486
"/fake/redirection": typing.Type[FakeRedirection],
8587
"/fake/refObjInQuery": typing.Type[FakeRefObjInQuery],
@@ -140,6 +142,7 @@
140142
"/fake/multipleSecurities": FakeMultipleSecurities,
141143
"/fake/objInQuery": FakeObjInQuery,
142144
"/fake/parameterCollisions/{1}/{aB}/{Ab}/{self}/{A-B}/": FakeParameterCollisions1AbabSelfAb,
145+
"/fake/pemContentType": FakePemContentType,
143146
"/fake/queryParamWithJsonContentType": FakeQueryParamWithJsonContentType,
144147
"/fake/redirection": FakeRedirection,
145148
"/fake/refObjInQuery": FakeRefObjInQuery,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# coding: utf-8
2+
3+
"""
4+
Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator
5+
"""
6+
7+
from petstore_api.paths.fake_pem_content_type.get.operation import ApiForGet
8+
9+
10+
class FakePemContentType(
11+
ApiForGet,
12+
):
13+
pass

0 commit comments

Comments
 (0)