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

Python client, adds test of pem content type send and receive #353

Merged
merged 2 commits into from
Jan 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 4 additions & 0 deletions samples/client/petstore/java/.openapi-generator/FILES
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,8 @@ docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter8/Schema8
docs/paths/fakeparametercollisions1ababselfab/post/parameters/parameter9/Schema9.md
docs/paths/fakeparametercollisions1ababselfab/post/requestbody/content/applicationjson/Schema.md
docs/paths/fakeparametercollisions1ababselfab/post/responses/response200/content/applicationjson/Schema.md
docs/paths/fakepemcontenttype/get/requestbody/content/applicationxpemfile/Schema.md
docs/paths/fakepemcontenttype/get/responses/response200/content/applicationxpemfile/Schema.md
docs/paths/fakepetiduploadimagewithrequiredfile/post/parameters/parameter0/Schema0.md
docs/paths/fakepetiduploadimagewithrequiredfile/post/requestbody/content/multipartformdata/Schema.md
docs/paths/fakepetiduploadimagewithrequiredfile/post/responses/response200/content/applicationjson/Schema.md
Expand Down Expand Up @@ -558,6 +560,8 @@ src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ab
src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/parameters/parameter9/Schema9.java
src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/requestbody/content/applicationjson/Schema.java
src/main/java/org/openapijsonschematools/client/paths/fakeparametercollisions1ababselfab/post/responses/response200/content/applicationjson/Schema.java
src/main/java/org/openapijsonschematools/client/paths/fakepemcontenttype/get/requestbody/content/applicationxpemfile/Schema.java
src/main/java/org/openapijsonschematools/client/paths/fakepemcontenttype/get/responses/response200/content/applicationxpemfile/Schema.java
src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/PathParameters.java
src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/parameters/parameter0/Schema0.java
src/main/java/org/openapijsonschematools/client/paths/fakepetiduploadimagewithrequiredfile/post/requestbody/content/multipartformdata/Schema.java
Expand Down
2 changes: 1 addition & 1 deletion samples/client/petstore/java/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: " \
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose.

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

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Schema
public class Schema

A class that contains necessary nested
- schema classes (which validate payloads), extends JsonSchema

## Nested Class Summary
| Modifier and Type | Class and Description |
| ----------------- | ---------------------- |
| static class | [Schema.Schema1](#schema1)<br> schema class |

## Schema1
public static class Schema1<br>
extends StringJsonSchema

A schema class that validates payloads

| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema |
| ------------------------------------------------------------------ |
| validate |
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Schema
public class Schema

A class that contains necessary nested
- schema classes (which validate payloads), extends JsonSchema

## Nested Class Summary
| Modifier and Type | Class and Description |
| ----------------- | ---------------------- |
| static class | [Schema.Schema1](#schema1)<br> schema class |

## Schema1
public static class Schema1<br>
extends StringJsonSchema

A schema class that validates payloads

| Methods Inherited from class org.openapijsonschematools.client.schemas.StringJsonSchema |
| ------------------------------------------------------------------ |
| validate |
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package org.openapijsonschematools.client.paths.fakepemcontenttype.get.requestbody.content.applicationxpemfile;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.openapijsonschematools.client.schemas.StringJsonSchema;

public class Schema {
// nest classes so all schemas and input/output classes can be public


public static class Schema1 extends StringJsonSchema {
private static @Nullable Schema1 instance = null;
public static Schema1 getInstance() {
if (instance == null) {
instance = new Schema1();
}
return instance;
}
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package org.openapijsonschematools.client.paths.fakepemcontenttype.get.responses.response200.content.applicationxpemfile;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.openapijsonschematools.client.schemas.StringJsonSchema;

public class Schema {
// nest classes so all schemas and input/output classes can be public


public static class Schema1 extends StringJsonSchema {
private static @Nullable Schema1 instance = null;
public static Schema1 getInstance() {
if (instance == null) {
instance = new Schema1();
}
return instance;
}
}

}
16 changes: 16 additions & 0 deletions samples/client/petstore/python/.openapi-generator/FILES
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,9 @@ docs/paths/fake_parameter_collisions1_abab_self_ab/post/parameters/parameter_8/s
docs/paths/fake_parameter_collisions1_abab_self_ab/post/parameters/parameter_9/schema.md
docs/paths/fake_parameter_collisions1_abab_self_ab/post/request_body/content/application_json/schema.md
docs/paths/fake_parameter_collisions1_abab_self_ab/post/responses/response_200/content/application_json/schema.md
docs/paths/fake_pem_content_type/get.md
docs/paths/fake_pem_content_type/get/request_body/content/application_x_pem_file/schema.md
docs/paths/fake_pem_content_type/get/responses/response_200/content/application_x_pem_file/schema.md
docs/paths/fake_pet_id_upload_image_with_required_file/post.md
docs/paths/fake_pet_id_upload_image_with_required_file/post/parameters/parameter_0/schema.md
docs/paths/fake_pet_id_upload_image_with_required_file/post/request_body/content/multipart_form_data/schema.md
Expand Down Expand Up @@ -437,6 +440,7 @@ src/petstore_api/apis/paths/fake_multiple_response_bodies.py
src/petstore_api/apis/paths/fake_multiple_securities.py
src/petstore_api/apis/paths/fake_obj_in_query.py
src/petstore_api/apis/paths/fake_parameter_collisions1_abab_self_ab.py
src/petstore_api/apis/paths/fake_pem_content_type.py
src/petstore_api/apis/paths/fake_pet_id_upload_image_with_required_file.py
src/petstore_api/apis/paths/fake_query_param_with_json_content_type.py
src/petstore_api/apis/paths/fake_redirection.py
Expand Down Expand Up @@ -1061,6 +1065,18 @@ src/petstore_api/paths/fake_parameter_collisions1_abab_self_ab/post/responses/re
src/petstore_api/paths/fake_parameter_collisions1_abab_self_ab/post/responses/response_200/content/__init__.py
src/petstore_api/paths/fake_parameter_collisions1_abab_self_ab/post/responses/response_200/content/application_json/__init__.py
src/petstore_api/paths/fake_parameter_collisions1_abab_self_ab/post/responses/response_200/content/application_json/schema.py
src/petstore_api/paths/fake_pem_content_type/__init__.py
src/petstore_api/paths/fake_pem_content_type/get/__init__.py
src/petstore_api/paths/fake_pem_content_type/get/operation.py
src/petstore_api/paths/fake_pem_content_type/get/request_body/__init__.py
src/petstore_api/paths/fake_pem_content_type/get/request_body/content/__init__.py
src/petstore_api/paths/fake_pem_content_type/get/request_body/content/application_x_pem_file/__init__.py
src/petstore_api/paths/fake_pem_content_type/get/request_body/content/application_x_pem_file/schema.py
src/petstore_api/paths/fake_pem_content_type/get/responses/__init__.py
src/petstore_api/paths/fake_pem_content_type/get/responses/response_200/__init__.py
src/petstore_api/paths/fake_pem_content_type/get/responses/response_200/content/__init__.py
src/petstore_api/paths/fake_pem_content_type/get/responses/response_200/content/application_x_pem_file/__init__.py
src/petstore_api/paths/fake_pem_content_type/get/responses/response_200/content/application_x_pem_file/schema.py
src/petstore_api/paths/fake_pet_id_upload_image_with_required_file/__init__.py
src/petstore_api/paths/fake_pet_id_upload_image_with_required_file/post/__init__.py
src/petstore_api/paths/fake_pet_id_upload_image_with_required_file/post/operation.py
Expand Down
3 changes: 2 additions & 1 deletion samples/client/petstore/python/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# petstore-api
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: " \
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose.

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

Expand Down Expand Up @@ -195,6 +195,7 @@ HTTP request | Method | Description
/fake/multipleSecurities **get** | [FakeApi](docs/apis/tags/fake_api.md).[multiple_securities](docs/paths/fake_multiple_securities/get.md) | multiple security requirements
/fake/objInQuery **get** | [FakeApi](docs/apis/tags/fake_api.md).[object_in_query](docs/paths/fake_obj_in_query/get.md) | user list
/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
/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
/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
/fake/redirection **get** | [FakeApi](docs/apis/tags/fake_api.md).[redirection](docs/paths/fake_redirection/get.md) | operation with redirection responses
/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
Expand Down
1 change: 1 addition & 0 deletions samples/client/petstore/python/docs/apis/tags/fake_api.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ Method | Description
[**object_in_query**](../../paths/fake_obj_in_query/get.md) | user list
[**object_model_with_ref_props**](../../paths/fake_refs_object_model_with_ref_props/post.md) |
[**parameter_collisions**](../../paths/fake_parameter_collisions1_abab_self_ab/post.md) | parameter collision case
[**pem_content_type**](../../paths/fake_pem_content_type/get.md) | route with tx and rx pem content type
[**post_common_param**](../../paths/common_param_sub_dir/post.md) |
[**query_param_with_json_content_type**](../../paths/fake_query_param_with_json_content_type/get.md) | query param with json content-type
[**query_parameter_collection_format**](../../paths/fake_test_query_paramters/put.md) |
Expand Down
130 changes: 130 additions & 0 deletions samples/client/petstore/python/docs/paths/fake_pem_content_type/get.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
petstore_api.paths.fake_pem_content_type.operation
# Operation Method Name

| Method Name | Api Class | Notes |
| ----------- | --------- | ----- |
| pem_content_type | [FakeApi](../../apis/tags/fake_api.md) | This api is only for tag=fake |
| get | ApiForGet | This api is only for this endpoint |
| get | FakePemContentType | This api is only for path=/fake/pemContentType |

## Table of Contents
- [General Info](#general-info)
- [Arguments](#arguments)
- [Return Types](#return-types)
- [Servers](#servers)
- [Code Sample](#code-sample)

## General Info
| Field | Value |
| ----- | ----- |
| Summary | route with tx and rx pem content type |
| Path | "/fake/pemContentType" |
| HTTP Method | get |

## Arguments

Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
[body](#requestbody) | typing.Union[str, schemas.Unset] | optional, default is unset |
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']
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
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]
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
timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client
skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_response.ApiResponseWithoutDeserialization will be returned

### RequestBody

#### Content Type To Schema
Content-Type | Schema
------------ | -------
"application/x-pem-file" | [content.application_x_pem_file.Schema](#requestbody-content-applicationxpemfile-schema)

#### RequestBody content ApplicationXPemFile Schema
```
type: schemas.Schema
```

##### validate method
Input Type | Return Type | Notes
------------ | ------------- | -------------
str | str |

## Return Types

HTTP Status Code | Class | Description
------------- | ------------- | -------------
n/a | api_response.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned
200 | [ResponseFor200.ApiResponse](#responsefor200-apiresponse) | success

## ResponseFor200

### Description
success

### ResponseFor200 ApiResponse
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
response | urllib3.HTTPResponse | Raw response |
[body](#responsefor200-body) | str | |
headers | Unset | headers were not defined |

### ResponseFor200 Body
Content-Type | Schema
------------ | -------
"application/x-pem-file" | [content.application_x_pem_file.Schema](#responsefor200-content-applicationxpemfile-schema)

### Body Details
#### ResponseFor200 content ApplicationXPemFile Schema
```
type: schemas.Schema
```

##### validate method
Input Type | Return Type | Notes
------------ | ------------- | -------------
str | str |

## Servers

Set the available servers by defining your used servers in ApiConfiguration.server_info
Then select your server by setting a server index in ApiConfiguration.server_index_info or by
passing server_index in to the endpoint method.
- these servers are the general api servers
- defaults to server_index=0, server.url = http://petstore.swagger.io:80/v2

server_index | Class | Description
------------ | ----- | ------------
0 | [Server0](../../servers/server_0.md) | petstore server
1 | [Server1](../../servers/server_1.md) | The local server
2 | [Server2](../../servers/server_2.md) | staging server with no variables

## Code Sample

```python
import petstore_api
from petstore_api.configurations import api_configuration
from petstore_api.apis.tags import fake_api
from pprint import pprint
used_configuration = api_configuration.ApiConfiguration(
)
# Enter a context with an instance of the API client
with petstore_api.ApiClient(used_configuration) as api_client:
# Create an instance of the API class
api_instance = fake_api.FakeApi(api_client)

# example passing only optional values
body = "string_example"
try:
# route with tx and rx pem content type
api_response = api_instance.pem_content_type(
body=body,
)
pprint(api_response)
except petstore_api.ApiException as e:
print("Exception when calling FakeApi->pem_content_type: %s\n" % e)
```

[[Back to top]](#top)
[[Back to FakeApi API]](../../apis/tags/fake_api.md)
[[Back to Endpoints]](../../../README.md#Endpoints) [[Back to README]](../../../README.md)
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Schema
```
type: schemas.Schema
```

## validate method
Input Type | Return Type | Notes
------------ | ------------- | -------------
str | str |
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Schema
```
type: schemas.Schema
```

## validate method
Input Type | Return Type | Notes
------------ | ------------- | -------------
str | str |
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

"""
OpenAPI Petstore
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
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. # noqa: E501
The version of the OpenAPI document: 1.0.0
Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator
"""
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# coding: utf-8
"""
OpenAPI Petstore
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
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. # noqa: E501
The version of the OpenAPI document: 1.0.0
Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator
"""
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# coding: utf-8
"""
OpenAPI Petstore
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
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. # noqa: E501
The version of the OpenAPI document: 1.0.0
Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
from petstore_api.apis.paths.fake_multiple_securities import FakeMultipleSecurities
from petstore_api.apis.paths.fake_obj_in_query import FakeObjInQuery
from petstore_api.apis.paths.fake_parameter_collisions1_abab_self_ab import FakeParameterCollisions1AbabSelfAb
from petstore_api.apis.paths.fake_pem_content_type import FakePemContentType
from petstore_api.apis.paths.fake_query_param_with_json_content_type import FakeQueryParamWithJsonContentType
from petstore_api.apis.paths.fake_redirection import FakeRedirection
from petstore_api.apis.paths.fake_ref_obj_in_query import FakeRefObjInQuery
Expand Down Expand Up @@ -80,6 +81,7 @@
"/fake/multipleSecurities": typing.Type[FakeMultipleSecurities],
"/fake/objInQuery": typing.Type[FakeObjInQuery],
"/fake/parameterCollisions/{1}/{aB}/{Ab}/{self}/{A-B}/": typing.Type[FakeParameterCollisions1AbabSelfAb],
"/fake/pemContentType": typing.Type[FakePemContentType],
"/fake/queryParamWithJsonContentType": typing.Type[FakeQueryParamWithJsonContentType],
"/fake/redirection": typing.Type[FakeRedirection],
"/fake/refObjInQuery": typing.Type[FakeRefObjInQuery],
Expand Down Expand Up @@ -140,6 +142,7 @@
"/fake/multipleSecurities": FakeMultipleSecurities,
"/fake/objInQuery": FakeObjInQuery,
"/fake/parameterCollisions/{1}/{aB}/{Ab}/{self}/{A-B}/": FakeParameterCollisions1AbabSelfAb,
"/fake/pemContentType": FakePemContentType,
"/fake/queryParamWithJsonContentType": FakeQueryParamWithJsonContentType,
"/fake/redirection": FakeRedirection,
"/fake/refObjInQuery": FakeRefObjInQuery,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# coding: utf-8

"""
Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator
"""

from petstore_api.paths.fake_pem_content_type.get.operation import ApiForGet


class FakePemContentType(
ApiForGet,
):
pass
Loading