[python-experimental] Quicken package loading (#6437)

* apis and models contains all apis and models, omits loading them in the package namespace

* Runs git add -a and commits it

* Fixes test_outer_enum.py

* Fixes test_fruit.py

* Updates test_fruit and test_mammal

* Fixes test_parent_pet

* Updates test_discard_unknown_properties.py

* Updates test_deserialization.py

* Updates v2 docs md files for apis + the readme

* Fixes v2 tests

* v2 doc updates

* Updates v3 docs

* Reverts python_doc_auth_partial.mustache

* Adds sys to v3 tests

* Adds FILES update

Co-authored-by: Justin Black <justinblack@justins-air.lan>
This commit is contained in:
Justin Black
2020-06-01 00:25:37 -07:00
committed by GitHub
parent 6783b90fe2
commit d8c422398e
363 changed files with 2503 additions and 2005 deletions

View File

@@ -97,6 +97,9 @@ public class PythonClientExperimentalCodegen extends PythonClientCodegen {
apiDocTemplateFiles.remove("api_doc.mustache");
apiDocTemplateFiles.put("python-experimental/api_doc.mustache", ".md");
apiTestTemplateFiles.remove("api_test.mustache", ".py");
apiTestTemplateFiles.put("python-experimental/api_test.mustache", ".py");
modelDocTemplateFiles.remove("model_doc.mustache");
modelDocTemplateFiles.put("python-experimental/model_doc.mustache", ".md");
@@ -123,6 +126,7 @@ public class PythonClientExperimentalCodegen extends PythonClientCodegen {
this.setLegacyDiscriminatorBehavior(false);
super.processOpts();
modelPackage = packageName + "." + "model";
supportingFiles.remove(new SupportingFile("api_client.mustache", packagePath(), "api_client.py"));
supportingFiles.add(new SupportingFile("python-experimental/api_client.mustache", packagePath(), "api_client.py"));
@@ -130,11 +134,14 @@ public class PythonClientExperimentalCodegen extends PythonClientCodegen {
supportingFiles.add(new SupportingFile("python-experimental/model_utils.mustache", packagePath(), "model_utils.py"));
supportingFiles.remove(new SupportingFile("__init__model.mustache", packagePath() + File.separatorChar + "models", "__init__.py"));
supportingFiles.add(new SupportingFile("python-experimental/__init__model.mustache", packagePath() + File.separatorChar + "models", "__init__.py"));
supportingFiles.add(new SupportingFile("python-experimental/__init__model.mustache", packagePath() + File.separatorChar + "model", "__init__.py"));
supportingFiles.remove(new SupportingFile("__init__package.mustache", packagePath(), "__init__.py"));
supportingFiles.add(new SupportingFile("python-experimental/__init__package.mustache", packagePath(), "__init__.py"));
// add the models and apis folders
supportingFiles.add(new SupportingFile("python-experimental/__init__models.mustache", packagePath() + File.separatorChar + "models", "__init__.py"));
supportingFiles.add(new SupportingFile("python-experimental/__init__apis.mustache", packagePath() + File.separatorChar + "apis", "__init__.py"));
// Generate the 'signing.py' module, but only if the 'HTTP signature' security scheme is specified in the OAS.
Map<String, SecurityScheme> securitySchemeMap = openAPI != null ?
@@ -518,9 +525,9 @@ public class PythonClientExperimentalCodegen extends PythonClientCodegen {
// set the example value
if (modelProp.isEnum) {
String value = modelProp._enum.get(0).toString();
result.example = this.packageName + "." + result.baseType + "(" + toEnumValue(value, simpleDataType) + ")";
result.example = result.dataType + "(" + toEnumValue(value, simpleDataType) + ")";
} else {
result.example = this.packageName + "." + result.baseType + "(" + result.example + ")";
result.example = result.dataType + "(" + result.example + ")";
}
} else if (!result.isPrimitiveType) {
// fix the baseType for the api docs so the .md link to the class's documentation file is correct
@@ -1064,7 +1071,7 @@ public class PythonClientExperimentalCodegen extends PythonClientCodegen {
example = "'" + escapeText(example) + "'";
} else if (!languageSpecificPrimitives.contains(type)) {
// type is a model class, e.g. user.User
example = this.packageName + "." + getPythonClassName(type) + "()";
example = type + "()";
} else {
LOGGER.warn("Type " + type + " not handled properly in setParameterExampleValue");
}

View File

@@ -4,13 +4,22 @@ from __future__ import print_function
import time
import {{{packageName}}}
from pprint import pprint
{{#apiInfo}}{{#apis}}{{#-first}}{{#operations}}{{#operation}}{{#-first}}
{{#apiInfo}}
{{#apis}}
{{#-first}}
from {{apiPackage}} import {{classVarName}}
{{#imports}}
{{{import}}}
{{/imports}}
{{#operations}}
{{#operation}}
{{#-first}}
{{> python_doc_auth_partial}}
# Enter a context with an instance of the API client
with {{{packageName}}}.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = {{{packageName}}}.{{{classname}}}(api_client)
api_instance = {{classVarName}}.{{{classname}}}(api_client)
{{#allParams}}{{paramName}} = {{{example}}} # {{{dataType}}} | {{{description}}}{{^required}} (optional){{/required}}{{#defaultValue}} (default to {{{.}}}){{/defaultValue}}
{{/allParams}}
@@ -20,7 +29,12 @@ with {{{packageName}}}.ApiClient(configuration) as api_client:
pprint(api_response){{/returnType}}
except {{{packageName}}}.ApiException as e:
print("Exception when calling {{classname}}->{{operationId}}: %s\n" % e)
{{/-first}}{{/operation}}{{/operations}}{{/-first}}{{/apis}}{{/apiInfo}}
{{/-first}}
{{/operation}}
{{/operations}}
{{/-first}}
{{/apis}}
{{/apiInfo}}
```
## Documentation for API Endpoints
@@ -77,3 +91,22 @@ Class | Method | HTTP request | Description
{{#apiInfo}}{{#apis}}{{^hasMore}}{{infoEmail}}
{{/hasMore}}{{/apis}}{{/apiInfo}}
## Notes for Large OpenAPI documents
If the OpenAPI document is large, imports in {{{packageName}}}.apis and {{{packageName}}}.models may fail with a
RecursionError indicating the maximum recursion limit has been exceeded. In that case, there are a couple of solutions:
Solution 1:
Use specific imports for apis and models like:
- `from {{{packageName}}}.api.default_api import DefaultApi`
- `from {{{packageName}}}.model.pet import Pet`
Solution 1:
Before importing the package, adjust the maximum recursion limit as shown below:
```
import sys
sys.setrecursionlimit(1500)
import {{{packageName}}}
from {{{packageName}}}.apis import *
from {{{packageName}}}.models import *
```

View File

@@ -0,0 +1,3 @@
# do not import all apis into this module because that uses a lot of memory and stack frames
# if you need the ability to import all models from one package, import them with
# from {{packageName}.apis import DefaultApi, PetApi

View File

@@ -0,0 +1,19 @@
# coding: utf-8
# flake8: noqa
# import all apis into this package
# if you have many ampis here with many many models used in each api this may
# raise a RecursionError
# to avoid this, import only the api that you directly need like:
# from {{packagename}}.api.pet_api import PetApi
# or import this package, but before doing it, use:
# import sys
# sys.setrecursionlimit(n)
# import apis into api package
{{#apiInfo}}
{{#apis}}
from {{apiPackage}}.{{classVarName}} import {{classname}}
{{/apis}}
{{/apiInfo}}

View File

@@ -1,7 +1,5 @@
# coding: utf-8
# flake8: noqa
{{>partial_header}}
# we can not import model classes here because that would create a circular
# reference which would not work in python2
# do not import all models into this module because that uses a lot of memory and stack frames
# if you need the ability to import all models from one package, import them with
# from {{packageName}.models import ModelA, ModelB

View File

@@ -0,0 +1,18 @@
# coding: utf-8
# flake8: noqa
# import all models into this package
# if you have many models here with many references from one model to another this may
# raise a RecursionError
# to avoid this, import only the models that you directly need like:
# from from {{modelPackage}}.pet import Pet
# or import this package, but before doing it, use:
# import sys
# sys.setrecursionlimit(n)
{{#models}}
{{#model}}
from {{modelPackage}}.{{classFilename}} import {{unescapedDescription}}
{{/model}}
{{/models}}

View File

@@ -8,13 +8,6 @@ from __future__ import absolute_import
__version__ = "{{packageVersion}}"
# import apis into sdk package
{{#apiInfo}}
{{#apis}}
from {{apiPackage}}.{{classVarName}} import {{classname}}
{{/apis}}
{{/apiInfo}}
# import ApiClient
from {{packageName}}.api_client import ApiClient
@@ -26,14 +19,8 @@ from {{packageName}}.signing import HttpSigningConfiguration
# import exceptions
from {{packageName}}.exceptions import OpenApiException
from {{packageName}}.exceptions import ApiAttributeError
from {{packageName}}.exceptions import ApiTypeError
from {{packageName}}.exceptions import ApiValueError
from {{packageName}}.exceptions import ApiKeyError
from {{packageName}}.exceptions import ApiException
# import models into sdk package
{{#models}}
{{#model}}
from {{modelPackage}}.{{classFilename}} import {{unescapedDescription}}
{{/model}}
{{/models}}

View File

@@ -2,6 +2,10 @@
from __future__ import print_function
import time
import {{{packageName}}}
from {{apiPackage}} import {{classVarName}}
{{#imports}}
{{{.}}}
{{/imports}}
from pprint import pprint
{{> python_doc_auth_partial}}
# Enter a context with an instance of the API client
@@ -12,7 +16,7 @@ with {{{packageName}}}.ApiClient(configuration) as api_client:
with {{{packageName}}}.ApiClient() as api_client:
{{/hasAuthMethods}}
# Create an instance of the API class
api_instance = {{{packageName}}}.{{{classname}}}(api_client)
api_instance = {{classVarName}}.{{{classname}}}(api_client)
{{#requiredParams}}{{^defaultValue}}{{paramName}} = {{{example}}} # {{{dataType}}} | {{{description}}}
{{/defaultValue}}{{/requiredParams}}{{#optionalParams}}{{paramName}} = {{{example}}} # {{{dataType}}} | {{{description}}}{{^required}} (optional){{/required}}{{#defaultValue}} if omitted the server will use the default value of {{{defaultValue}}}{{/defaultValue}}
{{/optionalParams}}

View File

@@ -0,0 +1,36 @@
# coding: utf-8
{{>partial_header}}
from __future__ import absolute_import
import unittest
import {{packageName}}
from {{apiPackage}}.{{classVarName}} import {{classname}} # noqa: E501
class {{#operations}}Test{{classname}}(unittest.TestCase):
"""{{classname}} unit test stubs"""
def setUp(self):
self.api = {{classname}}() # noqa: E501
def tearDown(self):
pass
{{#operation}}
def test_{{operationId}}(self):
"""Test case for {{{operationId}}}
{{#summary}}
{{{summary}}} # noqa: E501
{{/summary}}
"""
pass
{{/operation}}
{{/operations}}
if __name__ == '__main__':
unittest.main()

View File

@@ -3,12 +3,16 @@
{{>partial_header}}
from __future__ import absolute_import
import sys
import unittest
import {{packageName}}
{{#models}}
{{#model}}
import {{packageName}}
{{#imports}}
{{{.}}}
{{/imports}}
from {{modelPackage}}.{{classFilename}} import {{unescapedDescription}}
class Test{{unescapedDescription}}(unittest.TestCase):
@@ -23,7 +27,7 @@ class Test{{unescapedDescription}}(unittest.TestCase):
def test{{unescapedDescription}}(self):
"""Test {{unescapedDescription}}"""
# FIXME: construct object with mandatory attributes with example values
# model = {{packageName}}.{{unescapedDescription}}() # noqa: E501
# model = {{unescapedDescription}}() # noqa: E501
pass
{{/model}}

View File

@@ -80,72 +80,74 @@ petstore_api/api/pet_api.py
petstore_api/api/store_api.py
petstore_api/api/user_api.py
petstore_api/api_client.py
petstore_api/apis/__init__.py
petstore_api/configuration.py
petstore_api/exceptions.py
petstore_api/model/__init__.py
petstore_api/model/additional_properties_any_type.py
petstore_api/model/additional_properties_array.py
petstore_api/model/additional_properties_boolean.py
petstore_api/model/additional_properties_class.py
petstore_api/model/additional_properties_integer.py
petstore_api/model/additional_properties_number.py
petstore_api/model/additional_properties_object.py
petstore_api/model/additional_properties_string.py
petstore_api/model/animal.py
petstore_api/model/api_response.py
petstore_api/model/array_of_array_of_number_only.py
petstore_api/model/array_of_number_only.py
petstore_api/model/array_test.py
petstore_api/model/capitalization.py
petstore_api/model/cat.py
petstore_api/model/cat_all_of.py
petstore_api/model/category.py
petstore_api/model/child.py
petstore_api/model/child_all_of.py
petstore_api/model/child_cat.py
petstore_api/model/child_cat_all_of.py
petstore_api/model/child_dog.py
petstore_api/model/child_dog_all_of.py
petstore_api/model/child_lizard.py
petstore_api/model/child_lizard_all_of.py
petstore_api/model/class_model.py
petstore_api/model/client.py
petstore_api/model/dog.py
petstore_api/model/dog_all_of.py
petstore_api/model/enum_arrays.py
petstore_api/model/enum_class.py
petstore_api/model/enum_test.py
petstore_api/model/file.py
petstore_api/model/file_schema_test_class.py
petstore_api/model/format_test.py
petstore_api/model/grandparent.py
petstore_api/model/grandparent_animal.py
petstore_api/model/has_only_read_only.py
petstore_api/model/list.py
petstore_api/model/map_test.py
petstore_api/model/mixed_properties_and_additional_properties_class.py
petstore_api/model/model200_response.py
petstore_api/model/model_return.py
petstore_api/model/name.py
petstore_api/model/number_only.py
petstore_api/model/order.py
petstore_api/model/outer_composite.py
petstore_api/model/outer_enum.py
petstore_api/model/outer_number.py
petstore_api/model/parent.py
petstore_api/model/parent_all_of.py
petstore_api/model/parent_pet.py
petstore_api/model/pet.py
petstore_api/model/player.py
petstore_api/model/read_only_first.py
petstore_api/model/special_model_name.py
petstore_api/model/string_boolean_map.py
petstore_api/model/tag.py
petstore_api/model/type_holder_default.py
petstore_api/model/type_holder_example.py
petstore_api/model/user.py
petstore_api/model/xml_item.py
petstore_api/model_utils.py
petstore_api/models/__init__.py
petstore_api/models/additional_properties_any_type.py
petstore_api/models/additional_properties_array.py
petstore_api/models/additional_properties_boolean.py
petstore_api/models/additional_properties_class.py
petstore_api/models/additional_properties_integer.py
petstore_api/models/additional_properties_number.py
petstore_api/models/additional_properties_object.py
petstore_api/models/additional_properties_string.py
petstore_api/models/animal.py
petstore_api/models/api_response.py
petstore_api/models/array_of_array_of_number_only.py
petstore_api/models/array_of_number_only.py
petstore_api/models/array_test.py
petstore_api/models/capitalization.py
petstore_api/models/cat.py
petstore_api/models/cat_all_of.py
petstore_api/models/category.py
petstore_api/models/child.py
petstore_api/models/child_all_of.py
petstore_api/models/child_cat.py
petstore_api/models/child_cat_all_of.py
petstore_api/models/child_dog.py
petstore_api/models/child_dog_all_of.py
petstore_api/models/child_lizard.py
petstore_api/models/child_lizard_all_of.py
petstore_api/models/class_model.py
petstore_api/models/client.py
petstore_api/models/dog.py
petstore_api/models/dog_all_of.py
petstore_api/models/enum_arrays.py
petstore_api/models/enum_class.py
petstore_api/models/enum_test.py
petstore_api/models/file.py
petstore_api/models/file_schema_test_class.py
petstore_api/models/format_test.py
petstore_api/models/grandparent.py
petstore_api/models/grandparent_animal.py
petstore_api/models/has_only_read_only.py
petstore_api/models/list.py
petstore_api/models/map_test.py
petstore_api/models/mixed_properties_and_additional_properties_class.py
petstore_api/models/model200_response.py
petstore_api/models/model_return.py
petstore_api/models/name.py
petstore_api/models/number_only.py
petstore_api/models/order.py
petstore_api/models/outer_composite.py
petstore_api/models/outer_enum.py
petstore_api/models/outer_number.py
petstore_api/models/parent.py
petstore_api/models/parent_all_of.py
petstore_api/models/parent_pet.py
petstore_api/models/pet.py
petstore_api/models/player.py
petstore_api/models/read_only_first.py
petstore_api/models/special_model_name.py
petstore_api/models/string_boolean_map.py
petstore_api/models/tag.py
petstore_api/models/type_holder_default.py
petstore_api/models/type_holder_example.py
petstore_api/models/user.py
petstore_api/models/xml_item.py
petstore_api/rest.py
requirements.txt
setup.cfg

View File

@@ -50,7 +50,8 @@ from __future__ import print_function
import time
import petstore_api
from pprint import pprint
from petstore_api.api import another_fake_api
from petstore_api.model import client
# 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(
@@ -62,8 +63,8 @@ configuration = petstore_api.Configuration(
# Enter a context with an instance of the API client
with petstore_api.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = petstore_api.AnotherFakeApi(api_client)
body = petstore_api.Client() # client.Client | client model
api_instance = another_fake_api.AnotherFakeApi(api_client)
body = client.Client() # client.Client | client model
try:
# To test special tags
@@ -71,7 +72,6 @@ with petstore_api.ApiClient(configuration) as api_client:
pprint(api_response)
except petstore_api.ApiException as e:
print("Exception when calling AnotherFakeApi->call_123_test_special_tags: %s\n" % e)
```
## Documentation for API Endpoints
@@ -223,3 +223,22 @@ Class | Method | HTTP request | Description
## Notes for Large OpenAPI documents
If the OpenAPI document is large, imports in petstore_api.apis and petstore_api.models may fail with a
RecursionError indicating the maximum recursion limit has been exceeded. In that case, there are a couple of solutions:
Solution 1:
Use specific imports for apis and models like:
- `from petstore_api.api.default_api import DefaultApi`
- `from petstore_api.model.pet import Pet`
Solution 1:
Before importing the package, adjust the maximum recursion limit as shown below:
```
import sys
sys.setrecursionlimit(1500)
import petstore_api
from petstore_api.apis import *
from petstore_api.models import *
```

View File

@@ -20,6 +20,8 @@ To test special tags and operation ID starting with number
from __future__ import print_function
import time
import petstore_api
from petstore_api.api import another_fake_api
from petstore_api.model import client
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.
@@ -31,8 +33,8 @@ configuration = petstore_api.Configuration(
# 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 = petstore_api.AnotherFakeApi(api_client)
body = petstore_api.Client() # client.Client | client model
api_instance = another_fake_api.AnotherFakeApi(api_client)
body = client.Client() # client.Client | client model
# example passing only required values which don't have defaults set
try:

View File

@@ -34,6 +34,8 @@ this route creates an XmlItem
from __future__ import print_function
import time
import petstore_api
from petstore_api.api import fake_api
from petstore_api.model import xml_item
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.
@@ -45,8 +47,8 @@ configuration = petstore_api.Configuration(
# 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 = petstore_api.FakeApi(api_client)
xml_item = petstore_api.XmlItem() # xml_item.XmlItem | XmlItem Body
api_instance = fake_api.FakeApi(api_client)
xml_item = xml_item.XmlItem() # xml_item.XmlItem | XmlItem Body
# example passing only required values which don't have defaults set
try:
@@ -95,6 +97,7 @@ Test serialization of outer boolean types
from __future__ import print_function
import time
import petstore_api
from petstore_api.api import fake_api
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.
@@ -106,7 +109,7 @@ configuration = petstore_api.Configuration(
# 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 = petstore_api.FakeApi(api_client)
api_instance = fake_api.FakeApi(api_client)
body = True # bool | Input boolean as post body (optional)
# example passing only required values which don't have defaults set
@@ -157,6 +160,8 @@ Test serialization of object with outer number type
from __future__ import print_function
import time
import petstore_api
from petstore_api.api import fake_api
from petstore_api.model import outer_composite
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.
@@ -168,8 +173,8 @@ configuration = petstore_api.Configuration(
# 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 = petstore_api.FakeApi(api_client)
body = petstore_api.OuterComposite() # outer_composite.OuterComposite | Input composite as post body (optional)
api_instance = fake_api.FakeApi(api_client)
body = outer_composite.OuterComposite() # outer_composite.OuterComposite | Input composite as post body (optional)
# example passing only required values which don't have defaults set
# and optional values
@@ -219,6 +224,8 @@ Test serialization of outer enum
from __future__ import print_function
import time
import petstore_api
from petstore_api.api import fake_api
from petstore_api.model import outer_enum
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.
@@ -230,8 +237,8 @@ configuration = petstore_api.Configuration(
# 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 = petstore_api.FakeApi(api_client)
body = petstore_api.OuterEnum("placed") # outer_enum.OuterEnum | Input enum as post body (optional)
api_instance = fake_api.FakeApi(api_client)
body = outer_enum.OuterEnum("placed") # outer_enum.OuterEnum | Input enum as post body (optional)
# example passing only required values which don't have defaults set
# and optional values
@@ -281,6 +288,8 @@ Test serialization of outer number types
from __future__ import print_function
import time
import petstore_api
from petstore_api.api import fake_api
from petstore_api.model import outer_number
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.
@@ -292,8 +301,8 @@ configuration = petstore_api.Configuration(
# 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 = petstore_api.FakeApi(api_client)
body = petstore_api.OuterNumber(3.4) # outer_number.OuterNumber | Input number as post body (optional)
api_instance = fake_api.FakeApi(api_client)
body = outer_number.OuterNumber(3.4) # outer_number.OuterNumber | Input number as post body (optional)
# example passing only required values which don't have defaults set
# and optional values
@@ -343,6 +352,7 @@ Test serialization of outer string types
from __future__ import print_function
import time
import petstore_api
from petstore_api.api import fake_api
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.
@@ -354,7 +364,7 @@ configuration = petstore_api.Configuration(
# 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 = petstore_api.FakeApi(api_client)
api_instance = fake_api.FakeApi(api_client)
body = 'body_example' # str | Input string as post body (optional)
# example passing only required values which don't have defaults set
@@ -405,6 +415,8 @@ For this test, the body for this request much reference a schema named `File`.
from __future__ import print_function
import time
import petstore_api
from petstore_api.api import fake_api
from petstore_api.model import file_schema_test_class
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.
@@ -416,8 +428,8 @@ configuration = petstore_api.Configuration(
# 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 = petstore_api.FakeApi(api_client)
body = petstore_api.FileSchemaTestClass() # file_schema_test_class.FileSchemaTestClass |
api_instance = fake_api.FakeApi(api_client)
body = file_schema_test_class.FileSchemaTestClass() # file_schema_test_class.FileSchemaTestClass |
# example passing only required values which don't have defaults set
try:
@@ -463,6 +475,8 @@ No authorization required
from __future__ import print_function
import time
import petstore_api
from petstore_api.api import fake_api
from petstore_api.model import user
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.
@@ -474,9 +488,9 @@ configuration = petstore_api.Configuration(
# 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 = petstore_api.FakeApi(api_client)
api_instance = fake_api.FakeApi(api_client)
query = 'query_example' # str |
body = petstore_api.User() # user.User |
body = user.User() # user.User |
# example passing only required values which don't have defaults set
try:
@@ -525,6 +539,8 @@ To test \"client\" model
from __future__ import print_function
import time
import petstore_api
from petstore_api.api import fake_api
from petstore_api.model import client
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.
@@ -536,8 +552,8 @@ configuration = petstore_api.Configuration(
# 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 = petstore_api.FakeApi(api_client)
body = petstore_api.Client() # client.Client | client model
api_instance = fake_api.FakeApi(api_client)
body = client.Client() # client.Client | client model
# example passing only required values which don't have defaults set
try:
@@ -587,6 +603,7 @@ This route has required values with enums of 1
from __future__ import print_function
import time
import petstore_api
from petstore_api.api import fake_api
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.
@@ -598,7 +615,7 @@ configuration = petstore_api.Configuration(
# 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 = petstore_api.FakeApi(api_client)
api_instance = fake_api.FakeApi(api_client)
# example passing only required values which don't have defaults set
try:
@@ -651,6 +668,7 @@ Fake endpoint for testing various parameters 假端點 偽のエンドポイ
from __future__ import print_function
import time
import petstore_api
from petstore_api.api import fake_api
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.
@@ -672,7 +690,7 @@ configuration = petstore_api.Configuration(
# Enter a context with an instance of the API client
with petstore_api.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = petstore_api.FakeApi(api_client)
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
@@ -757,6 +775,7 @@ To test enum parameters
from __future__ import print_function
import time
import petstore_api
from petstore_api.api import fake_api
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.
@@ -768,7 +787,7 @@ configuration = petstore_api.Configuration(
# 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 = petstore_api.FakeApi(api_client)
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)
@@ -834,6 +853,7 @@ Fake endpoint to test group parameters (optional)
from __future__ import print_function
import time
import petstore_api
from petstore_api.api import fake_api
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.
@@ -845,7 +865,7 @@ configuration = petstore_api.Configuration(
# 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 = petstore_api.FakeApi(api_client)
api_instance = fake_api.FakeApi(api_client)
required_string_group = 56 # 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
@@ -911,6 +931,7 @@ test inline additionalProperties
from __future__ import print_function
import time
import petstore_api
from petstore_api.api import fake_api
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.
@@ -922,7 +943,7 @@ configuration = petstore_api.Configuration(
# 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 = petstore_api.FakeApi(api_client)
api_instance = fake_api.FakeApi(api_client)
param = {'key': 'param_example'} # {str: (str,)} | request body
# example passing only required values which don't have defaults set
@@ -970,6 +991,7 @@ test json serialization of form data
from __future__ import print_function
import time
import petstore_api
from petstore_api.api import fake_api
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.
@@ -981,7 +1003,7 @@ configuration = petstore_api.Configuration(
# 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 = petstore_api.FakeApi(api_client)
api_instance = fake_api.FakeApi(api_client)
param = 'param_example' # str | field1
param2 = 'param2_example' # str | field2

View File

@@ -21,6 +21,8 @@ To test class name in snake case
from __future__ import print_function
import time
import petstore_api
from petstore_api.api import fake_classname_tags_123_api
from petstore_api.model import client
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.
@@ -46,8 +48,8 @@ configuration = petstore_api.Configuration(
# Enter a context with an instance of the API client
with petstore_api.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = petstore_api.FakeClassnameTags123Api(api_client)
body = petstore_api.Client() # client.Client | client model
api_instance = fake_classname_tags_123_api.FakeClassnameTags123Api(api_client)
body = client.Client() # client.Client | client model
# example passing only required values which don't have defaults set
try:

View File

@@ -27,6 +27,8 @@ Add a new pet to the store
from __future__ import print_function
import time
import petstore_api
from petstore_api.api import pet_api
from petstore_api.model import pet
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.
@@ -48,8 +50,8 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN'
# Enter a context with an instance of the API client
with petstore_api.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = petstore_api.PetApi(api_client)
body = petstore_api.Pet() # pet.Pet | Pet object that needs to be added to the store
api_instance = pet_api.PetApi(api_client)
body = pet.Pet() # pet.Pet | Pet object that needs to be added to the store
# example passing only required values which don't have defaults set
try:
@@ -98,6 +100,7 @@ Deletes a pet
from __future__ import print_function
import time
import petstore_api
from petstore_api.api import pet_api
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.
@@ -119,7 +122,7 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN'
# Enter a context with an instance of the API client
with petstore_api.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = petstore_api.PetApi(api_client)
api_instance = pet_api.PetApi(api_client)
pet_id = 56 # int | Pet id to delete
api_key = 'api_key_example' # str | (optional)
@@ -181,6 +184,8 @@ Multiple status values can be provided with comma separated strings
from __future__ import print_function
import time
import petstore_api
from petstore_api.api import pet_api
from petstore_api.model import pet
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.
@@ -202,7 +207,7 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN'
# Enter a context with an instance of the API client
with petstore_api.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = petstore_api.PetApi(api_client)
api_instance = pet_api.PetApi(api_client)
status = ['status_example'] # [str] | Status values that need to be considered for filter
# example passing only required values which don't have defaults set
@@ -255,6 +260,8 @@ Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3
from __future__ import print_function
import time
import petstore_api
from petstore_api.api import pet_api
from petstore_api.model import pet
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.
@@ -276,7 +283,7 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN'
# Enter a context with an instance of the API client
with petstore_api.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = petstore_api.PetApi(api_client)
api_instance = pet_api.PetApi(api_client)
tags = ['tags_example'] # [str] | Tags to filter by
# example passing only required values which don't have defaults set
@@ -329,6 +336,8 @@ Returns a single pet
from __future__ import print_function
import time
import petstore_api
from petstore_api.api import pet_api
from petstore_api.model import pet
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.
@@ -354,7 +363,7 @@ configuration = petstore_api.Configuration(
# Enter a context with an instance of the API client
with petstore_api.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = petstore_api.PetApi(api_client)
api_instance = pet_api.PetApi(api_client)
pet_id = 56 # int | ID of pet to return
# example passing only required values which don't have defaults set
@@ -406,6 +415,8 @@ Update an existing pet
from __future__ import print_function
import time
import petstore_api
from petstore_api.api import pet_api
from petstore_api.model import pet
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.
@@ -427,8 +438,8 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN'
# Enter a context with an instance of the API client
with petstore_api.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = petstore_api.PetApi(api_client)
body = petstore_api.Pet() # pet.Pet | Pet object that needs to be added to the store
api_instance = pet_api.PetApi(api_client)
body = pet.Pet() # pet.Pet | Pet object that needs to be added to the store
# example passing only required values which don't have defaults set
try:
@@ -479,6 +490,7 @@ Updates a pet in the store with form data
from __future__ import print_function
import time
import petstore_api
from petstore_api.api import pet_api
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.
@@ -500,7 +512,7 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN'
# Enter a context with an instance of the API client
with petstore_api.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = petstore_api.PetApi(api_client)
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)
@@ -561,6 +573,8 @@ uploads an image
from __future__ import print_function
import time
import petstore_api
from petstore_api.api import pet_api
from petstore_api.model import api_response
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.
@@ -582,7 +596,7 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN'
# Enter a context with an instance of the API client
with petstore_api.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = petstore_api.PetApi(api_client)
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)
@@ -647,6 +661,8 @@ uploads an image (required)
from __future__ import print_function
import time
import petstore_api
from petstore_api.api import pet_api
from petstore_api.model import api_response
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.
@@ -668,7 +684,7 @@ configuration.access_token = 'YOUR_ACCESS_TOKEN'
# Enter a context with an instance of the API client
with petstore_api.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = petstore_api.PetApi(api_client)
api_instance = pet_api.PetApi(api_client)
pet_id = 56 # 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)

View File

@@ -23,6 +23,7 @@ For valid response try integer IDs with value < 1000. Anything above 1000 or non
from __future__ import print_function
import time
import petstore_api
from petstore_api.api import store_api
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.
@@ -34,7 +35,7 @@ configuration = petstore_api.Configuration(
# 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 = petstore_api.StoreApi(api_client)
api_instance = store_api.StoreApi(api_client)
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
@@ -86,6 +87,7 @@ Returns a map of status codes to quantities
from __future__ import print_function
import time
import petstore_api
from petstore_api.api import store_api
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.
@@ -111,7 +113,7 @@ configuration = petstore_api.Configuration(
# Enter a context with an instance of the API client
with petstore_api.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = petstore_api.StoreApi(api_client)
api_instance = store_api.StoreApi(api_client)
# example, this endpoint has no required or optional parameters
try:
@@ -158,6 +160,8 @@ For valid response try integer IDs with value <= 5 or > 10. Other values will ge
from __future__ import print_function
import time
import petstore_api
from petstore_api.api import store_api
from petstore_api.model import order
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.
@@ -169,7 +173,7 @@ configuration = petstore_api.Configuration(
# 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 = petstore_api.StoreApi(api_client)
api_instance = store_api.StoreApi(api_client)
order_id = 56 # int | ID of pet that needs to be fetched
# example passing only required values which don't have defaults set
@@ -220,6 +224,8 @@ Place an order for a pet
from __future__ import print_function
import time
import petstore_api
from petstore_api.api import store_api
from petstore_api.model import order
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.
@@ -231,8 +237,8 @@ configuration = petstore_api.Configuration(
# 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 = petstore_api.StoreApi(api_client)
body = petstore_api.Order() # order.Order | order placed for purchasing the pet
api_instance = store_api.StoreApi(api_client)
body = order.Order() # order.Order | order placed for purchasing the pet
# example passing only required values which don't have defaults set
try:

View File

@@ -27,6 +27,8 @@ This can only be done by the logged in user.
from __future__ import print_function
import time
import petstore_api
from petstore_api.api import user_api
from petstore_api.model import user
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.
@@ -38,8 +40,8 @@ configuration = petstore_api.Configuration(
# 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 = petstore_api.UserApi(api_client)
body = petstore_api.User() # user.User | Created user object
api_instance = user_api.UserApi(api_client)
body = user.User() # user.User | Created user object
# example passing only required values which don't have defaults set
try:
@@ -86,6 +88,8 @@ Creates list of users with given input array
from __future__ import print_function
import time
import petstore_api
from petstore_api.api import user_api
from petstore_api.model import user
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.
@@ -97,8 +101,8 @@ configuration = petstore_api.Configuration(
# 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 = petstore_api.UserApi(api_client)
body = [petstore_api.User()] # [user.User] | List of user object
api_instance = user_api.UserApi(api_client)
body = [user.User()] # [user.User] | List of user object
# example passing only required values which don't have defaults set
try:
@@ -145,6 +149,8 @@ Creates list of users with given input array
from __future__ import print_function
import time
import petstore_api
from petstore_api.api import user_api
from petstore_api.model import user
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.
@@ -156,8 +162,8 @@ configuration = petstore_api.Configuration(
# 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 = petstore_api.UserApi(api_client)
body = [petstore_api.User()] # [user.User] | List of user object
api_instance = user_api.UserApi(api_client)
body = [user.User()] # [user.User] | List of user object
# example passing only required values which don't have defaults set
try:
@@ -206,6 +212,7 @@ This can only be done by the logged in user.
from __future__ import print_function
import time
import petstore_api
from petstore_api.api import user_api
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.
@@ -217,7 +224,7 @@ configuration = petstore_api.Configuration(
# 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 = petstore_api.UserApi(api_client)
api_instance = user_api.UserApi(api_client)
username = 'username_example' # str | The name that needs to be deleted
# example passing only required values which don't have defaults set
@@ -266,6 +273,8 @@ Get user by user name
from __future__ import print_function
import time
import petstore_api
from petstore_api.api import user_api
from petstore_api.model import user
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.
@@ -277,7 +286,7 @@ configuration = petstore_api.Configuration(
# 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 = petstore_api.UserApi(api_client)
api_instance = user_api.UserApi(api_client)
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
@@ -328,6 +337,7 @@ Logs user into the system
from __future__ import print_function
import time
import petstore_api
from petstore_api.api import user_api
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.
@@ -339,7 +349,7 @@ configuration = petstore_api.Configuration(
# 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 = petstore_api.UserApi(api_client)
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
@@ -391,6 +401,7 @@ Logs out current logged in user session
from __future__ import print_function
import time
import petstore_api
from petstore_api.api import user_api
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.
@@ -402,7 +413,7 @@ configuration = petstore_api.Configuration(
# 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 = petstore_api.UserApi(api_client)
api_instance = user_api.UserApi(api_client)
# example, this endpoint has no required or optional parameters
try:
@@ -448,6 +459,8 @@ This can only be done by the logged in user.
from __future__ import print_function
import time
import petstore_api
from petstore_api.api import user_api
from petstore_api.model import user
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.
@@ -459,9 +472,9 @@ configuration = petstore_api.Configuration(
# 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 = petstore_api.UserApi(api_client)
api_instance = user_api.UserApi(api_client)
username = 'username_example' # str | name that need to be deleted
body = petstore_api.User() # user.User | Updated user object
body = user.User() # user.User | Updated user object
# example passing only required values which don't have defaults set
try:

View File

@@ -16,14 +16,6 @@ from __future__ import absolute_import
__version__ = "1.0.0"
# import apis into sdk package
from petstore_api.api.another_fake_api import AnotherFakeApi
from petstore_api.api.fake_api import FakeApi
from petstore_api.api.fake_classname_tags_123_api import FakeClassnameTags123Api
from petstore_api.api.pet_api import PetApi
from petstore_api.api.store_api import StoreApi
from petstore_api.api.user_api import UserApi
# import ApiClient
from petstore_api.api_client import ApiClient
@@ -32,71 +24,8 @@ from petstore_api.configuration import Configuration
# import exceptions
from petstore_api.exceptions import OpenApiException
from petstore_api.exceptions import ApiAttributeError
from petstore_api.exceptions import ApiTypeError
from petstore_api.exceptions import ApiValueError
from petstore_api.exceptions import ApiKeyError
from petstore_api.exceptions import ApiException
# import models into sdk package
from petstore_api.models.additional_properties_any_type import AdditionalPropertiesAnyType
from petstore_api.models.additional_properties_array import AdditionalPropertiesArray
from petstore_api.models.additional_properties_boolean import AdditionalPropertiesBoolean
from petstore_api.models.additional_properties_class import AdditionalPropertiesClass
from petstore_api.models.additional_properties_integer import AdditionalPropertiesInteger
from petstore_api.models.additional_properties_number import AdditionalPropertiesNumber
from petstore_api.models.additional_properties_object import AdditionalPropertiesObject
from petstore_api.models.additional_properties_string import AdditionalPropertiesString
from petstore_api.models.animal import Animal
from petstore_api.models.api_response import ApiResponse
from petstore_api.models.array_of_array_of_number_only import ArrayOfArrayOfNumberOnly
from petstore_api.models.array_of_number_only import ArrayOfNumberOnly
from petstore_api.models.array_test import ArrayTest
from petstore_api.models.capitalization import Capitalization
from petstore_api.models.cat import Cat
from petstore_api.models.cat_all_of import CatAllOf
from petstore_api.models.category import Category
from petstore_api.models.child import Child
from petstore_api.models.child_all_of import ChildAllOf
from petstore_api.models.child_cat import ChildCat
from petstore_api.models.child_cat_all_of import ChildCatAllOf
from petstore_api.models.child_dog import ChildDog
from petstore_api.models.child_dog_all_of import ChildDogAllOf
from petstore_api.models.child_lizard import ChildLizard
from petstore_api.models.child_lizard_all_of import ChildLizardAllOf
from petstore_api.models.class_model import ClassModel
from petstore_api.models.client import Client
from petstore_api.models.dog import Dog
from petstore_api.models.dog_all_of import DogAllOf
from petstore_api.models.enum_arrays import EnumArrays
from petstore_api.models.enum_class import EnumClass
from petstore_api.models.enum_test import EnumTest
from petstore_api.models.file import File
from petstore_api.models.file_schema_test_class import FileSchemaTestClass
from petstore_api.models.format_test import FormatTest
from petstore_api.models.grandparent import Grandparent
from petstore_api.models.grandparent_animal import GrandparentAnimal
from petstore_api.models.has_only_read_only import HasOnlyReadOnly
from petstore_api.models.list import List
from petstore_api.models.map_test import MapTest
from petstore_api.models.mixed_properties_and_additional_properties_class import MixedPropertiesAndAdditionalPropertiesClass
from petstore_api.models.model200_response import Model200Response
from petstore_api.models.model_return import ModelReturn
from petstore_api.models.name import Name
from petstore_api.models.number_only import NumberOnly
from petstore_api.models.order import Order
from petstore_api.models.outer_composite import OuterComposite
from petstore_api.models.outer_enum import OuterEnum
from petstore_api.models.outer_number import OuterNumber
from petstore_api.models.parent import Parent
from petstore_api.models.parent_all_of import ParentAllOf
from petstore_api.models.parent_pet import ParentPet
from petstore_api.models.pet import Pet
from petstore_api.models.player import Player
from petstore_api.models.read_only_first import ReadOnlyFirst
from petstore_api.models.special_model_name import SpecialModelName
from petstore_api.models.string_boolean_map import StringBooleanMap
from petstore_api.models.tag import Tag
from petstore_api.models.type_holder_default import TypeHolderDefault
from petstore_api.models.type_holder_example import TypeHolderExample
from petstore_api.models.user import User
from petstore_api.models.xml_item import XmlItem

View File

@@ -34,7 +34,7 @@ from petstore_api.model_utils import ( # noqa: F401
str,
validate_and_convert_types
)
from petstore_api.models import client
from petstore_api.model import client
class AnotherFakeApi(object):

View File

@@ -34,13 +34,13 @@ from petstore_api.model_utils import ( # noqa: F401
str,
validate_and_convert_types
)
from petstore_api.models import xml_item
from petstore_api.models import outer_composite
from petstore_api.models import outer_enum
from petstore_api.models import outer_number
from petstore_api.models import file_schema_test_class
from petstore_api.models import user
from petstore_api.models import client
from petstore_api.model import xml_item
from petstore_api.model import outer_composite
from petstore_api.model import outer_enum
from petstore_api.model import outer_number
from petstore_api.model import file_schema_test_class
from petstore_api.model import user
from petstore_api.model import client
class FakeApi(object):

View File

@@ -34,7 +34,7 @@ from petstore_api.model_utils import ( # noqa: F401
str,
validate_and_convert_types
)
from petstore_api.models import client
from petstore_api.model import client
class FakeClassnameTags123Api(object):

View File

@@ -34,8 +34,8 @@ from petstore_api.model_utils import ( # noqa: F401
str,
validate_and_convert_types
)
from petstore_api.models import pet
from petstore_api.models import api_response
from petstore_api.model import pet
from petstore_api.model import api_response
class PetApi(object):

View File

@@ -34,7 +34,7 @@ from petstore_api.model_utils import ( # noqa: F401
str,
validate_and_convert_types
)
from petstore_api.models import order
from petstore_api.model import order
class StoreApi(object):

View File

@@ -34,7 +34,7 @@ from petstore_api.model_utils import ( # noqa: F401
str,
validate_and_convert_types
)
from petstore_api.models import user
from petstore_api.model import user
class UserApi(object):

View File

@@ -0,0 +1,20 @@
# coding: utf-8
# flake8: noqa
# import all apis into this package
# if you have many ampis here with many many models used in each api this may
# raise a RecursionError
# to avoid this, import only the api that you directly need like:
# from .api.pet_api import PetApi
# or import this package, but before doing it, use:
# import sys
# sys.setrecursionlimit(n)
# import apis into api package
from petstore_api.api.another_fake_api import AnotherFakeApi
from petstore_api.api.fake_api import FakeApi
from petstore_api.api.fake_classname_tags_123_api import FakeClassnameTags123Api
from petstore_api.api.pet_api import PetApi
from petstore_api.api.store_api import StoreApi
from petstore_api.api.user_api import UserApi

View File

@@ -0,0 +1,5 @@
# we can not import model classes here because that would create a circular
# reference which would not work in python2
# do not import all models into this module because that uses a lot of memory and stack frames
# if you need the ability to import all models from one package, import them with
# from {{packageName}.models import ModelA, ModelB

View File

@@ -34,15 +34,15 @@ from petstore_api.model_utils import ( # noqa: F401
validate_get_composed_info,
)
try:
from petstore_api.models import cat
from petstore_api.model import cat
except ImportError:
cat = sys.modules[
'petstore_api.models.cat']
'petstore_api.model.cat']
try:
from petstore_api.models import dog
from petstore_api.model import dog
except ImportError:
dog = sys.modules[
'petstore_api.models.dog']
'petstore_api.model.dog']
class Animal(ModelNormal):

View File

@@ -34,10 +34,10 @@ from petstore_api.model_utils import ( # noqa: F401
validate_get_composed_info,
)
try:
from petstore_api.models import read_only_first
from petstore_api.model import read_only_first
except ImportError:
read_only_first = sys.modules[
'petstore_api.models.read_only_first']
'petstore_api.model.read_only_first']
class ArrayTest(ModelNormal):

View File

@@ -34,15 +34,15 @@ from petstore_api.model_utils import ( # noqa: F401
validate_get_composed_info,
)
try:
from petstore_api.models import animal
from petstore_api.model import animal
except ImportError:
animal = sys.modules[
'petstore_api.models.animal']
'petstore_api.model.animal']
try:
from petstore_api.models import cat_all_of
from petstore_api.model import cat_all_of
except ImportError:
cat_all_of = sys.modules[
'petstore_api.models.cat_all_of']
'petstore_api.model.cat_all_of']
class Cat(ModelComposed):

View File

@@ -34,15 +34,15 @@ from petstore_api.model_utils import ( # noqa: F401
validate_get_composed_info,
)
try:
from petstore_api.models import child_all_of
from petstore_api.model import child_all_of
except ImportError:
child_all_of = sys.modules[
'petstore_api.models.child_all_of']
'petstore_api.model.child_all_of']
try:
from petstore_api.models import parent
from petstore_api.model import parent
except ImportError:
parent = sys.modules[
'petstore_api.models.parent']
'petstore_api.model.parent']
class Child(ModelComposed):

View File

@@ -34,15 +34,15 @@ from petstore_api.model_utils import ( # noqa: F401
validate_get_composed_info,
)
try:
from petstore_api.models import child_cat_all_of
from petstore_api.model import child_cat_all_of
except ImportError:
child_cat_all_of = sys.modules[
'petstore_api.models.child_cat_all_of']
'petstore_api.model.child_cat_all_of']
try:
from petstore_api.models import parent_pet
from petstore_api.model import parent_pet
except ImportError:
parent_pet = sys.modules[
'petstore_api.models.parent_pet']
'petstore_api.model.parent_pet']
class ChildCat(ModelComposed):

View File

@@ -34,15 +34,15 @@ from petstore_api.model_utils import ( # noqa: F401
validate_get_composed_info,
)
try:
from petstore_api.models import child_dog_all_of
from petstore_api.model import child_dog_all_of
except ImportError:
child_dog_all_of = sys.modules[
'petstore_api.models.child_dog_all_of']
'petstore_api.model.child_dog_all_of']
try:
from petstore_api.models import parent_pet
from petstore_api.model import parent_pet
except ImportError:
parent_pet = sys.modules[
'petstore_api.models.parent_pet']
'petstore_api.model.parent_pet']
class ChildDog(ModelComposed):

View File

@@ -34,15 +34,15 @@ from petstore_api.model_utils import ( # noqa: F401
validate_get_composed_info,
)
try:
from petstore_api.models import child_lizard_all_of
from petstore_api.model import child_lizard_all_of
except ImportError:
child_lizard_all_of = sys.modules[
'petstore_api.models.child_lizard_all_of']
'petstore_api.model.child_lizard_all_of']
try:
from petstore_api.models import parent_pet
from petstore_api.model import parent_pet
except ImportError:
parent_pet = sys.modules[
'petstore_api.models.parent_pet']
'petstore_api.model.parent_pet']
class ChildLizard(ModelComposed):

View File

@@ -34,15 +34,15 @@ from petstore_api.model_utils import ( # noqa: F401
validate_get_composed_info,
)
try:
from petstore_api.models import animal
from petstore_api.model import animal
except ImportError:
animal = sys.modules[
'petstore_api.models.animal']
'petstore_api.model.animal']
try:
from petstore_api.models import dog_all_of
from petstore_api.model import dog_all_of
except ImportError:
dog_all_of = sys.modules[
'petstore_api.models.dog_all_of']
'petstore_api.model.dog_all_of']
class Dog(ModelComposed):

View File

@@ -34,10 +34,10 @@ from petstore_api.model_utils import ( # noqa: F401
validate_get_composed_info,
)
try:
from petstore_api.models import outer_enum
from petstore_api.model import outer_enum
except ImportError:
outer_enum = sys.modules[
'petstore_api.models.outer_enum']
'petstore_api.model.outer_enum']
class EnumTest(ModelNormal):

View File

@@ -34,10 +34,10 @@ from petstore_api.model_utils import ( # noqa: F401
validate_get_composed_info,
)
try:
from petstore_api.models import file
from petstore_api.model import file
except ImportError:
file = sys.modules[
'petstore_api.models.file']
'petstore_api.model.file']
class FileSchemaTestClass(ModelNormal):

View File

@@ -34,25 +34,25 @@ from petstore_api.model_utils import ( # noqa: F401
validate_get_composed_info,
)
try:
from petstore_api.models import child_cat
from petstore_api.model import child_cat
except ImportError:
child_cat = sys.modules[
'petstore_api.models.child_cat']
'petstore_api.model.child_cat']
try:
from petstore_api.models import child_dog
from petstore_api.model import child_dog
except ImportError:
child_dog = sys.modules[
'petstore_api.models.child_dog']
'petstore_api.model.child_dog']
try:
from petstore_api.models import child_lizard
from petstore_api.model import child_lizard
except ImportError:
child_lizard = sys.modules[
'petstore_api.models.child_lizard']
'petstore_api.model.child_lizard']
try:
from petstore_api.models import parent_pet
from petstore_api.model import parent_pet
except ImportError:
parent_pet = sys.modules[
'petstore_api.models.parent_pet']
'petstore_api.model.parent_pet']
class GrandparentAnimal(ModelNormal):

View File

@@ -34,10 +34,10 @@ from petstore_api.model_utils import ( # noqa: F401
validate_get_composed_info,
)
try:
from petstore_api.models import string_boolean_map
from petstore_api.model import string_boolean_map
except ImportError:
string_boolean_map = sys.modules[
'petstore_api.models.string_boolean_map']
'petstore_api.model.string_boolean_map']
class MapTest(ModelNormal):

View File

@@ -34,10 +34,10 @@ from petstore_api.model_utils import ( # noqa: F401
validate_get_composed_info,
)
try:
from petstore_api.models import animal
from petstore_api.model import animal
except ImportError:
animal = sys.modules[
'petstore_api.models.animal']
'petstore_api.model.animal']
class MixedPropertiesAndAdditionalPropertiesClass(ModelNormal):

View File

@@ -34,10 +34,10 @@ from petstore_api.model_utils import ( # noqa: F401
validate_get_composed_info,
)
try:
from petstore_api.models import outer_number
from petstore_api.model import outer_number
except ImportError:
outer_number = sys.modules[
'petstore_api.models.outer_number']
'petstore_api.model.outer_number']
class OuterComposite(ModelNormal):

View File

@@ -34,15 +34,15 @@ from petstore_api.model_utils import ( # noqa: F401
validate_get_composed_info,
)
try:
from petstore_api.models import grandparent
from petstore_api.model import grandparent
except ImportError:
grandparent = sys.modules[
'petstore_api.models.grandparent']
'petstore_api.model.grandparent']
try:
from petstore_api.models import parent_all_of
from petstore_api.model import parent_all_of
except ImportError:
parent_all_of = sys.modules[
'petstore_api.models.parent_all_of']
'petstore_api.model.parent_all_of']
class Parent(ModelComposed):

View File

@@ -34,25 +34,25 @@ from petstore_api.model_utils import ( # noqa: F401
validate_get_composed_info,
)
try:
from petstore_api.models import child_cat
from petstore_api.model import child_cat
except ImportError:
child_cat = sys.modules[
'petstore_api.models.child_cat']
'petstore_api.model.child_cat']
try:
from petstore_api.models import child_dog
from petstore_api.model import child_dog
except ImportError:
child_dog = sys.modules[
'petstore_api.models.child_dog']
'petstore_api.model.child_dog']
try:
from petstore_api.models import child_lizard
from petstore_api.model import child_lizard
except ImportError:
child_lizard = sys.modules[
'petstore_api.models.child_lizard']
'petstore_api.model.child_lizard']
try:
from petstore_api.models import grandparent_animal
from petstore_api.model import grandparent_animal
except ImportError:
grandparent_animal = sys.modules[
'petstore_api.models.grandparent_animal']
'petstore_api.model.grandparent_animal']
class ParentPet(ModelComposed):

View File

@@ -34,15 +34,15 @@ from petstore_api.model_utils import ( # noqa: F401
validate_get_composed_info,
)
try:
from petstore_api.models import category
from petstore_api.model import category
except ImportError:
category = sys.modules[
'petstore_api.models.category']
'petstore_api.model.category']
try:
from petstore_api.models import tag
from petstore_api.model import tag
except ImportError:
tag = sys.modules[
'petstore_api.models.tag']
'petstore_api.model.tag']
class Pet(ModelNormal):

View File

@@ -1,15 +1,75 @@
# coding: utf-8
# flake8: noqa
"""
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
# import all models into this package
# if you have many models here with many references from one model to another this may
# raise a RecursionError
# to avoid this, import only the models that you directly need like:
# from from petstore_api.model.pet import Pet
# or import this package, but before doing it, use:
# import sys
# sys.setrecursionlimit(n)
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
"""
# we can not import model classes here because that would create a circular
# reference which would not work in python2
from petstore_api.model.additional_properties_any_type import AdditionalPropertiesAnyType
from petstore_api.model.additional_properties_array import AdditionalPropertiesArray
from petstore_api.model.additional_properties_boolean import AdditionalPropertiesBoolean
from petstore_api.model.additional_properties_class import AdditionalPropertiesClass
from petstore_api.model.additional_properties_integer import AdditionalPropertiesInteger
from petstore_api.model.additional_properties_number import AdditionalPropertiesNumber
from petstore_api.model.additional_properties_object import AdditionalPropertiesObject
from petstore_api.model.additional_properties_string import AdditionalPropertiesString
from petstore_api.model.animal import Animal
from petstore_api.model.api_response import ApiResponse
from petstore_api.model.array_of_array_of_number_only import ArrayOfArrayOfNumberOnly
from petstore_api.model.array_of_number_only import ArrayOfNumberOnly
from petstore_api.model.array_test import ArrayTest
from petstore_api.model.capitalization import Capitalization
from petstore_api.model.cat import Cat
from petstore_api.model.cat_all_of import CatAllOf
from petstore_api.model.category import Category
from petstore_api.model.child import Child
from petstore_api.model.child_all_of import ChildAllOf
from petstore_api.model.child_cat import ChildCat
from petstore_api.model.child_cat_all_of import ChildCatAllOf
from petstore_api.model.child_dog import ChildDog
from petstore_api.model.child_dog_all_of import ChildDogAllOf
from petstore_api.model.child_lizard import ChildLizard
from petstore_api.model.child_lizard_all_of import ChildLizardAllOf
from petstore_api.model.class_model import ClassModel
from petstore_api.model.client import Client
from petstore_api.model.dog import Dog
from petstore_api.model.dog_all_of import DogAllOf
from petstore_api.model.enum_arrays import EnumArrays
from petstore_api.model.enum_class import EnumClass
from petstore_api.model.enum_test import EnumTest
from petstore_api.model.file import File
from petstore_api.model.file_schema_test_class import FileSchemaTestClass
from petstore_api.model.format_test import FormatTest
from petstore_api.model.grandparent import Grandparent
from petstore_api.model.grandparent_animal import GrandparentAnimal
from petstore_api.model.has_only_read_only import HasOnlyReadOnly
from petstore_api.model.list import List
from petstore_api.model.map_test import MapTest
from petstore_api.model.mixed_properties_and_additional_properties_class import MixedPropertiesAndAdditionalPropertiesClass
from petstore_api.model.model200_response import Model200Response
from petstore_api.model.model_return import ModelReturn
from petstore_api.model.name import Name
from petstore_api.model.number_only import NumberOnly
from petstore_api.model.order import Order
from petstore_api.model.outer_composite import OuterComposite
from petstore_api.model.outer_enum import OuterEnum
from petstore_api.model.outer_number import OuterNumber
from petstore_api.model.parent import Parent
from petstore_api.model.parent_all_of import ParentAllOf
from petstore_api.model.parent_pet import ParentPet
from petstore_api.model.pet import Pet
from petstore_api.model.player import Player
from petstore_api.model.read_only_first import ReadOnlyFirst
from petstore_api.model.special_model_name import SpecialModelName
from petstore_api.model.string_boolean_map import StringBooleanMap
from petstore_api.model.tag import Tag
from petstore_api.model.type_holder_default import TypeHolderDefault
from petstore_api.model.type_holder_example import TypeHolderExample
from petstore_api.model.user import User
from petstore_api.model.xml_item import XmlItem

View File

@@ -5,18 +5,17 @@
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
OpenAPI spec version: 1.0.0
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_import
import sys
import unittest
import petstore_api
from petstore_api.models.additional_properties_any_type import AdditionalPropertiesAnyType # noqa: E501
from petstore_api.rest import ApiException
from petstore_api.model.additional_properties_any_type import AdditionalPropertiesAnyType
class TestAdditionalPropertiesAnyType(unittest.TestCase):
@@ -31,7 +30,7 @@ class TestAdditionalPropertiesAnyType(unittest.TestCase):
def testAdditionalPropertiesAnyType(self):
"""Test AdditionalPropertiesAnyType"""
# FIXME: construct object with mandatory attributes with example values
# model = petstore_api.models.additional_properties_any_type.AdditionalPropertiesAnyType() # noqa: E501
# model = AdditionalPropertiesAnyType() # noqa: E501
pass

View File

@@ -5,21 +5,17 @@
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
OpenAPI spec version: 1.0.0
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_import
import sys
import unittest
import petstore_api
from petstore_api.models.additional_properties_array import AdditionalPropertiesArray # noqa: E501
from petstore_api.rest import ApiException
from petstore_api.exceptions import ApiTypeError
import datetime
from petstore_api.model.additional_properties_array import AdditionalPropertiesArray
class TestAdditionalPropertiesArray(unittest.TestCase):
@@ -37,6 +33,7 @@ class TestAdditionalPropertiesArray(unittest.TestCase):
model = AdditionalPropertiesArray()
# can make one with additional properties
import datetime
some_val = []
model = AdditionalPropertiesArray(some_key=some_val)
assert model['some_key'] == some_val
@@ -45,7 +42,7 @@ class TestAdditionalPropertiesArray(unittest.TestCase):
assert model['some_key'] == some_val
# type checking works on additional properties
with self.assertRaises(ApiTypeError) as exc:
with self.assertRaises(petstore_api.ApiTypeError) as exc:
model = AdditionalPropertiesArray(some_key='some string')

View File

@@ -5,19 +5,17 @@
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
OpenAPI spec version: 1.0.0
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_import
import sys
import unittest
import petstore_api
from petstore_api.models.additional_properties_boolean import AdditionalPropertiesBoolean # noqa: E501
from petstore_api.rest import ApiException
from petstore_api.exceptions import ApiTypeError
from petstore_api.model.additional_properties_boolean import AdditionalPropertiesBoolean
class TestAdditionalPropertiesBoolean(unittest.TestCase):
@@ -39,7 +37,7 @@ class TestAdditionalPropertiesBoolean(unittest.TestCase):
assert model['some_key'] == True
# type checking works on additional properties
with self.assertRaises(ApiTypeError) as exc:
with self.assertRaises(petstore_api.ApiTypeError) as exc:
model = AdditionalPropertiesBoolean(some_key='True')

View File

@@ -5,18 +5,17 @@
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
OpenAPI spec version: 1.0.0
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_import
import sys
import unittest
import petstore_api
from petstore_api.models.additional_properties_class import AdditionalPropertiesClass # noqa: E501
from petstore_api.rest import ApiException
from petstore_api.model.additional_properties_class import AdditionalPropertiesClass
class TestAdditionalPropertiesClass(unittest.TestCase):
@@ -31,7 +30,7 @@ class TestAdditionalPropertiesClass(unittest.TestCase):
def testAdditionalPropertiesClass(self):
"""Test AdditionalPropertiesClass"""
# FIXME: construct object with mandatory attributes with example values
# model = petstore_api.models.additional_properties_class.AdditionalPropertiesClass() # noqa: E501
# model = AdditionalPropertiesClass() # noqa: E501
pass

View File

@@ -5,19 +5,17 @@
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
OpenAPI spec version: 1.0.0
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_import
import sys
import unittest
import petstore_api
from petstore_api.models.additional_properties_integer import AdditionalPropertiesInteger # noqa: E501
from petstore_api.rest import ApiException
from petstore_api.exceptions import ApiTypeError
from petstore_api.model.additional_properties_integer import AdditionalPropertiesInteger
class TestAdditionalPropertiesInteger(unittest.TestCase):
@@ -39,7 +37,7 @@ class TestAdditionalPropertiesInteger(unittest.TestCase):
assert model['some_key'] == 3
# type checking works on additional properties
with self.assertRaises(ApiTypeError) as exc:
with self.assertRaises(petstore_api.ApiTypeError) as exc:
model = AdditionalPropertiesInteger(some_key=11.3)

View File

@@ -5,19 +5,17 @@
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
OpenAPI spec version: 1.0.0
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_import
import sys
import unittest
import petstore_api
from petstore_api.models.additional_properties_number import AdditionalPropertiesNumber # noqa: E501
from petstore_api.rest import ApiException
from petstore_api.exceptions import ApiTypeError
from petstore_api.model.additional_properties_number import AdditionalPropertiesNumber
class TestAdditionalPropertiesNumber(unittest.TestCase):
@@ -39,8 +37,9 @@ class TestAdditionalPropertiesNumber(unittest.TestCase):
assert model['some_key'] == 11.3
# type checking works on additional properties
with self.assertRaises(ApiTypeError) as exc:
with self.assertRaises(petstore_api.ApiTypeError) as exc:
model = AdditionalPropertiesNumber(some_key=10)
if __name__ == '__main__':
unittest.main()

View File

@@ -5,21 +5,17 @@
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
OpenAPI spec version: 1.0.0
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_import
import sys
import unittest
import petstore_api
from petstore_api.models.additional_properties_object import AdditionalPropertiesObject # noqa: E501
from petstore_api.rest import ApiException
from petstore_api.exceptions import ApiTypeError
import datetime
from petstore_api.model.additional_properties_object import AdditionalPropertiesObject
class TestAdditionalPropertiesObject(unittest.TestCase):
@@ -40,12 +36,13 @@ class TestAdditionalPropertiesObject(unittest.TestCase):
some_val = {}
model = AdditionalPropertiesObject(some_key=some_val)
assert model['some_key'] == some_val
import datetime
some_val = {'a': True, 'b': datetime.date(1970,1,1), 'c': datetime.datetime(1970,1,1), 'd': {}, 'e': 3.1, 'f': 1, 'g': [], 'h': 'hello'}
model = AdditionalPropertiesObject(some_key=some_val)
assert model['some_key'] == some_val
# type checking works on additional properties
with self.assertRaises(ApiTypeError) as exc:
with self.assertRaises(petstore_api.ApiTypeError) as exc:
model = AdditionalPropertiesObject(some_key='some string')

View File

@@ -5,19 +5,17 @@
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
OpenAPI spec version: 1.0.0
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_import
import sys
import unittest
import petstore_api
from petstore_api.models.additional_properties_string import AdditionalPropertiesString # noqa: E501
from petstore_api.rest import ApiException
from petstore_api.exceptions import ApiTypeError
from petstore_api.model.additional_properties_string import AdditionalPropertiesString
class TestAdditionalPropertiesString(unittest.TestCase):
@@ -39,7 +37,7 @@ class TestAdditionalPropertiesString(unittest.TestCase):
assert model['some_key'] == 'some_val'
# type checking works on additional properties
with self.assertRaises(ApiTypeError) as exc:
with self.assertRaises(petstore_api.ApiTypeError) as exc:
model = AdditionalPropertiesString(some_key=True)

View File

@@ -5,18 +5,27 @@
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
OpenAPI spec version: 1.0.0
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_import
import sys
import unittest
import petstore_api
from petstore_api.models.animal import Animal # noqa: E501
from petstore_api.rest import ApiException
try:
from petstore_api.model import cat
except ImportError:
cat = sys.modules[
'petstore_api.model.cat']
try:
from petstore_api.model import dog
except ImportError:
dog = sys.modules[
'petstore_api.model.dog']
from petstore_api.model.animal import Animal
class TestAnimal(unittest.TestCase):
@@ -31,7 +40,7 @@ class TestAnimal(unittest.TestCase):
def testAnimal(self):
"""Test Animal"""
# FIXME: construct object with mandatory attributes with example values
# model = petstore_api.models.animal.Animal() # noqa: E501
# model = Animal() # noqa: E501
pass

View File

@@ -5,7 +5,7 @@
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501
OpenAPI spec version: 1.0.0
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
"""
@@ -16,20 +16,19 @@ import unittest
import petstore_api
from petstore_api.api.another_fake_api import AnotherFakeApi # noqa: E501
from petstore_api.rest import ApiException
class TestAnotherFakeApi(unittest.TestCase):
"""AnotherFakeApi unit test stubs"""
def setUp(self):
self.api = petstore_api.api.another_fake_api.AnotherFakeApi() # noqa: E501
self.api = AnotherFakeApi() # noqa: E501
def tearDown(self):
pass
def test_test_special_tags(self):
"""Test case for test_special_tags
def test_call_123_test_special_tags(self):
"""Test case for call_123_test_special_tags
To test special tags # noqa: E501
"""

Some files were not shown because too many files have changed in this diff Show More