forked from loafle/openapi-generator-original
[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:
@@ -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)
|
||||
|
||||
|
||||
@@ -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)
|
||||
body = Client() # Client | client model
|
||||
|
||||
body = Client(
|
||||
client="client_example",
|
||||
) # Client | client model
|
||||
|
||||
# example passing only required values which don't have defaults set
|
||||
try:
|
||||
# To test special tags
|
||||
|
||||
@@ -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"
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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"
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -48,7 +48,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
|
||||
@@ -173,8 +175,56 @@ 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)
|
||||
xml_item = XmlItem() # XmlItem | XmlItem Body
|
||||
|
||||
xml_item = XmlItem(
|
||||
attribute_string="string",
|
||||
attribute_number=1.234,
|
||||
attribute_integer=-2,
|
||||
attribute_boolean=True,
|
||||
wrapped_array=[
|
||||
1,
|
||||
],
|
||||
name_string="string",
|
||||
name_number=1.234,
|
||||
name_integer=-2,
|
||||
name_boolean=True,
|
||||
name_array=[
|
||||
1,
|
||||
],
|
||||
name_wrapped_array=[
|
||||
1,
|
||||
],
|
||||
prefix_string="string",
|
||||
prefix_number=1.234,
|
||||
prefix_integer=-2,
|
||||
prefix_boolean=True,
|
||||
prefix_array=[
|
||||
1,
|
||||
],
|
||||
prefix_wrapped_array=[
|
||||
1,
|
||||
],
|
||||
namespace_string="string",
|
||||
namespace_number=1.234,
|
||||
namespace_integer=-2,
|
||||
namespace_boolean=True,
|
||||
namespace_array=[
|
||||
1,
|
||||
],
|
||||
namespace_wrapped_array=[
|
||||
1,
|
||||
],
|
||||
prefix_ns_string="string",
|
||||
prefix_ns_number=1.234,
|
||||
prefix_ns_integer=-2,
|
||||
prefix_ns_boolean=True,
|
||||
prefix_ns_array=[
|
||||
1,
|
||||
],
|
||||
prefix_ns_wrapped_array=[
|
||||
1,
|
||||
],
|
||||
) # XmlItem | XmlItem Body
|
||||
|
||||
# example passing only required values which don't have defaults set
|
||||
try:
|
||||
# creates an XmlItem
|
||||
@@ -235,7 +285,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(1E+1) # NumberWithValidations | Input number as post body (optional)
|
||||
|
||||
# example passing only required values which don't have defaults set
|
||||
# and optional values
|
||||
@@ -298,7 +348,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(1E+1),
|
||||
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
|
||||
@@ -360,7 +414,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
|
||||
@@ -486,8 +540,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)
|
||||
body = FileSchemaTestClass() # FileSchemaTestClass |
|
||||
|
||||
body = 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(body)
|
||||
@@ -545,9 +608,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)
|
||||
query = 'query_example' # str |
|
||||
body = User() # User |
|
||||
|
||||
query = "query_example" # str |
|
||||
body = 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,
|
||||
) # User |
|
||||
|
||||
# example passing only required values which don't have defaults set
|
||||
try:
|
||||
api_instance.test_body_with_query_params(query, body)
|
||||
@@ -608,8 +680,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)
|
||||
body = Client() # Client | client model
|
||||
|
||||
body = Client(
|
||||
client="client_example",
|
||||
) # Client | client model
|
||||
|
||||
# example passing only required values which don't have defaults set
|
||||
try:
|
||||
# To test \"client\" model
|
||||
@@ -670,7 +744,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 passing only required values which don't have defaults set
|
||||
try:
|
||||
api_instance.test_endpoint_enums_length_one()
|
||||
@@ -683,8 +757,8 @@ with petstore_api.ApiClient() as api_client:
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**query_integer** | **int**| | defaults to 3
|
||||
**query_string** | **str**| | defaults to 'brillig'
|
||||
**path_string** | **str**| | defaults to 'hello'
|
||||
**query_string** | **str**| | defaults to "brillig"
|
||||
**path_string** | **str**| | defaults to "hello"
|
||||
**path_integer** | **int**| | defaults to 34
|
||||
**header_number** | **float**| | defaults to 1.234
|
||||
|
||||
@@ -744,20 +818,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('1970-01-01T00:00:00.00Z') # datetime | None (optional)
|
||||
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:
|
||||
@@ -840,14 +914,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
|
||||
@@ -863,13 +941,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
|
||||
|
||||
@@ -917,12 +995,12 @@ 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)
|
||||
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:
|
||||
@@ -994,8 +1072,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)
|
||||
param = {'key': 'param_example'} # {str: (str,)} | request body
|
||||
|
||||
param = {
|
||||
"key": "key_example",
|
||||
} # {str: (str,)} | request body
|
||||
|
||||
# example passing only required values which don't have defaults set
|
||||
try:
|
||||
# test inline additionalProperties
|
||||
@@ -1053,9 +1133,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
|
||||
|
||||
@@ -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)
|
||||
body = Client() # Client | client model
|
||||
|
||||
body = 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
|
||||
|
||||
@@ -50,8 +50,26 @@ 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)
|
||||
body = Pet() # Pet | Pet object that needs to be added to the store
|
||||
|
||||
body = Pet(
|
||||
id=1,
|
||||
category=Category(
|
||||
id=1,
|
||||
name="default-name",
|
||||
),
|
||||
name="doggie",
|
||||
photo_urls=[
|
||||
"photo_urls_example",
|
||||
],
|
||||
tags=[
|
||||
Tag(
|
||||
id=1,
|
||||
name="name_example",
|
||||
full_name="full_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
|
||||
@@ -121,8 +139,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:
|
||||
@@ -205,8 +223,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
|
||||
@@ -280,8 +300,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
|
||||
@@ -359,8 +381,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
|
||||
@@ -433,8 +455,26 @@ 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)
|
||||
body = Pet() # Pet | Pet object that needs to be added to the store
|
||||
|
||||
body = Pet(
|
||||
id=1,
|
||||
category=Category(
|
||||
id=1,
|
||||
name="default-name",
|
||||
),
|
||||
name="doggie",
|
||||
photo_urls=[
|
||||
"photo_urls_example",
|
||||
],
|
||||
tags=[
|
||||
Tag(
|
||||
id=1,
|
||||
name="name_example",
|
||||
full_name="full_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
|
||||
@@ -506,9 +546,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:
|
||||
@@ -589,10 +629,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)
|
||||
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)
|
||||
files = open('/path/to/file', 'rb') # [file_type] | files 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)
|
||||
files = # [file_type] | files to upload (optional)
|
||||
|
||||
# example passing only required values which don't have defaults set
|
||||
try:
|
||||
@@ -676,9 +716,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:
|
||||
|
||||
@@ -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)
|
||||
body = Order() # Order | order placed for purchasing the pet
|
||||
|
||||
body = Order(
|
||||
id=1,
|
||||
pet_id=1,
|
||||
quantity=1,
|
||||
ship_date=dateutil_parser('1970-01-01T00:00:00.00Z'),
|
||||
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
|
||||
|
||||
@@ -5,7 +5,7 @@ a model to test optional properties with server defaults
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**array_item** | **[int]** | |
|
||||
**string_item** | **str** | | defaults to 'what'
|
||||
**string_item** | **str** | | defaults to "what"
|
||||
**number_item** | **float** | | defaults to 1.234
|
||||
**integer_item** | **int** | | defaults to -2
|
||||
**bool_item** | **bool** | | defaults to True
|
||||
|
||||
@@ -6,7 +6,7 @@ Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**bool_item** | **bool** | |
|
||||
**array_item** | **[int]** | |
|
||||
**string_item** | **str** | | defaults to 'what'
|
||||
**string_item** | **str** | | defaults to "what"
|
||||
**number_item** | **float** | | defaults to 1.234
|
||||
**integer_item** | **int** | | defaults to -2
|
||||
|
||||
|
||||
@@ -40,8 +40,17 @@ 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)
|
||||
body = User() # User | Created user object
|
||||
|
||||
body = 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,
|
||||
) # User | Created user object
|
||||
|
||||
# example passing only required values which don't have defaults set
|
||||
try:
|
||||
# Create user
|
||||
@@ -100,8 +109,19 @@ 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)
|
||||
body = [User()] # [User] | List of user object
|
||||
|
||||
body = [
|
||||
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,
|
||||
),
|
||||
] # [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 +180,19 @@ 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)
|
||||
body = [User()] # [User] | List of user object
|
||||
|
||||
body = [
|
||||
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,
|
||||
),
|
||||
] # [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 +252,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 +313,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 +375,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 +438,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 +496,18 @@ 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
|
||||
body = User() # User | Updated user object
|
||||
|
||||
username = "username_example" # str | name that need to be deleted
|
||||
body = 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,
|
||||
) # User | Updated user object
|
||||
|
||||
# example passing only required values which don't have defaults set
|
||||
try:
|
||||
# Updated user
|
||||
|
||||
Reference in New Issue
Block a user