[python-exp] simplify examples (#7157)

* Adds example setting code in python-experimental with one fn setting example values

Fixes sample indentations

Handles composed schema models, object model and arraymodels

Adds brackets in arraymodel input

Sets modelName with map schemas

Removes included_schemas arguments, dicriminator examples do not include property examples

Refactors modelName into toExampleValueRecursive argument

Fixes bug where example models contained themselves

Stops using model ExampleGenerator examples because they are inconsistent with the ones in python-experimental

Uses example values if they exist

Removes single quotes from enum examples

Fixes password example

Adds commented our regex handling, commented out because it breaks

Handles AnyType schema examples

Adds x_example values for simple string properties, uses toExampleValue for all example generation

Adds examples for simple string parameters

Updates comments in toExampleValueBase

Fixes the double nested bug for AdditionalPropertiesWithArrayOfEnums

Fixes bug where NumberWithValidations had double nesting

Updates simple string examples in arrays

Fixes array string examples

Fixes example for string endpoint body example

Adds exampleFromStringOrArraySchema

Adds regex examples, pegs slf4j-version to v1.7.29 for rgxgen

Adds comment about regex seed

Updates pattern matcher to not handle ^ and $

Updates used sample values

Adds ensureQuotes

Adds ensureQuotes

Fixes double quote bug

Updates mustache file

Adds ensureQuotes to key handling

Adds modelNameToSchema map, reduces run time by using it

Fixes java tests

Regenerates python-experimental samples

Fixes python test

* Rebased on master

* Adds getModelNameToSchemaCache

* Updates toDefaultValue to not mutate schemas

* Has all dates and datetimes default and example setting use the same helper function

* Samples regenerated

* indentation tweak, removes txt from sample file
This commit is contained in:
spacether
2020-08-19 21:27:31 -07:00
committed by GitHub
parent c19350b179
commit 866df36c94
65 changed files with 1503 additions and 444 deletions

View File

@@ -63,7 +63,9 @@ configuration = petstore_api.Configuration(
with petstore_api.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = another_fake_api.AnotherFakeApi(api_client)
client = Client() # Client | client model
client = Client(
client="client_example",
) # Client | client model
try:
# To test special tags
@@ -87,6 +89,7 @@ Class | Method | HTTP request | Description
*FakeApi* | [**boolean**](docs/FakeApi.md#boolean) | **POST** /fake/refs/boolean |
*FakeApi* | [**composed_one_of_number_with_validations**](docs/FakeApi.md#composed_one_of_number_with_validations) | **POST** /fake/refs/composed_one_of_number_with_validations |
*FakeApi* | [**fake_health_get**](docs/FakeApi.md#fake_health_get) | **GET** /fake/health | Health check endpoint
*FakeApi* | [**mammal**](docs/FakeApi.md#mammal) | **POST** /fake/refs/mammal |
*FakeApi* | [**number_with_validations**](docs/FakeApi.md#number_with_validations) | **POST** /fake/refs/number |
*FakeApi* | [**object_model_with_ref_props**](docs/FakeApi.md#object_model_with_ref_props) | **POST** /fake/refs/object_model_with_ref_props |
*FakeApi* | [**string**](docs/FakeApi.md#string) | **POST** /fake/refs/string |

View File

@@ -4,7 +4,7 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**class_name** | **str** | |
**color** | **str** | | [optional] if omitted the server will use the default value of 'red'
**color** | **str** | | [optional] if omitted the server will use the default value of "red"
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -33,8 +33,10 @@ configuration = petstore_api.Configuration(
with petstore_api.ApiClient() as api_client:
# Create an instance of the API class
api_instance = another_fake_api.AnotherFakeApi(api_client)
client = Client() # Client | client model
client = Client(
client="client_example",
) # Client | client model
# example passing only required values which don't have defaults set
try:
# To test special tags

View File

@@ -5,7 +5,7 @@ Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**class_name** | **str** | |
**declawed** | **bool** | | [optional]
**color** | **str** | | [optional] if omitted the server will use the default value of 'red'
**color** | **str** | | [optional] if omitted the server will use the default value of "red"
**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -3,7 +3,7 @@
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**name** | **str** | | defaults to 'default-name'
**name** | **str** | | defaults to "default-name"
**id** | **int** | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -5,7 +5,7 @@ this is a model that allows payloads of type object or number
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**class_name** | **str** | | defaults to nulltype.Null
**color** | **str** | | [optional] if omitted the server will use the default value of 'red'
**color** | **str** | | [optional] if omitted the server will use the default value of "red"
**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -31,7 +31,7 @@ configuration = petstore_api.Configuration(
with petstore_api.ApiClient() as api_client:
# Create an instance of the API class
api_instance = default_api.DefaultApi(api_client)
# example, this endpoint has no required or optional parameters
try:
api_response = api_instance.foo_get()

View File

@@ -5,7 +5,7 @@ Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**class_name** | **str** | |
**breed** | **str** | | [optional]
**color** | **str** | | [optional] if omitted the server will use the default value of 'red'
**color** | **str** | | [optional] if omitted the server will use the default value of "red"
**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -3,7 +3,7 @@
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**value** | **str** | | if omitted the server will use the default value of '-efg', must be one of ["_abc", "-efg", "(xyz)", ]
**value** | **str** | | if omitted the server will use the default value of "-efg", must be one of ["_abc", "-efg", "(xyz)", ]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -10,6 +10,7 @@ Method | HTTP request | Description
[**boolean**](FakeApi.md#boolean) | **POST** /fake/refs/boolean |
[**composed_one_of_number_with_validations**](FakeApi.md#composed_one_of_number_with_validations) | **POST** /fake/refs/composed_one_of_number_with_validations |
[**fake_health_get**](FakeApi.md#fake_health_get) | **GET** /fake/health | Health check endpoint
[**mammal**](FakeApi.md#mammal) | **POST** /fake/refs/mammal |
[**number_with_validations**](FakeApi.md#number_with_validations) | **POST** /fake/refs/number |
[**object_model_with_ref_props**](FakeApi.md#object_model_with_ref_props) | **POST** /fake/refs/object_model_with_ref_props |
[**string**](FakeApi.md#string) | **POST** /fake/refs/string |
@@ -49,7 +50,11 @@ configuration = petstore_api.Configuration(
with petstore_api.ApiClient() as api_client:
# Create an instance of the API class
api_instance = fake_api.FakeApi(api_client)
additional_properties_with_array_of_enums = AdditionalPropertiesWithArrayOfEnums() # AdditionalPropertiesWithArrayOfEnums | Input enum (optional)
additional_properties_with_array_of_enums = AdditionalPropertiesWithArrayOfEnums(
"key": [
EnumClass("-efg"),
],
) # AdditionalPropertiesWithArrayOfEnums | Input enum (optional)
# example passing only required values which don't have defaults set
# and optional values
@@ -113,7 +118,9 @@ configuration = petstore_api.Configuration(
with petstore_api.ApiClient() as api_client:
# Create an instance of the API class
api_instance = fake_api.FakeApi(api_client)
body = AnimalFarm() # AnimalFarm | Input model (optional)
body = AnimalFarm([
Animal(),
]) # AnimalFarm | Input model (optional)
# example passing only required values which don't have defaults set
# and optional values
@@ -174,7 +181,9 @@ configuration = petstore_api.Configuration(
with petstore_api.ApiClient() as api_client:
# Create an instance of the API class
api_instance = fake_api.FakeApi(api_client)
array_of_enums = ArrayOfEnums() # ArrayOfEnums | Input enum (optional)
array_of_enums = ArrayOfEnums([
StringEnum("placed"),
]) # ArrayOfEnums | Input enum (optional)
# example passing only required values which don't have defaults set
# and optional values
@@ -361,7 +370,7 @@ configuration = petstore_api.Configuration(
with petstore_api.ApiClient() as api_client:
# Create an instance of the API class
api_instance = fake_api.FakeApi(api_client)
# example, this endpoint has no required or optional parameters
try:
# Health check endpoint
@@ -394,6 +403,72 @@ No authorization required
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **mammal**
> Mammal mammal(mammal)
Test serialization of mammals
### Example
```python
import time
import petstore_api
from petstore_api.api import fake_api
from petstore_api.model.mammal import Mammal
from pprint import pprint
# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2
# See configuration.py for a list of all supported configuration parameters.
configuration = petstore_api.Configuration(
host = "http://petstore.swagger.io:80/v2"
)
# Enter a context with an instance of the API client
with petstore_api.ApiClient() as api_client:
# Create an instance of the API class
api_instance = fake_api.FakeApi(api_client)
mammal = Mammal(
has_baleen=True,
has_teeth=True,
class_name="whale",
) # Mammal | Input mammal
# example passing only required values which don't have defaults set
try:
api_response = api_instance.mammal(mammal)
pprint(api_response)
except petstore_api.ApiException as e:
print("Exception when calling FakeApi->mammal: %s\n" % e)
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**mammal** | [**Mammal**](Mammal.md)| Input mammal |
### Return type
[**Mammal**](Mammal.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**200** | Output mammal | - |
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **number_with_validations**
> NumberWithValidations number_with_validations()
@@ -420,7 +495,7 @@ configuration = petstore_api.Configuration(
with petstore_api.ApiClient() as api_client:
# Create an instance of the API class
api_instance = fake_api.FakeApi(api_client)
body = NumberWithValidations(3.4) # NumberWithValidations | Input number as post body (optional)
body = NumberWithValidations(10) # NumberWithValidations | Input number as post body (optional)
# example passing only required values which don't have defaults set
# and optional values
@@ -483,7 +558,11 @@ configuration = petstore_api.Configuration(
with petstore_api.ApiClient() as api_client:
# Create an instance of the API class
api_instance = fake_api.FakeApi(api_client)
body = ObjectModelWithRefProps() # ObjectModelWithRefProps | Input model (optional)
body = ObjectModelWithRefProps(
my_number=NumberWithValidations(10),
my_string="my_string_example",
my_boolean=True,
) # ObjectModelWithRefProps | Input model (optional)
# example passing only required values which don't have defaults set
# and optional values
@@ -545,7 +624,7 @@ configuration = petstore_api.Configuration(
with petstore_api.ApiClient() as api_client:
# Create an instance of the API class
api_instance = fake_api.FakeApi(api_client)
body = 'body_example' # str | Input string as post body (optional)
body = "body_example" # str | Input string as post body (optional)
# example passing only required values which don't have defaults set
# and optional values
@@ -671,8 +750,17 @@ configuration = petstore_api.Configuration(
with petstore_api.ApiClient() as api_client:
# Create an instance of the API class
api_instance = fake_api.FakeApi(api_client)
file_schema_test_class = FileSchemaTestClass() # FileSchemaTestClass |
file_schema_test_class = FileSchemaTestClass(
file=File(
source_uri="source_uri_example",
),
files=[
File(
source_uri="source_uri_example",
),
],
) # FileSchemaTestClass |
# example passing only required values which don't have defaults set
try:
api_instance.test_body_with_file_schema(file_schema_test_class)
@@ -730,9 +818,22 @@ configuration = petstore_api.Configuration(
with petstore_api.ApiClient() as api_client:
# Create an instance of the API class
api_instance = fake_api.FakeApi(api_client)
query = 'query_example' # str |
user = User() # User |
query = "query_example" # str |
user = User(
id=1,
username="username_example",
first_name="first_name_example",
last_name="last_name_example",
email="email_example",
password="password_example",
phone="phone_example",
user_status=1,
object_with_no_declared_props={},
object_with_no_declared_props_nullable={},
any_type_prop=None,
any_type_prop_nullable=None,
) # User |
# example passing only required values which don't have defaults set
try:
api_instance.test_body_with_query_params(query, user)
@@ -793,8 +894,10 @@ configuration = petstore_api.Configuration(
with petstore_api.ApiClient() as api_client:
# Create an instance of the API class
api_instance = fake_api.FakeApi(api_client)
client = Client() # Client | client model
client = Client(
client="client_example",
) # Client | client model
# example passing only required values which don't have defaults set
try:
# To test \"client\" model
@@ -866,20 +969,20 @@ configuration = petstore_api.Configuration(
with petstore_api.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = fake_api.FakeApi(api_client)
number = 3.4 # float | None
double = 3.4 # float | None
pattern_without_delimiter = 'pattern_without_delimiter_example' # str | None
byte = 'byte_example' # str | None
integer = 56 # int | None (optional)
int32 = 56 # int | None (optional)
int64 = 56 # int | None (optional)
float = 3.4 # float | None (optional)
string = 'string_example' # str | None (optional)
binary = open('/path/to/file', 'rb') # file_type | None (optional)
date = '2013-10-20' # date | None (optional)
date_time = '2013-10-20T19:20:30+01:00' # datetime | None (optional)
password = 'password_example' # str | None (optional)
param_callback = 'param_callback_example' # str | None (optional)
number = 32.1 # float | None
double = 67.8 # float | None
pattern_without_delimiter = "AUR,rZ#UM/?R,Fp^l6$ARjbhJk C" # str | None
byte = 'YQ==' # str | None
integer = 10 # int | None (optional)
int32 = 20 # int | None (optional)
int64 = 1 # int | None (optional)
float = 3.14 # float | None (optional)
string = "a" # str | None (optional)
binary = open('/path/to/file', 'rb') # file_type | None (optional)
date = dateutil_parser('1970-01-01').date() # date | None (optional)
date_time = dateutil_parser('2020-02-02T20:20:20.22222Z') # datetime | None (optional) if omitted the server will use the default value of dateutil_parser('2010-02-01T10:20:10.11111+01:00')
password = "password_example" # str | None (optional)
param_callback = "param_callback_example" # str | None (optional)
# example passing only required values which don't have defaults set
try:
@@ -912,7 +1015,7 @@ Name | Type | Description | Notes
**string** | **str**| None | [optional]
**binary** | **file_type**| None | [optional]
**date** | **date**| None | [optional]
**date_time** | **datetime**| None | [optional]
**date_time** | **datetime**| None | [optional] if omitted the server will use the default value of dateutil_parser('2010-02-01T10:20:10.11111+01:00')
**password** | **str**| None | [optional]
**param_callback** | **str**| None | [optional]
@@ -962,14 +1065,18 @@ configuration = petstore_api.Configuration(
with petstore_api.ApiClient() as api_client:
# Create an instance of the API class
api_instance = fake_api.FakeApi(api_client)
enum_header_string_array = ['enum_header_string_array_example'] # [str] | Header parameter enum test (string array) (optional)
enum_header_string = '-efg' # str | Header parameter enum test (string) (optional) if omitted the server will use the default value of '-efg'
enum_query_string_array = ['enum_query_string_array_example'] # [str] | Query parameter enum test (string array) (optional)
enum_query_string = '-efg' # str | Query parameter enum test (string) (optional) if omitted the server will use the default value of '-efg'
enum_query_integer = 56 # int | Query parameter enum test (double) (optional)
enum_query_double = 3.4 # float | Query parameter enum test (double) (optional)
enum_form_string_array = '$' # [str] | Form parameter enum test (string array) (optional) if omitted the server will use the default value of '$'
enum_form_string = '-efg' # str | Form parameter enum test (string) (optional) if omitted the server will use the default value of '-efg'
enum_header_string_array = [
"$",
] # [str] | Header parameter enum test (string array) (optional)
enum_header_string = "-efg" # str | Header parameter enum test (string) (optional) if omitted the server will use the default value of "-efg"
enum_query_string_array = [
"$",
] # [str] | Query parameter enum test (string array) (optional)
enum_query_string = "-efg" # str | Query parameter enum test (string) (optional) if omitted the server will use the default value of "-efg"
enum_query_integer = 1 # int | Query parameter enum test (double) (optional)
enum_query_double = 1.1 # float | Query parameter enum test (double) (optional)
enum_form_string_array = "$" # [str] | Form parameter enum test (string array) (optional) if omitted the server will use the default value of "$"
enum_form_string = "-efg" # str | Form parameter enum test (string) (optional) if omitted the server will use the default value of "-efg"
# example passing only required values which don't have defaults set
# and optional values
@@ -985,13 +1092,13 @@ enum_form_string = '-efg' # str | Form parameter enum test (string) (optional) i
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**enum_header_string_array** | **[str]**| Header parameter enum test (string array) | [optional]
**enum_header_string** | **str**| Header parameter enum test (string) | [optional] if omitted the server will use the default value of '-efg'
**enum_header_string** | **str**| Header parameter enum test (string) | [optional] if omitted the server will use the default value of "-efg"
**enum_query_string_array** | **[str]**| Query parameter enum test (string array) | [optional]
**enum_query_string** | **str**| Query parameter enum test (string) | [optional] if omitted the server will use the default value of '-efg'
**enum_query_string** | **str**| Query parameter enum test (string) | [optional] if omitted the server will use the default value of "-efg"
**enum_query_integer** | **int**| Query parameter enum test (double) | [optional]
**enum_query_double** | **float**| Query parameter enum test (double) | [optional]
**enum_form_string_array** | **[str]**| Form parameter enum test (string array) | [optional] if omitted the server will use the default value of '$'
**enum_form_string** | **str**| Form parameter enum test (string) | [optional] if omitted the server will use the default value of '-efg'
**enum_form_string_array** | **[str]**| Form parameter enum test (string array) | [optional] if omitted the server will use the default value of "$"
**enum_form_string** | **str**| Form parameter enum test (string) | [optional] if omitted the server will use the default value of "-efg"
### Return type
@@ -1049,12 +1156,12 @@ configuration = petstore_api.Configuration(
with petstore_api.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = fake_api.FakeApi(api_client)
required_string_group = 56 # int | Required String in group parameters
required_string_group = 1 # int | Required String in group parameters
required_boolean_group = True # bool | Required Boolean in group parameters
required_int64_group = 56 # int | Required Integer in group parameters
string_group = 56 # int | String in group parameters (optional)
boolean_group = True # bool | Boolean in group parameters (optional)
int64_group = 56 # int | Integer in group parameters (optional)
required_int64_group = 1 # int | Required Integer in group parameters
string_group = 1 # int | String in group parameters (optional)
boolean_group = True # bool | Boolean in group parameters (optional)
int64_group = 1 # int | Integer in group parameters (optional)
# example passing only required values which don't have defaults set
try:
@@ -1126,8 +1233,10 @@ configuration = petstore_api.Configuration(
with petstore_api.ApiClient() as api_client:
# Create an instance of the API class
api_instance = fake_api.FakeApi(api_client)
request_body = {'key': 'request_body_example'} # {str: (str,)} | request body
request_body = {
"key": "key_example",
} # {str: (str,)} | request body
# example passing only required values which don't have defaults set
try:
# test inline additionalProperties
@@ -1185,9 +1294,9 @@ configuration = petstore_api.Configuration(
with petstore_api.ApiClient() as api_client:
# Create an instance of the API class
api_instance = fake_api.FakeApi(api_client)
param = 'param_example' # str | field1
param2 = 'param2_example' # str | field2
param = "param_example" # str | field1
param2 = "param2_example" # str | field2
# example passing only required values which don't have defaults set
try:
# test json serialization of form data
@@ -1248,12 +1357,22 @@ configuration = petstore_api.Configuration(
with petstore_api.ApiClient() as api_client:
# Create an instance of the API class
api_instance = fake_api.FakeApi(api_client)
pipe = ['pipe_example'] # [str] |
ioutil = ['ioutil_example'] # [str] |
http = ['http_example'] # [str] |
url = ['url_example'] # [str] |
context = ['context_example'] # [str] |
pipe = [
"pipe_example",
] # [str] |
ioutil = [
"ioutil_example",
] # [str] |
http = [
"http_example",
] # [str] |
url = [
"url_example",
] # [str] |
context = [
"context_example",
] # [str] |
# example passing only required values which don't have defaults set
try:
api_instance.test_query_parameter_collection_format(pipe, ioutil, http, url, context)

View File

@@ -48,8 +48,10 @@ configuration = petstore_api.Configuration(
with petstore_api.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = fake_classname_tags_123_api.FakeClassnameTags123Api(api_client)
client = Client() # Client | client model
client = Client(
client="client_example",
) # Client | client model
# example passing only required values which don't have defaults set
try:
# To test class name in snake case

View File

@@ -3,7 +3,7 @@
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**bar** | **str** | | [optional] if omitted the server will use the default value of 'bar'
**bar** | **str** | | [optional] if omitted the server will use the default value of "bar"
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -16,6 +16,7 @@ Name | Type | Description | Notes
**binary** | **file_type** | | [optional]
**date_time** | **datetime** | | [optional]
**uuid** | **str** | | [optional]
**uuid_no_example** | **str** | | [optional]
**pattern_with_digits** | **str** | A string that is a 10 digit number. Can have leading zeros. | [optional]
**pattern_with_digits_and_delimiter** | **str** | A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. | [optional]

View File

@@ -4,7 +4,7 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**enum_form_string_array** | **[str]** | Form parameter enum test (string array) | [optional]
**enum_form_string** | **str** | Form parameter enum test (string) | [optional] if omitted the server will use the default value of '-efg'
**enum_form_string** | **str** | Form parameter enum test (string) | [optional] if omitted the server will use the default value of "-efg"
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -110,8 +110,25 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN'
with petstore_api.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = pet_api.PetApi(api_client)
pet = Pet() # Pet | Pet object that needs to be added to the store
pet = Pet(
id=1,
category=Category(
id=1,
name="default-name",
),
name="doggie",
photo_urls=[
"photo_urls_example",
],
tags=[
Tag(
id=1,
name="name_example",
),
],
status="available",
) # Pet | Pet object that needs to be added to the store
# example passing only required values which don't have defaults set
try:
# Add a new pet to the store
@@ -180,8 +197,8 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN'
with petstore_api.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = pet_api.PetApi(api_client)
pet_id = 56 # int | Pet id to delete
api_key = 'api_key_example' # str | (optional)
pet_id = 1 # int | Pet id to delete
api_key = "api_key_example" # str | (optional)
# example passing only required values which don't have defaults set
try:
@@ -323,8 +340,10 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN'
with petstore_api.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = pet_api.PetApi(api_client)
status = ['status_example'] # [str] | Status values that need to be considered for filter
status = [
"available",
] # [str] | Status values that need to be considered for filter
# example passing only required values which don't have defaults set
try:
# Finds Pets by status
@@ -458,8 +477,10 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN'
with petstore_api.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = pet_api.PetApi(api_client)
tags = ['tags_example'] # [str] | Tags to filter by
tags = [
"tags_example",
] # [str] | Tags to filter by
# example passing only required values which don't have defaults set
try:
# Finds Pets by tags
@@ -537,8 +558,8 @@ configuration = petstore_api.Configuration(
with petstore_api.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = pet_api.PetApi(api_client)
pet_id = 56 # int | ID of pet to return
pet_id = 1 # int | ID of pet to return
# example passing only required values which don't have defaults set
try:
# Find pet by ID
@@ -671,8 +692,25 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN'
with petstore_api.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = pet_api.PetApi(api_client)
pet = Pet() # Pet | Pet object that needs to be added to the store
pet = Pet(
id=1,
category=Category(
id=1,
name="default-name",
),
name="doggie",
photo_urls=[
"photo_urls_example",
],
tags=[
Tag(
id=1,
name="name_example",
),
],
status="available",
) # Pet | Pet object that needs to be added to the store
# example passing only required values which don't have defaults set
try:
# Update an existing pet
@@ -743,9 +781,9 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN'
with petstore_api.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = pet_api.PetApi(api_client)
pet_id = 56 # int | ID of pet that needs to be updated
name = 'name_example' # str | Updated name of the pet (optional)
status = 'status_example' # str | Updated status of the pet (optional)
pet_id = 1 # int | ID of pet that needs to be updated
name = "name_example" # str | Updated name of the pet (optional)
status = "status_example" # str | Updated status of the pet (optional)
# example passing only required values which don't have defaults set
try:
@@ -826,9 +864,9 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN'
with petstore_api.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = pet_api.PetApi(api_client)
pet_id = 56 # int | ID of pet to update
additional_metadata = 'additional_metadata_example' # str | Additional data to pass to server (optional)
file = open('/path/to/file', 'rb') # file_type | file to upload (optional)
pet_id = 1 # int | ID of pet to update
additional_metadata = "additional_metadata_example" # str | Additional data to pass to server (optional)
file = open('/path/to/file', 'rb') # file_type | file to upload (optional)
# example passing only required values which don't have defaults set
try:
@@ -911,9 +949,9 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN'
with petstore_api.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = pet_api.PetApi(api_client)
pet_id = 56 # int | ID of pet to update
pet_id = 1 # int | ID of pet to update
required_file = open('/path/to/file', 'rb') # file_type | file to upload
additional_metadata = 'additional_metadata_example' # str | Additional data to pass to server (optional)
additional_metadata = "additional_metadata_example" # str | Additional data to pass to server (optional)
# example passing only required values which don't have defaults set
try:

View File

@@ -35,8 +35,8 @@ configuration = petstore_api.Configuration(
with petstore_api.ApiClient() as api_client:
# Create an instance of the API class
api_instance = store_api.StoreApi(api_client)
order_id = 'order_id_example' # str | ID of the order that needs to be deleted
order_id = "order_id_example" # str | ID of the order that needs to be deleted
# example passing only required values which don't have defaults set
try:
# Delete purchase order by ID
@@ -112,7 +112,7 @@ configuration = petstore_api.Configuration(
with petstore_api.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = store_api.StoreApi(api_client)
# example, this endpoint has no required or optional parameters
try:
# Returns pet inventories by status
@@ -171,8 +171,8 @@ configuration = petstore_api.Configuration(
with petstore_api.ApiClient() as api_client:
# Create an instance of the API class
api_instance = store_api.StoreApi(api_client)
order_id = 56 # int | ID of pet that needs to be fetched
order_id = 1 # int | ID of pet that needs to be fetched
# example passing only required values which don't have defaults set
try:
# Find purchase order by ID
@@ -234,8 +234,15 @@ configuration = petstore_api.Configuration(
with petstore_api.ApiClient() as api_client:
# Create an instance of the API class
api_instance = store_api.StoreApi(api_client)
order = Order() # Order | order placed for purchasing the pet
order = Order(
id=1,
pet_id=1,
quantity=1,
ship_date=dateutil_parser('2020-02-02T20:20:20.000222Z'),
status="placed",
complete=False,
) # Order | order placed for purchasing the pet
# example passing only required values which don't have defaults set
try:
# Place an order for a pet

View File

@@ -3,7 +3,9 @@
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**value** | **str** | | must be one of ["placed", "approved", "delivered", ]
**value** | **str** | | must be one of ["placed", "approved", "delivered", "single quoted", '''multiple
lines''', '''double quote
with newline''', ]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -3,7 +3,7 @@
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**value** | **str** | | if omitted the server will use the default value of 'placed', must be one of ["placed", "approved", "delivered", ]
**value** | **str** | | if omitted the server will use the default value of "placed", must be one of ["placed", "approved", "delivered", ]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -40,8 +40,21 @@ configuration = petstore_api.Configuration(
with petstore_api.ApiClient() as api_client:
# Create an instance of the API class
api_instance = user_api.UserApi(api_client)
user = User() # User | Created user object
user = User(
id=1,
username="username_example",
first_name="first_name_example",
last_name="last_name_example",
email="email_example",
password="password_example",
phone="phone_example",
user_status=1,
object_with_no_declared_props={},
object_with_no_declared_props_nullable={},
any_type_prop=None,
any_type_prop_nullable=None,
) # User | Created user object
# example passing only required values which don't have defaults set
try:
# Create user
@@ -100,8 +113,23 @@ configuration = petstore_api.Configuration(
with petstore_api.ApiClient() as api_client:
# Create an instance of the API class
api_instance = user_api.UserApi(api_client)
user = [User()] # [User] | List of user object
user = [
User(
id=1,
username="username_example",
first_name="first_name_example",
last_name="last_name_example",
email="email_example",
password="password_example",
phone="phone_example",
user_status=1,
object_with_no_declared_props={},
object_with_no_declared_props_nullable={},
any_type_prop=None,
any_type_prop_nullable=None,
),
] # [User] | List of user object
# example passing only required values which don't have defaults set
try:
# Creates list of users with given input array
@@ -160,8 +188,23 @@ configuration = petstore_api.Configuration(
with petstore_api.ApiClient() as api_client:
# Create an instance of the API class
api_instance = user_api.UserApi(api_client)
user = [User()] # [User] | List of user object
user = [
User(
id=1,
username="username_example",
first_name="first_name_example",
last_name="last_name_example",
email="email_example",
password="password_example",
phone="phone_example",
user_status=1,
object_with_no_declared_props={},
object_with_no_declared_props_nullable={},
any_type_prop=None,
any_type_prop_nullable=None,
),
] # [User] | List of user object
# example passing only required values which don't have defaults set
try:
# Creates list of users with given input array
@@ -221,8 +264,8 @@ configuration = petstore_api.Configuration(
with petstore_api.ApiClient() as api_client:
# Create an instance of the API class
api_instance = user_api.UserApi(api_client)
username = 'username_example' # str | The name that needs to be deleted
username = "username_example" # str | The name that needs to be deleted
# example passing only required values which don't have defaults set
try:
# Delete user
@@ -282,8 +325,8 @@ configuration = petstore_api.Configuration(
with petstore_api.ApiClient() as api_client:
# Create an instance of the API class
api_instance = user_api.UserApi(api_client)
username = 'username_example' # str | The name that needs to be fetched. Use user1 for testing.
username = "username_example" # str | The name that needs to be fetched. Use user1 for testing.
# example passing only required values which don't have defaults set
try:
# Get user by user name
@@ -344,9 +387,9 @@ configuration = petstore_api.Configuration(
with petstore_api.ApiClient() as api_client:
# Create an instance of the API class
api_instance = user_api.UserApi(api_client)
username = 'username_example' # str | The user name for login
password = 'password_example' # str | The password for login in clear text
username = "username_example" # str | The user name for login
password = "password_example" # str | The password for login in clear text
# example passing only required values which don't have defaults set
try:
# Logs user into the system
@@ -407,7 +450,7 @@ configuration = petstore_api.Configuration(
with petstore_api.ApiClient() as api_client:
# Create an instance of the API class
api_instance = user_api.UserApi(api_client)
# example, this endpoint has no required or optional parameters
try:
# Logs out current logged in user session
@@ -465,9 +508,22 @@ configuration = petstore_api.Configuration(
with petstore_api.ApiClient() as api_client:
# Create an instance of the API class
api_instance = user_api.UserApi(api_client)
username = 'username_example' # str | name that need to be deleted
user = User() # User | Updated user object
username = "username_example" # str | name that need to be deleted
user = User(
id=1,
username="username_example",
first_name="first_name_example",
last_name="last_name_example",
email="email_example",
password="password_example",
phone="phone_example",
user_status=1,
object_with_no_declared_props={},
object_with_no_declared_props_nullable={},
any_type_prop=None,
any_type_prop_nullable=None,
) # User | Updated user object
# example passing only required values which don't have defaults set
try:
# Updated user

View File

@@ -30,6 +30,7 @@ from petstore_api.model.client import Client
from petstore_api.model.composed_one_of_number_with_validations import ComposedOneOfNumberWithValidations
from petstore_api.model.file_schema_test_class import FileSchemaTestClass
from petstore_api.model.health_check_result import HealthCheckResult
from petstore_api.model.mammal import Mammal
from petstore_api.model.number_with_validations import NumberWithValidations
from petstore_api.model.object_model_with_ref_props import ObjectModelWithRefProps
from petstore_api.model.string_enum import StringEnum
@@ -710,6 +711,124 @@ class FakeApi(object):
callable=__fake_health_get
)
def __mammal(
self,
mammal,
**kwargs
):
"""mammal # noqa: E501
Test serialization of mammals # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.mammal(mammal, async_req=True)
>>> result = thread.get()
Args:
mammal (Mammal): Input mammal
Keyword Args:
_return_http_data_only (bool): response data without head status
code and headers. Default is True.
_preload_content (bool): if False, the urllib3.HTTPResponse object
will be returned without reading/decoding response data.
Default is True.
_request_timeout (float/tuple): timeout setting for this request. If one
number provided, it will be total request timeout. It can also
be a pair (tuple) of (connection, read) timeouts.
Default is None.
_check_input_type (bool): specifies if type checking
should be done one the data sent to the server.
Default is True.
_check_return_type (bool): specifies if type checking
should be done one the data received from the server.
Default is True.
_host_index (int/None): specifies the index of the server
that we want to use.
Default is read from the configuration.
async_req (bool): execute request asynchronously
Returns:
Mammal
If the method is called asynchronously, returns the request
thread.
"""
kwargs['async_req'] = kwargs.get(
'async_req', False
)
kwargs['_return_http_data_only'] = kwargs.get(
'_return_http_data_only', True
)
kwargs['_preload_content'] = kwargs.get(
'_preload_content', True
)
kwargs['_request_timeout'] = kwargs.get(
'_request_timeout', None
)
kwargs['_check_input_type'] = kwargs.get(
'_check_input_type', True
)
kwargs['_check_return_type'] = kwargs.get(
'_check_return_type', True
)
kwargs['_host_index'] = kwargs.get('_host_index')
kwargs['mammal'] = \
mammal
return self.call_with_http_info(**kwargs)
self.mammal = Endpoint(
settings={
'response_type': (Mammal,),
'auth': [],
'endpoint_path': '/fake/refs/mammal',
'operation_id': 'mammal',
'http_method': 'POST',
'servers': None,
},
params_map={
'all': [
'mammal',
],
'required': [
'mammal',
],
'nullable': [
],
'enum': [
],
'validation': [
]
},
root_map={
'validations': {
},
'allowed_values': {
},
'openapi_types': {
'mammal':
(Mammal,),
},
'attribute_map': {
},
'location_map': {
'mammal': 'body',
},
'collection_format_map': {
}
},
headers_map={
'accept': [
'application/json'
],
'content_type': [
'application/json'
]
},
api_client=api_client,
callable=__mammal
)
def __number_with_validations(
self,
**kwargs
@@ -1549,7 +1668,7 @@ class FakeApi(object):
string (str): None. [optional]
binary (file_type): None. [optional]
date (date): None. [optional]
date_time (datetime): None. [optional]
date_time (datetime): None. [optional] if omitted the server will use the default value of dateutil_parser('2010-02-01T10:20:10.11111+01:00')
password (str): None. [optional]
param_callback (str): None. [optional]
_return_http_data_only (bool): response data without head status
@@ -1792,13 +1911,13 @@ class FakeApi(object):
Keyword Args:
enum_header_string_array ([str]): Header parameter enum test (string array). [optional]
enum_header_string (str): Header parameter enum test (string). [optional] if omitted the server will use the default value of '-efg'
enum_header_string (str): Header parameter enum test (string). [optional] if omitted the server will use the default value of "-efg"
enum_query_string_array ([str]): Query parameter enum test (string array). [optional]
enum_query_string (str): Query parameter enum test (string). [optional] if omitted the server will use the default value of '-efg'
enum_query_string (str): Query parameter enum test (string). [optional] if omitted the server will use the default value of "-efg"
enum_query_integer (int): Query parameter enum test (double). [optional]
enum_query_double (float): Query parameter enum test (double). [optional]
enum_form_string_array ([str]): Form parameter enum test (string array). [optional] if omitted the server will use the default value of '$'
enum_form_string (str): Form parameter enum test (string). [optional] if omitted the server will use the default value of '-efg'
enum_form_string_array ([str]): Form parameter enum test (string array). [optional] if omitted the server will use the default value of "$"
enum_form_string (str): Form parameter enum test (string). [optional] if omitted the server will use the default value of "-efg"
_return_http_data_only (bool): response data without head status
code and headers. Default is True.
_preload_content (bool): if False, the urllib3.HTTPResponse object

View File

@@ -152,7 +152,7 @@ class Animal(ModelNormal):
Animal class but this time we won't travel
through its discriminator because we passed in
_visited_composed_classes = (Animal,)
color (str): [optional] if omitted the server will use the default value of 'red' # noqa: E501
color (str): [optional] if omitted the server will use the default value of "red" # noqa: E501
"""
_check_type = kwargs.pop('_check_type', True)

View File

@@ -162,7 +162,7 @@ class Cat(ModelComposed):
through its discriminator because we passed in
_visited_composed_classes = (Animal,)
declawed (bool): [optional] # noqa: E501
color (str): [optional] if omitted the server will use the default value of 'red' # noqa: E501
color (str): [optional] if omitted the server will use the default value of "red" # noqa: E501
"""
_check_type = kwargs.pop('_check_type', True)

View File

@@ -108,7 +108,7 @@ class Category(ModelNormal):
Args:
Keyword Args:
name (str): defaults to 'default-name' # noqa: E501
name (str): defaults to "default-name" # noqa: E501
_check_type (bool): if True, values for parameters in openapi_types
will be type checked and a TypeError will be
raised if the wrong type is input.
@@ -142,7 +142,7 @@ class Category(ModelNormal):
id (int): [optional] # noqa: E501
"""
name = kwargs.get('name', 'default-name')
name = kwargs.get('name', "default-name")
_check_type = kwargs.pop('_check_type', True)
_spec_property_naming = kwargs.pop('_spec_property_naming', False)
_path_to_item = kwargs.pop('_path_to_item', ())

View File

@@ -154,7 +154,7 @@ class ComposedOneOfNumberWithValidations(ModelComposed):
Animal class but this time we won't travel
through its discriminator because we passed in
_visited_composed_classes = (Animal,)
color (str): [optional] if omitted the server will use the default value of 'red' # noqa: E501
color (str): [optional] if omitted the server will use the default value of "red" # noqa: E501
"""
class_name = kwargs.get('class_name', nulltype.Null)

View File

@@ -160,7 +160,7 @@ class Dog(ModelComposed):
through its discriminator because we passed in
_visited_composed_classes = (Animal,)
breed (str): [optional] # noqa: E501
color (str): [optional] if omitted the server will use the default value of 'red' # noqa: E501
color (str): [optional] if omitted the server will use the default value of "red" # noqa: E501
"""
_check_type = kwargs.pop('_check_type', True)

View File

@@ -103,7 +103,7 @@ class EnumClass(ModelSimple):
"""EnumClass - a model defined in OpenAPI
Args:
value (str): if omitted the server will use the default value of '-efg', must be one of ["_abc", "-efg", "(xyz)", ] # noqa: E501
value (str): if omitted the server will use the default value of "-efg", must be one of ["_abc", "-efg", "(xyz)", ] # noqa: E501
Keyword Args:
_check_type (bool): if True, values for parameters in openapi_types

View File

@@ -134,7 +134,7 @@ class Foo(ModelNormal):
Animal class but this time we won't travel
through its discriminator because we passed in
_visited_composed_classes = (Animal,)
bar (str): [optional] if omitted the server will use the default value of 'bar' # noqa: E501
bar (str): [optional] if omitted the server will use the default value of "bar" # noqa: E501
"""
_check_type = kwargs.pop('_check_type', True)

View File

@@ -132,6 +132,7 @@ class FormatTest(ModelNormal):
'binary': (file_type,), # noqa: E501
'date_time': (datetime,), # noqa: E501
'uuid': (str,), # noqa: E501
'uuid_no_example': (str,), # noqa: E501
'pattern_with_digits': (str,), # noqa: E501
'pattern_with_digits_and_delimiter': (str,), # noqa: E501
}
@@ -155,6 +156,7 @@ class FormatTest(ModelNormal):
'binary': 'binary', # noqa: E501
'date_time': 'dateTime', # noqa: E501
'uuid': 'uuid', # noqa: E501
'uuid_no_example': 'uuidNoExample', # noqa: E501
'pattern_with_digits': 'pattern_with_digits', # noqa: E501
'pattern_with_digits_and_delimiter': 'pattern_with_digits_and_delimiter', # noqa: E501
}
@@ -220,6 +222,7 @@ class FormatTest(ModelNormal):
binary (file_type): [optional] # noqa: E501
date_time (datetime): [optional] # noqa: E501
uuid (str): [optional] # noqa: E501
uuid_no_example (str): [optional] # noqa: E501
pattern_with_digits (str): A string that is a 10 digit number. Can have leading zeros.. [optional] # noqa: E501
pattern_with_digits_and_delimiter (str): A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01.. [optional] # noqa: E501
"""

View File

@@ -146,7 +146,7 @@ class InlineObject2(ModelNormal):
through its discriminator because we passed in
_visited_composed_classes = (Animal,)
enum_form_string_array ([str]): Form parameter enum test (string array). [optional] # noqa: E501
enum_form_string (str): Form parameter enum test (string). [optional] if omitted the server will use the default value of '-efg' # noqa: E501
enum_form_string (str): Form parameter enum test (string). [optional] if omitted the server will use the default value of "-efg" # noqa: E501
"""
_check_type = kwargs.pop('_check_type', True)

View File

@@ -57,6 +57,11 @@ class StringEnum(ModelSimple):
'PLACED': "placed",
'APPROVED': "approved",
'DELIVERED': "delivered",
'SINGLE_QUOTED': "single quoted",
'MULTIPLE_LINES': '''multiple
lines''',
'DOUBLE_QUOTE_WITH_NEWLINE': '''double quote
with newline''',
},
}
@@ -104,7 +109,9 @@ class StringEnum(ModelSimple):
"""StringEnum - a model defined in OpenAPI
Args:
value (str):, must be one of ["placed", "approved", "delivered", ] # noqa: E501
value (str):, must be one of ["placed", "approved", "delivered", "single quoted", '''multiple
lines''', '''double quote
with newline''', ] # noqa: E501
Keyword Args:
_check_type (bool): if True, values for parameters in openapi_types

View File

@@ -103,7 +103,7 @@ class StringEnumWithDefaultValue(ModelSimple):
"""StringEnumWithDefaultValue - a model defined in OpenAPI
Args:
value (str): if omitted the server will use the default value of 'placed', must be one of ["placed", "approved", "delivered", ] # noqa: E501
value (str): if omitted the server will use the default value of "placed", must be one of ["placed", "approved", "delivered", ] # noqa: E501
Keyword Args:
_check_type (bool): if True, values for parameters in openapi_types

View File

@@ -42,7 +42,10 @@ class TestStringEnum(unittest.TestCase):
'None': None,
'PLACED': "placed",
'APPROVED': "approved",
'DELIVERED': "delivered"
'DELIVERED': "delivered",
'DOUBLE_QUOTE_WITH_NEWLINE': "double quote \n with newline",
'MULTIPLE_LINES': "multiple\nlines",
'SINGLE_QUOTED': "single quoted"
}