forked from loafle/openapi-generator-original
remove self-reference import (#1758)
This commit is contained in:
@@ -616,4 +616,18 @@ public class CodegenModel {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove self reference import
|
||||
*/
|
||||
public void removeSelfReferenceImport() {
|
||||
for (CodegenProperty cp : allVars) {
|
||||
// detect self import
|
||||
if (cp.dataType.equalsIgnoreCase(this.classname) ||
|
||||
(cp.isContainer && cp.items.dataType.equalsIgnoreCase(this.classname))) {
|
||||
this.imports.remove(this.classname); // remove self import
|
||||
cp.isSelfReference = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -280,8 +280,8 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
CodegenModel cm = (CodegenModel) mo.get("model");
|
||||
for (CodegenProperty cp : cm.allVars) {
|
||||
// detect self import
|
||||
if (cp.dataType.equals(cm.classname) ||
|
||||
(cp.isContainer && cp.items.dataType.equals(cm.classname))) {
|
||||
if (cp.dataType.equalsIgnoreCase(cm.classname) ||
|
||||
(cp.isContainer && cp.items.dataType.equalsIgnoreCase(cm.classname))) {
|
||||
cm.imports.remove(cm.classname); // remove self import
|
||||
cp.isSelfReference = true;
|
||||
}
|
||||
|
||||
@@ -474,6 +474,7 @@ public class DefaultGenerator extends AbstractGenerator implements Generator {
|
||||
continue;
|
||||
}
|
||||
|
||||
// TODO revise below as we've already performed unaliasing so that the isAlias check may be removed
|
||||
Map<String, Object> modelTemplate = (Map<String, Object>) ((List<Object>) models.get("models")).get(0);
|
||||
// Special handling of aliases only applies to Java
|
||||
if (modelTemplate != null && modelTemplate.containsKey("model")) {
|
||||
@@ -1136,6 +1137,8 @@ public class DefaultGenerator extends AbstractGenerator implements Generator {
|
||||
mo.put("importPath", config.toModelImport(cm.classname));
|
||||
models.add(mo);
|
||||
|
||||
cm.removeSelfReferenceImport();
|
||||
|
||||
allImports.addAll(cm.imports);
|
||||
}
|
||||
objs.put("models", models);
|
||||
|
||||
@@ -8,6 +8,9 @@ from typing import List, Dict # noqa: F401
|
||||
from {{modelPackage}}.base_model_ import Model
|
||||
from {{packageName}} import util
|
||||
|
||||
{{#imports}}
|
||||
{{{import}}} # noqa: E501
|
||||
{{/imports}}
|
||||
|
||||
{{#models}}
|
||||
{{#model}}
|
||||
|
||||
@@ -1 +1 @@
|
||||
3.3.2-SNAPSHOT
|
||||
4.0.0-SNAPSHOT
|
||||
+8
-8
@@ -6,18 +6,18 @@ from openapi_server.models.pet import Pet # noqa: E501
|
||||
from openapi_server import util
|
||||
|
||||
|
||||
def add_pet(pet): # noqa: E501
|
||||
def add_pet(body): # noqa: E501
|
||||
"""Add a new pet to the store
|
||||
|
||||
# noqa: E501
|
||||
|
||||
:param pet: Pet object that needs to be added to the store
|
||||
:type pet: dict | bytes
|
||||
:param body: Pet object that needs to be added to the store
|
||||
:type body: dict | bytes
|
||||
|
||||
:rtype: None
|
||||
"""
|
||||
if connexion.request.is_json:
|
||||
pet = Pet.from_dict(connexion.request.get_json()) # noqa: E501
|
||||
body = Pet.from_dict(connexion.request.get_json()) # noqa: E501
|
||||
return 'do some magic!'
|
||||
|
||||
|
||||
@@ -75,18 +75,18 @@ def get_pet_by_id(pet_id): # noqa: E501
|
||||
return 'do some magic!'
|
||||
|
||||
|
||||
def update_pet(pet): # noqa: E501
|
||||
def update_pet(body): # noqa: E501
|
||||
"""Update an existing pet
|
||||
|
||||
# noqa: E501
|
||||
|
||||
:param pet: Pet object that needs to be added to the store
|
||||
:type pet: dict | bytes
|
||||
:param body: Pet object that needs to be added to the store
|
||||
:type body: dict | bytes
|
||||
|
||||
:rtype: None
|
||||
"""
|
||||
if connexion.request.is_json:
|
||||
pet = Pet.from_dict(connexion.request.get_json()) # noqa: E501
|
||||
body = Pet.from_dict(connexion.request.get_json()) # noqa: E501
|
||||
return 'do some magic!'
|
||||
|
||||
|
||||
|
||||
+4
-4
@@ -42,16 +42,16 @@ def get_order_by_id(order_id): # noqa: E501
|
||||
return 'do some magic!'
|
||||
|
||||
|
||||
def place_order(order): # noqa: E501
|
||||
def place_order(body): # noqa: E501
|
||||
"""Place an order for a pet
|
||||
|
||||
# noqa: E501
|
||||
|
||||
:param order: order placed for purchasing the pet
|
||||
:type order: dict | bytes
|
||||
:param body: order placed for purchasing the pet
|
||||
:type body: dict | bytes
|
||||
|
||||
:rtype: Order
|
||||
"""
|
||||
if connexion.request.is_json:
|
||||
order = Order.from_dict(connexion.request.get_json()) # noqa: E501
|
||||
body = Order.from_dict(connexion.request.get_json()) # noqa: E501
|
||||
return 'do some magic!'
|
||||
|
||||
+16
-16
@@ -5,48 +5,48 @@ from openapi_server.models.user import User # noqa: E501
|
||||
from openapi_server import util
|
||||
|
||||
|
||||
def create_user(user): # noqa: E501
|
||||
def create_user(body): # noqa: E501
|
||||
"""Create user
|
||||
|
||||
This can only be done by the logged in user. # noqa: E501
|
||||
|
||||
:param user: Created user object
|
||||
:type user: dict | bytes
|
||||
:param body: Created user object
|
||||
:type body: dict | bytes
|
||||
|
||||
:rtype: None
|
||||
"""
|
||||
if connexion.request.is_json:
|
||||
user = User.from_dict(connexion.request.get_json()) # noqa: E501
|
||||
body = User.from_dict(connexion.request.get_json()) # noqa: E501
|
||||
return 'do some magic!'
|
||||
|
||||
|
||||
def create_users_with_array_input(user): # noqa: E501
|
||||
def create_users_with_array_input(body): # noqa: E501
|
||||
"""Creates list of users with given input array
|
||||
|
||||
# noqa: E501
|
||||
|
||||
:param user: List of user object
|
||||
:type user: list | bytes
|
||||
:param body: List of user object
|
||||
:type body: list | bytes
|
||||
|
||||
:rtype: None
|
||||
"""
|
||||
if connexion.request.is_json:
|
||||
user = [User.from_dict(d) for d in connexion.request.get_json()] # noqa: E501
|
||||
body = [User.from_dict(d) for d in connexion.request.get_json()] # noqa: E501
|
||||
return 'do some magic!'
|
||||
|
||||
|
||||
def create_users_with_list_input(user): # noqa: E501
|
||||
def create_users_with_list_input(body): # noqa: E501
|
||||
"""Creates list of users with given input array
|
||||
|
||||
# noqa: E501
|
||||
|
||||
:param user: List of user object
|
||||
:type user: list | bytes
|
||||
:param body: List of user object
|
||||
:type body: list | bytes
|
||||
|
||||
:rtype: None
|
||||
"""
|
||||
if connexion.request.is_json:
|
||||
user = [User.from_dict(d) for d in connexion.request.get_json()] # noqa: E501
|
||||
body = [User.from_dict(d) for d in connexion.request.get_json()] # noqa: E501
|
||||
return 'do some magic!'
|
||||
|
||||
|
||||
@@ -102,18 +102,18 @@ def logout_user(): # noqa: E501
|
||||
return 'do some magic!'
|
||||
|
||||
|
||||
def update_user(username, user): # noqa: E501
|
||||
def update_user(username, body): # noqa: E501
|
||||
"""Updated user
|
||||
|
||||
This can only be done by the logged in user. # noqa: E501
|
||||
|
||||
:param username: name that need to be deleted
|
||||
:type username: str
|
||||
:param user: Updated user object
|
||||
:type user: dict | bytes
|
||||
:param body: Updated user object
|
||||
:type body: dict | bytes
|
||||
|
||||
:rtype: None
|
||||
"""
|
||||
if connexion.request.is_json:
|
||||
user = User.from_dict(connexion.request.get_json()) # noqa: E501
|
||||
body = User.from_dict(connexion.request.get_json()) # noqa: E501
|
||||
return 'do some magic!'
|
||||
|
||||
+3
-3
@@ -26,9 +26,9 @@ class ApiResponse(Model):
|
||||
:type message: str
|
||||
"""
|
||||
self.openapi_types = {
|
||||
'code': 'int',
|
||||
'type': 'str',
|
||||
'message': 'str'
|
||||
'code': int,
|
||||
'type': str,
|
||||
'message': str
|
||||
}
|
||||
|
||||
self.attribute_map = {
|
||||
|
||||
@@ -24,8 +24,8 @@ class Category(Model):
|
||||
:type name: str
|
||||
"""
|
||||
self.openapi_types = {
|
||||
'id': 'long',
|
||||
'name': 'str'
|
||||
'id': long,
|
||||
'name': str
|
||||
}
|
||||
|
||||
self.attribute_map = {
|
||||
|
||||
@@ -32,12 +32,12 @@ class Order(Model):
|
||||
:type complete: bool
|
||||
"""
|
||||
self.openapi_types = {
|
||||
'id': 'long',
|
||||
'pet_id': 'long',
|
||||
'quantity': 'int',
|
||||
'ship_date': 'datetime',
|
||||
'status': 'str',
|
||||
'complete': 'bool'
|
||||
'id': long,
|
||||
'pet_id': long,
|
||||
'quantity': int,
|
||||
'ship_date': datetime,
|
||||
'status': str,
|
||||
'complete': bool
|
||||
}
|
||||
|
||||
self.attribute_map = {
|
||||
|
||||
@@ -8,6 +8,8 @@ from typing import List, Dict # noqa: F401
|
||||
from openapi_server.models.base_model_ import Model
|
||||
from openapi_server import util
|
||||
|
||||
from openapi_server.models.category import Category # noqa: E501
|
||||
from openapi_server.models.tag import Tag # noqa: E501
|
||||
|
||||
class Pet(Model):
|
||||
"""NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
@@ -32,12 +34,12 @@ class Pet(Model):
|
||||
:type status: str
|
||||
"""
|
||||
self.openapi_types = {
|
||||
'id': 'long',
|
||||
'category': 'Category',
|
||||
'name': 'str',
|
||||
'photo_urls': 'List[str]',
|
||||
'tags': 'List[Tag]',
|
||||
'status': 'str'
|
||||
'id': long,
|
||||
'category': Category,
|
||||
'name': str,
|
||||
'photo_urls': List[str],
|
||||
'tags': List[Tag],
|
||||
'status': str
|
||||
}
|
||||
|
||||
self.attribute_map = {
|
||||
|
||||
@@ -24,8 +24,8 @@ class Tag(Model):
|
||||
:type name: str
|
||||
"""
|
||||
self.openapi_types = {
|
||||
'id': 'long',
|
||||
'name': 'str'
|
||||
'id': long,
|
||||
'name': str
|
||||
}
|
||||
|
||||
self.attribute_map = {
|
||||
|
||||
@@ -36,14 +36,14 @@ class User(Model):
|
||||
:type user_status: int
|
||||
"""
|
||||
self.openapi_types = {
|
||||
'id': 'long',
|
||||
'username': 'str',
|
||||
'first_name': 'str',
|
||||
'last_name': 'str',
|
||||
'email': 'str',
|
||||
'password': 'str',
|
||||
'phone': 'str',
|
||||
'user_status': 'int'
|
||||
'id': long,
|
||||
'username': str,
|
||||
'first_name': str,
|
||||
'last_name': str,
|
||||
'email': str,
|
||||
'password': str,
|
||||
'phone': str,
|
||||
'user_status': int
|
||||
}
|
||||
|
||||
self.attribute_map = {
|
||||
|
||||
@@ -40,6 +40,7 @@ paths:
|
||||
summary: Add a new pet to the store
|
||||
tags:
|
||||
- pet
|
||||
x-codegen-request-body-name: body
|
||||
x-openapi-router-controller: openapi_server.controllers.pet_controller
|
||||
put:
|
||||
operationId: update_pet
|
||||
@@ -70,6 +71,7 @@ paths:
|
||||
summary: Update an existing pet
|
||||
tags:
|
||||
- pet
|
||||
x-codegen-request-body-name: body
|
||||
x-openapi-router-controller: openapi_server.controllers.pet_controller
|
||||
/pet/findByStatus:
|
||||
get:
|
||||
@@ -334,6 +336,7 @@ paths:
|
||||
summary: Place an order for a pet
|
||||
tags:
|
||||
- store
|
||||
x-codegen-request-body-name: body
|
||||
x-openapi-router-controller: openapi_server.controllers.store_controller
|
||||
/store/order/{orderId}:
|
||||
delete:
|
||||
@@ -408,6 +411,7 @@ paths:
|
||||
summary: Create user
|
||||
tags:
|
||||
- user
|
||||
x-codegen-request-body-name: body
|
||||
x-openapi-router-controller: openapi_server.controllers.user_controller
|
||||
/user/createWithArray:
|
||||
post:
|
||||
@@ -428,6 +432,7 @@ paths:
|
||||
summary: Creates list of users with given input array
|
||||
tags:
|
||||
- user
|
||||
x-codegen-request-body-name: body
|
||||
x-openapi-router-controller: openapi_server.controllers.user_controller
|
||||
/user/createWithList:
|
||||
post:
|
||||
@@ -448,6 +453,7 @@ paths:
|
||||
summary: Creates list of users with given input array
|
||||
tags:
|
||||
- user
|
||||
x-codegen-request-body-name: body
|
||||
x-openapi-router-controller: openapi_server.controllers.user_controller
|
||||
/user/login:
|
||||
get:
|
||||
@@ -582,6 +588,7 @@ paths:
|
||||
summary: Updated user
|
||||
tags:
|
||||
- user
|
||||
x-codegen-request-body-name: body
|
||||
x-openapi-router-controller: openapi_server.controllers.user_controller
|
||||
components:
|
||||
schemas:
|
||||
|
||||
+4
-4
@@ -18,11 +18,11 @@ class TestPetController(BaseTestCase):
|
||||
|
||||
Add a new pet to the store
|
||||
"""
|
||||
pet = Pet()
|
||||
body = Pet()
|
||||
response = self.client.open(
|
||||
'/v2/pet',
|
||||
method='POST',
|
||||
data=json.dumps(pet),
|
||||
data=json.dumps(body),
|
||||
content_type='application/json')
|
||||
self.assert200(response,
|
||||
'Response body is : ' + response.data.decode('utf-8'))
|
||||
@@ -82,11 +82,11 @@ class TestPetController(BaseTestCase):
|
||||
|
||||
Update an existing pet
|
||||
"""
|
||||
pet = Pet()
|
||||
body = Pet()
|
||||
response = self.client.open(
|
||||
'/v2/pet',
|
||||
method='PUT',
|
||||
data=json.dumps(pet),
|
||||
data=json.dumps(body),
|
||||
content_type='application/json')
|
||||
self.assert200(response,
|
||||
'Response body is : ' + response.data.decode('utf-8'))
|
||||
|
||||
+2
-2
@@ -50,11 +50,11 @@ class TestStoreController(BaseTestCase):
|
||||
|
||||
Place an order for a pet
|
||||
"""
|
||||
order = Order()
|
||||
body = Order()
|
||||
response = self.client.open(
|
||||
'/v2/store/order',
|
||||
method='POST',
|
||||
data=json.dumps(order),
|
||||
data=json.dumps(body),
|
||||
content_type='application/json')
|
||||
self.assert200(response,
|
||||
'Response body is : ' + response.data.decode('utf-8'))
|
||||
|
||||
+8
-8
@@ -17,11 +17,11 @@ class TestUserController(BaseTestCase):
|
||||
|
||||
Create user
|
||||
"""
|
||||
user = User()
|
||||
body = User()
|
||||
response = self.client.open(
|
||||
'/v2/user',
|
||||
method='POST',
|
||||
data=json.dumps(user),
|
||||
data=json.dumps(body),
|
||||
content_type='application/json')
|
||||
self.assert200(response,
|
||||
'Response body is : ' + response.data.decode('utf-8'))
|
||||
@@ -31,11 +31,11 @@ class TestUserController(BaseTestCase):
|
||||
|
||||
Creates list of users with given input array
|
||||
"""
|
||||
user = None
|
||||
body = None
|
||||
response = self.client.open(
|
||||
'/v2/user/createWithArray',
|
||||
method='POST',
|
||||
data=json.dumps(user),
|
||||
data=json.dumps(body),
|
||||
content_type='application/json')
|
||||
self.assert200(response,
|
||||
'Response body is : ' + response.data.decode('utf-8'))
|
||||
@@ -45,11 +45,11 @@ class TestUserController(BaseTestCase):
|
||||
|
||||
Creates list of users with given input array
|
||||
"""
|
||||
user = None
|
||||
body = None
|
||||
response = self.client.open(
|
||||
'/v2/user/createWithList',
|
||||
method='POST',
|
||||
data=json.dumps(user),
|
||||
data=json.dumps(body),
|
||||
content_type='application/json')
|
||||
self.assert200(response,
|
||||
'Response body is : ' + response.data.decode('utf-8'))
|
||||
@@ -106,11 +106,11 @@ class TestUserController(BaseTestCase):
|
||||
|
||||
Updated user
|
||||
"""
|
||||
user = User()
|
||||
body = User()
|
||||
response = self.client.open(
|
||||
'/v2/user/{username}'.format(username='username_example'),
|
||||
method='PUT',
|
||||
data=json.dumps(user),
|
||||
data=json.dumps(body),
|
||||
content_type='application/json')
|
||||
self.assert200(response,
|
||||
'Response body is : ' + response.data.decode('utf-8'))
|
||||
|
||||
@@ -1 +1 @@
|
||||
3.3.2-SNAPSHOT
|
||||
4.0.0-SNAPSHOT
|
||||
@@ -6,18 +6,18 @@ from openapi_server.models.pet import Pet # noqa: E501
|
||||
from openapi_server import util
|
||||
|
||||
|
||||
def add_pet(pet): # noqa: E501
|
||||
def add_pet(body): # noqa: E501
|
||||
"""Add a new pet to the store
|
||||
|
||||
# noqa: E501
|
||||
|
||||
:param pet: Pet object that needs to be added to the store
|
||||
:type pet: dict | bytes
|
||||
:param body: Pet object that needs to be added to the store
|
||||
:type body: dict | bytes
|
||||
|
||||
:rtype: None
|
||||
"""
|
||||
if connexion.request.is_json:
|
||||
pet = Pet.from_dict(connexion.request.get_json()) # noqa: E501
|
||||
body = Pet.from_dict(connexion.request.get_json()) # noqa: E501
|
||||
return 'do some magic!'
|
||||
|
||||
|
||||
@@ -75,18 +75,18 @@ def get_pet_by_id(pet_id): # noqa: E501
|
||||
return 'do some magic!'
|
||||
|
||||
|
||||
def update_pet(pet): # noqa: E501
|
||||
def update_pet(body): # noqa: E501
|
||||
"""Update an existing pet
|
||||
|
||||
# noqa: E501
|
||||
|
||||
:param pet: Pet object that needs to be added to the store
|
||||
:type pet: dict | bytes
|
||||
:param body: Pet object that needs to be added to the store
|
||||
:type body: dict | bytes
|
||||
|
||||
:rtype: None
|
||||
"""
|
||||
if connexion.request.is_json:
|
||||
pet = Pet.from_dict(connexion.request.get_json()) # noqa: E501
|
||||
body = Pet.from_dict(connexion.request.get_json()) # noqa: E501
|
||||
return 'do some magic!'
|
||||
|
||||
|
||||
|
||||
+4
-4
@@ -42,16 +42,16 @@ def get_order_by_id(order_id): # noqa: E501
|
||||
return 'do some magic!'
|
||||
|
||||
|
||||
def place_order(order): # noqa: E501
|
||||
def place_order(body): # noqa: E501
|
||||
"""Place an order for a pet
|
||||
|
||||
# noqa: E501
|
||||
|
||||
:param order: order placed for purchasing the pet
|
||||
:type order: dict | bytes
|
||||
:param body: order placed for purchasing the pet
|
||||
:type body: dict | bytes
|
||||
|
||||
:rtype: Order
|
||||
"""
|
||||
if connexion.request.is_json:
|
||||
order = Order.from_dict(connexion.request.get_json()) # noqa: E501
|
||||
body = Order.from_dict(connexion.request.get_json()) # noqa: E501
|
||||
return 'do some magic!'
|
||||
|
||||
+16
-16
@@ -5,48 +5,48 @@ from openapi_server.models.user import User # noqa: E501
|
||||
from openapi_server import util
|
||||
|
||||
|
||||
def create_user(user): # noqa: E501
|
||||
def create_user(body): # noqa: E501
|
||||
"""Create user
|
||||
|
||||
This can only be done by the logged in user. # noqa: E501
|
||||
|
||||
:param user: Created user object
|
||||
:type user: dict | bytes
|
||||
:param body: Created user object
|
||||
:type body: dict | bytes
|
||||
|
||||
:rtype: None
|
||||
"""
|
||||
if connexion.request.is_json:
|
||||
user = User.from_dict(connexion.request.get_json()) # noqa: E501
|
||||
body = User.from_dict(connexion.request.get_json()) # noqa: E501
|
||||
return 'do some magic!'
|
||||
|
||||
|
||||
def create_users_with_array_input(user): # noqa: E501
|
||||
def create_users_with_array_input(body): # noqa: E501
|
||||
"""Creates list of users with given input array
|
||||
|
||||
# noqa: E501
|
||||
|
||||
:param user: List of user object
|
||||
:type user: list | bytes
|
||||
:param body: List of user object
|
||||
:type body: list | bytes
|
||||
|
||||
:rtype: None
|
||||
"""
|
||||
if connexion.request.is_json:
|
||||
user = [User.from_dict(d) for d in connexion.request.get_json()] # noqa: E501
|
||||
body = [User.from_dict(d) for d in connexion.request.get_json()] # noqa: E501
|
||||
return 'do some magic!'
|
||||
|
||||
|
||||
def create_users_with_list_input(user): # noqa: E501
|
||||
def create_users_with_list_input(body): # noqa: E501
|
||||
"""Creates list of users with given input array
|
||||
|
||||
# noqa: E501
|
||||
|
||||
:param user: List of user object
|
||||
:type user: list | bytes
|
||||
:param body: List of user object
|
||||
:type body: list | bytes
|
||||
|
||||
:rtype: None
|
||||
"""
|
||||
if connexion.request.is_json:
|
||||
user = [User.from_dict(d) for d in connexion.request.get_json()] # noqa: E501
|
||||
body = [User.from_dict(d) for d in connexion.request.get_json()] # noqa: E501
|
||||
return 'do some magic!'
|
||||
|
||||
|
||||
@@ -102,18 +102,18 @@ def logout_user(): # noqa: E501
|
||||
return 'do some magic!'
|
||||
|
||||
|
||||
def update_user(username, user): # noqa: E501
|
||||
def update_user(username, body): # noqa: E501
|
||||
"""Updated user
|
||||
|
||||
This can only be done by the logged in user. # noqa: E501
|
||||
|
||||
:param username: name that need to be deleted
|
||||
:type username: str
|
||||
:param user: Updated user object
|
||||
:type user: dict | bytes
|
||||
:param body: Updated user object
|
||||
:type body: dict | bytes
|
||||
|
||||
:rtype: None
|
||||
"""
|
||||
if connexion.request.is_json:
|
||||
user = User.from_dict(connexion.request.get_json()) # noqa: E501
|
||||
body = User.from_dict(connexion.request.get_json()) # noqa: E501
|
||||
return 'do some magic!'
|
||||
|
||||
@@ -26,9 +26,9 @@ class ApiResponse(Model):
|
||||
:type message: str
|
||||
"""
|
||||
self.openapi_types = {
|
||||
'code': 'int',
|
||||
'type': 'str',
|
||||
'message': 'str'
|
||||
'code': int,
|
||||
'type': str,
|
||||
'message': str
|
||||
}
|
||||
|
||||
self.attribute_map = {
|
||||
|
||||
@@ -24,8 +24,8 @@ class Category(Model):
|
||||
:type name: str
|
||||
"""
|
||||
self.openapi_types = {
|
||||
'id': 'int',
|
||||
'name': 'str'
|
||||
'id': int,
|
||||
'name': str
|
||||
}
|
||||
|
||||
self.attribute_map = {
|
||||
|
||||
@@ -32,12 +32,12 @@ class Order(Model):
|
||||
:type complete: bool
|
||||
"""
|
||||
self.openapi_types = {
|
||||
'id': 'int',
|
||||
'pet_id': 'int',
|
||||
'quantity': 'int',
|
||||
'ship_date': 'datetime',
|
||||
'status': 'str',
|
||||
'complete': 'bool'
|
||||
'id': int,
|
||||
'pet_id': int,
|
||||
'quantity': int,
|
||||
'ship_date': datetime,
|
||||
'status': str,
|
||||
'complete': bool
|
||||
}
|
||||
|
||||
self.attribute_map = {
|
||||
|
||||
@@ -8,6 +8,8 @@ from typing import List, Dict # noqa: F401
|
||||
from openapi_server.models.base_model_ import Model
|
||||
from openapi_server import util
|
||||
|
||||
from openapi_server.models.category import Category # noqa: E501
|
||||
from openapi_server.models.tag import Tag # noqa: E501
|
||||
|
||||
class Pet(Model):
|
||||
"""NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
@@ -32,12 +34,12 @@ class Pet(Model):
|
||||
:type status: str
|
||||
"""
|
||||
self.openapi_types = {
|
||||
'id': 'int',
|
||||
'category': 'Category',
|
||||
'name': 'str',
|
||||
'photo_urls': 'List[str]',
|
||||
'tags': 'List[Tag]',
|
||||
'status': 'str'
|
||||
'id': int,
|
||||
'category': Category,
|
||||
'name': str,
|
||||
'photo_urls': List[str],
|
||||
'tags': List[Tag],
|
||||
'status': str
|
||||
}
|
||||
|
||||
self.attribute_map = {
|
||||
|
||||
@@ -24,8 +24,8 @@ class Tag(Model):
|
||||
:type name: str
|
||||
"""
|
||||
self.openapi_types = {
|
||||
'id': 'int',
|
||||
'name': 'str'
|
||||
'id': int,
|
||||
'name': str
|
||||
}
|
||||
|
||||
self.attribute_map = {
|
||||
|
||||
@@ -36,14 +36,14 @@ class User(Model):
|
||||
:type user_status: int
|
||||
"""
|
||||
self.openapi_types = {
|
||||
'id': 'int',
|
||||
'username': 'str',
|
||||
'first_name': 'str',
|
||||
'last_name': 'str',
|
||||
'email': 'str',
|
||||
'password': 'str',
|
||||
'phone': 'str',
|
||||
'user_status': 'int'
|
||||
'id': int,
|
||||
'username': str,
|
||||
'first_name': str,
|
||||
'last_name': str,
|
||||
'email': str,
|
||||
'password': str,
|
||||
'phone': str,
|
||||
'user_status': int
|
||||
}
|
||||
|
||||
self.attribute_map = {
|
||||
|
||||
@@ -40,6 +40,7 @@ paths:
|
||||
summary: Add a new pet to the store
|
||||
tags:
|
||||
- pet
|
||||
x-codegen-request-body-name: body
|
||||
x-openapi-router-controller: openapi_server.controllers.pet_controller
|
||||
put:
|
||||
operationId: update_pet
|
||||
@@ -70,6 +71,7 @@ paths:
|
||||
summary: Update an existing pet
|
||||
tags:
|
||||
- pet
|
||||
x-codegen-request-body-name: body
|
||||
x-openapi-router-controller: openapi_server.controllers.pet_controller
|
||||
/pet/findByStatus:
|
||||
get:
|
||||
@@ -334,6 +336,7 @@ paths:
|
||||
summary: Place an order for a pet
|
||||
tags:
|
||||
- store
|
||||
x-codegen-request-body-name: body
|
||||
x-openapi-router-controller: openapi_server.controllers.store_controller
|
||||
/store/order/{orderId}:
|
||||
delete:
|
||||
@@ -408,6 +411,7 @@ paths:
|
||||
summary: Create user
|
||||
tags:
|
||||
- user
|
||||
x-codegen-request-body-name: body
|
||||
x-openapi-router-controller: openapi_server.controllers.user_controller
|
||||
/user/createWithArray:
|
||||
post:
|
||||
@@ -428,6 +432,7 @@ paths:
|
||||
summary: Creates list of users with given input array
|
||||
tags:
|
||||
- user
|
||||
x-codegen-request-body-name: body
|
||||
x-openapi-router-controller: openapi_server.controllers.user_controller
|
||||
/user/createWithList:
|
||||
post:
|
||||
@@ -448,6 +453,7 @@ paths:
|
||||
summary: Creates list of users with given input array
|
||||
tags:
|
||||
- user
|
||||
x-codegen-request-body-name: body
|
||||
x-openapi-router-controller: openapi_server.controllers.user_controller
|
||||
/user/login:
|
||||
get:
|
||||
@@ -582,6 +588,7 @@ paths:
|
||||
summary: Updated user
|
||||
tags:
|
||||
- user
|
||||
x-codegen-request-body-name: body
|
||||
x-openapi-router-controller: openapi_server.controllers.user_controller
|
||||
components:
|
||||
schemas:
|
||||
|
||||
@@ -18,11 +18,11 @@ class TestPetController(BaseTestCase):
|
||||
|
||||
Add a new pet to the store
|
||||
"""
|
||||
pet = Pet()
|
||||
body = Pet()
|
||||
response = self.client.open(
|
||||
'/v2/pet',
|
||||
method='POST',
|
||||
data=json.dumps(pet),
|
||||
data=json.dumps(body),
|
||||
content_type='application/json')
|
||||
self.assert200(response,
|
||||
'Response body is : ' + response.data.decode('utf-8'))
|
||||
@@ -82,11 +82,11 @@ class TestPetController(BaseTestCase):
|
||||
|
||||
Update an existing pet
|
||||
"""
|
||||
pet = Pet()
|
||||
body = Pet()
|
||||
response = self.client.open(
|
||||
'/v2/pet',
|
||||
method='PUT',
|
||||
data=json.dumps(pet),
|
||||
data=json.dumps(body),
|
||||
content_type='application/json')
|
||||
self.assert200(response,
|
||||
'Response body is : ' + response.data.decode('utf-8'))
|
||||
|
||||
@@ -50,11 +50,11 @@ class TestStoreController(BaseTestCase):
|
||||
|
||||
Place an order for a pet
|
||||
"""
|
||||
order = Order()
|
||||
body = Order()
|
||||
response = self.client.open(
|
||||
'/v2/store/order',
|
||||
method='POST',
|
||||
data=json.dumps(order),
|
||||
data=json.dumps(body),
|
||||
content_type='application/json')
|
||||
self.assert200(response,
|
||||
'Response body is : ' + response.data.decode('utf-8'))
|
||||
|
||||
@@ -17,11 +17,11 @@ class TestUserController(BaseTestCase):
|
||||
|
||||
Create user
|
||||
"""
|
||||
user = User()
|
||||
body = User()
|
||||
response = self.client.open(
|
||||
'/v2/user',
|
||||
method='POST',
|
||||
data=json.dumps(user),
|
||||
data=json.dumps(body),
|
||||
content_type='application/json')
|
||||
self.assert200(response,
|
||||
'Response body is : ' + response.data.decode('utf-8'))
|
||||
@@ -31,11 +31,11 @@ class TestUserController(BaseTestCase):
|
||||
|
||||
Creates list of users with given input array
|
||||
"""
|
||||
user = None
|
||||
body = None
|
||||
response = self.client.open(
|
||||
'/v2/user/createWithArray',
|
||||
method='POST',
|
||||
data=json.dumps(user),
|
||||
data=json.dumps(body),
|
||||
content_type='application/json')
|
||||
self.assert200(response,
|
||||
'Response body is : ' + response.data.decode('utf-8'))
|
||||
@@ -45,11 +45,11 @@ class TestUserController(BaseTestCase):
|
||||
|
||||
Creates list of users with given input array
|
||||
"""
|
||||
user = None
|
||||
body = None
|
||||
response = self.client.open(
|
||||
'/v2/user/createWithList',
|
||||
method='POST',
|
||||
data=json.dumps(user),
|
||||
data=json.dumps(body),
|
||||
content_type='application/json')
|
||||
self.assert200(response,
|
||||
'Response body is : ' + response.data.decode('utf-8'))
|
||||
@@ -106,11 +106,11 @@ class TestUserController(BaseTestCase):
|
||||
|
||||
Updated user
|
||||
"""
|
||||
user = User()
|
||||
body = User()
|
||||
response = self.client.open(
|
||||
'/v2/user/{username}'.format(username='username_example'),
|
||||
method='PUT',
|
||||
data=json.dumps(user),
|
||||
data=json.dumps(body),
|
||||
content_type='application/json')
|
||||
self.assert200(response,
|
||||
'Response body is : ' + response.data.decode('utf-8'))
|
||||
|
||||
Reference in New Issue
Block a user