fix unique items in python nextgen client (#14816)

This commit is contained in:
William Cheng 2023-02-26 10:21:26 +08:00 committed by GitHub
parent 1f2d6b8848
commit b5d4fa9d27
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
30 changed files with 111 additions and 126 deletions

View File

@ -403,23 +403,20 @@ public class PythonNextgenClientCodegen extends AbstractPythonCodegen implements
}
if (cp.isArray) {
if (cp.maxItems != null || cp.minItems != null) {
String maxOrMinItems = "";
if (cp.maxItems != null) {
maxOrMinItems += String.format(Locale.ROOT, ", max_items=%d", cp.maxItems);
}
if (cp.minItems != null) {
maxOrMinItems += String.format(Locale.ROOT, ", min_items=%d", cp.minItems);
}
pydanticImports.add("conlist");
return String.format(Locale.ROOT, "conlist(%s%s)",
getPydanticType(cp.items, typingImports, pydanticImports, datetimeImports, modelImports),
maxOrMinItems);
} else {
typingImports.add("List");
return String.format(Locale.ROOT, "List[%s]", getPydanticType(cp.items, typingImports, pydanticImports, datetimeImports, modelImports));
String constraints = "";
if (cp.maxItems != null) {
constraints += String.format(Locale.ROOT, ", max_items=%d", cp.maxItems);
}
if (cp.minItems != null) {
constraints += String.format(Locale.ROOT, ", min_items=%d", cp.minItems);
}
if (cp.getUniqueItems()) {
constraints += ", unique_items=True";
}
pydanticImports.add("conlist");
return String.format(Locale.ROOT, "conlist(%s%s)",
getPydanticType(cp.items, typingImports, pydanticImports, datetimeImports, modelImports),
constraints);
} else if (cp.isMap) {
typingImports.add("Dict");
return String.format(Locale.ROOT, "Dict[str, %s]", getPydanticType(cp.items, typingImports, pydanticImports, datetimeImports, modelImports));
@ -653,22 +650,21 @@ public class PythonNextgenClientCodegen extends AbstractPythonCodegen implements
return String.format(Locale.ROOT, "%sEnum", cp.nameInCamelCase);
} else*/
if (cp.isArray) {
if (cp.maxItems != null || cp.minItems != null) {
String maxOrMinItems = "";
if (cp.maxItems != null) {
maxOrMinItems += String.format(Locale.ROOT, ", max_items=%d", cp.maxItems);
}
if (cp.minItems != null) {
maxOrMinItems += String.format(Locale.ROOT, ", min_items=%d", cp.minItems);
}
pydanticImports.add("conlist");
return String.format(Locale.ROOT, "conlist(%s%s)",
getPydanticType(cp.items, typingImports, pydanticImports, datetimeImports, modelImports),
maxOrMinItems);
} else {
typingImports.add("List");
return String.format(Locale.ROOT, "List[%s]", getPydanticType(cp.items, typingImports, pydanticImports, datetimeImports, modelImports));
String constraints = "";
if (cp.maxItems != null) {
constraints += String.format(Locale.ROOT, ", max_items=%d", cp.maxItems);
}
if (cp.minItems != null) {
constraints += String.format(Locale.ROOT, ", min_items=%d", cp.minItems);
}
if (cp.getUniqueItems()) {
constraints += ", unique_items=True";
}
pydanticImports.add("conlist");
typingImports.add("List"); // for return type
return String.format(Locale.ROOT, "conlist(%s%s)",
getPydanticType(cp.items, typingImports, pydanticImports, datetimeImports, modelImports),
constraints);
} else if (cp.isMap) {
typingImports.add("Dict");
return String.format(Locale.ROOT, "Dict[str, %s]", getPydanticType(cp.items, typingImports, pydanticImports, datetimeImports, modelImports));
@ -884,10 +880,6 @@ public class PythonNextgenClientCodegen extends AbstractPythonCodegen implements
fields.add(String.format(Locale.ROOT, "description=\"%s\"", param.description));
}
if (param.isArray && param.getUniqueItems()) { // a set
fields.add("unique_items=True");
}
/* TODO support example
if (!StringUtils.isEmpty(cp.getExample())) { // has example
fields.add(String.format(Locale.ROOT, "example=%s", cp.getExample()));
@ -1071,10 +1063,6 @@ public class PythonNextgenClientCodegen extends AbstractPythonCodegen implements
fields.add(String.format(Locale.ROOT, "description=\"%s\"", cp.description));
}
if (cp.isArray && cp.getUniqueItems()) { // a set
fields.add("unique_items=True");
}
/* TODO review as example may break the build
if (!StringUtils.isEmpty(cp.getExample())) { // has example
fields.add(String.format(Locale.ROOT, "example=%s", cp.getExample()));

View File

@ -1417,6 +1417,7 @@ components:
type: string
example: doggie
photoUrls:
minItems: 0
type: array
xml:
name: photoUrl

View File

@ -19,7 +19,7 @@ import json
from typing import List, Optional
from pydantic import BaseModel, StrictInt, StrictStr, validator
from pydantic import BaseModel, StrictInt, StrictStr, conlist, validator
from openapi_client.models.string_enum_ref import StringEnumRef
class DefaultValue(BaseModel):
@ -28,13 +28,13 @@ class DefaultValue(BaseModel):
Do not edit the class manually.
"""
array_string_enum_ref_default: Optional[List[StringEnumRef]] = None
array_string_enum_default: Optional[List[StrictStr]] = None
array_string_default: Optional[List[StrictStr]] = None
array_integer_default: Optional[List[StrictInt]] = None
array_string: Optional[List[StrictStr]] = None
array_string_nullable: Optional[List[StrictStr]] = None
array_string_extension_nullable: Optional[List[StrictStr]] = None
array_string_enum_ref_default: Optional[conlist(StringEnumRef)] = None
array_string_enum_default: Optional[conlist(StrictStr)] = None
array_string_default: Optional[conlist(StrictStr)] = None
array_integer_default: Optional[conlist(StrictInt)] = None
array_string: Optional[conlist(StrictStr)] = None
array_string_nullable: Optional[conlist(StrictStr)] = None
array_string_extension_nullable: Optional[conlist(StrictStr)] = None
string_nullable: Optional[StrictStr] = None
__properties = ["array_string_enum_ref_default", "array_string_enum_default", "array_string_default", "array_integer_default", "array_string", "array_string_nullable", "array_string_extension_nullable", "string_nullable"]

View File

@ -19,7 +19,7 @@ import json
from typing import List, Optional
from pydantic import BaseModel, Field, StrictInt, StrictStr, validator
from pydantic import BaseModel, Field, StrictInt, StrictStr, conlist, validator
from openapi_client.models.category import Category
from openapi_client.models.tag import Tag
@ -32,8 +32,8 @@ class Pet(BaseModel):
id: Optional[StrictInt] = None
name: StrictStr = ...
category: Optional[Category] = None
photo_urls: List[StrictStr] = Field(..., alias="photoUrls")
tags: Optional[List[Tag]] = None
photo_urls: conlist(StrictStr) = Field(..., alias="photoUrls")
tags: Optional[conlist(Tag)] = None
status: Optional[StrictStr] = Field(None, description="pet status in the store")
__properties = ["id", "name", "category", "photoUrls", "tags", "status"]

View File

@ -19,7 +19,7 @@ import json
from typing import List, Optional
from pydantic import BaseModel, Field, StrictInt, StrictStr, validator
from pydantic import BaseModel, Field, StrictInt, StrictStr, conlist, validator
class Query(BaseModel):
"""NOTE: This class is auto generated by OpenAPI Generator.
@ -28,7 +28,7 @@ class Query(BaseModel):
Do not edit the class manually.
"""
id: Optional[StrictInt] = Field(None, description="Query")
outcomes: Optional[List[StrictStr]] = None
outcomes: Optional[conlist(StrictStr)] = None
__properties = ["id", "outcomes"]
@validator('outcomes')

View File

@ -19,7 +19,7 @@ import json
from typing import List, Optional
from pydantic import BaseModel, StrictStr
from pydantic import BaseModel, StrictStr, conlist
class TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter(BaseModel):
"""NOTE: This class is auto generated by OpenAPI Generator.
@ -27,7 +27,7 @@ class TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter(BaseModel):
Do not edit the class manually.
"""
values: Optional[List[StrictStr]] = None
values: Optional[conlist(StrictStr)] = None
__properties = ["values"]
class Config:

View File

@ -19,9 +19,9 @@ from typing_extensions import Annotated
from datetime import date, datetime
from pydantic import Field, StrictBool, StrictInt, StrictStr, confloat, conint, constr, validator
from pydantic import Field, StrictBool, StrictInt, StrictStr, confloat, conint, conlist, constr, validator
from typing import Dict, List, Optional
from typing import Dict, Optional
from petstore_api.models.client import Client
from petstore_api.models.file_schema_test_class import FileSchemaTestClass
@ -2522,7 +2522,7 @@ class FakeApi(object):
_request_auth=_params.get('_request_auth'))
@validate_arguments
def test_query_parameter_collection_format(self, pipe : List[StrictStr], ioutil : List[StrictStr], http : List[StrictStr], url : List[StrictStr], context : List[StrictStr], allow_empty : StrictStr, language : Optional[Dict[str, StrictStr]] = None, **kwargs) -> None: # noqa: E501
def test_query_parameter_collection_format(self, pipe : conlist(StrictStr), ioutil : conlist(StrictStr), http : conlist(StrictStr), url : conlist(StrictStr), context : conlist(StrictStr), allow_empty : StrictStr, language : Optional[Dict[str, StrictStr]] = None, **kwargs) -> None: # noqa: E501
"""test_query_parameter_collection_format # noqa: E501
To test the collection format in query parameters # noqa: E501
@ -2565,7 +2565,7 @@ class FakeApi(object):
return self.test_query_parameter_collection_format_with_http_info(pipe, ioutil, http, url, context, allow_empty, language, **kwargs) # noqa: E501
@validate_arguments
def test_query_parameter_collection_format_with_http_info(self, pipe : List[StrictStr], ioutil : List[StrictStr], http : List[StrictStr], url : List[StrictStr], context : List[StrictStr], allow_empty : StrictStr, language : Optional[Dict[str, StrictStr]] = None, **kwargs): # noqa: E501
def test_query_parameter_collection_format_with_http_info(self, pipe : conlist(StrictStr), ioutil : conlist(StrictStr), http : conlist(StrictStr), url : conlist(StrictStr), context : conlist(StrictStr), allow_empty : StrictStr, language : Optional[Dict[str, StrictStr]] = None, **kwargs): # noqa: E501
"""test_query_parameter_collection_format # noqa: E501
To test the collection format in query parameters # noqa: E501

View File

@ -17,7 +17,7 @@ import re # noqa: F401
from pydantic import validate_arguments, ValidationError
from typing_extensions import Annotated
from pydantic import Field, StrictInt, StrictStr, validator
from pydantic import Field, StrictInt, StrictStr, conlist, validator
from typing import List, Optional
@ -332,7 +332,7 @@ class PetApi(object):
_request_auth=_params.get('_request_auth'))
@validate_arguments
def find_pets_by_status(self, status : Annotated[List[StrictStr], Field(..., description="Status values that need to be considered for filter")], **kwargs) -> List[Pet]: # noqa: E501
def find_pets_by_status(self, status : Annotated[conlist(StrictStr), Field(..., description="Status values that need to be considered for filter")], **kwargs) -> List[Pet]: # noqa: E501
"""Finds Pets by status # noqa: E501
Multiple status values can be provided with comma separated strings # noqa: E501
@ -363,7 +363,7 @@ class PetApi(object):
return self.find_pets_by_status_with_http_info(status, **kwargs) # noqa: E501
@validate_arguments
def find_pets_by_status_with_http_info(self, status : Annotated[List[StrictStr], Field(..., description="Status values that need to be considered for filter")], **kwargs): # noqa: E501
def find_pets_by_status_with_http_info(self, status : Annotated[conlist(StrictStr), Field(..., description="Status values that need to be considered for filter")], **kwargs): # noqa: E501
"""Finds Pets by status # noqa: E501
Multiple status values can be provided with comma separated strings # noqa: E501
@ -477,7 +477,7 @@ class PetApi(object):
_request_auth=_params.get('_request_auth'))
@validate_arguments
def find_pets_by_tags(self, tags : Annotated[List[StrictStr], Field(..., description="Tags to filter by", unique_items=True)], **kwargs) -> List[Pet]: # noqa: E501
def find_pets_by_tags(self, tags : Annotated[conlist(StrictStr, unique_items=True), Field(..., description="Tags to filter by")], **kwargs) -> List[Pet]: # noqa: E501
"""Finds Pets by tags # noqa: E501
Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. # noqa: E501
@ -508,7 +508,7 @@ class PetApi(object):
return self.find_pets_by_tags_with_http_info(tags, **kwargs) # noqa: E501
@validate_arguments
def find_pets_by_tags_with_http_info(self, tags : Annotated[List[StrictStr], Field(..., description="Tags to filter by", unique_items=True)], **kwargs): # noqa: E501
def find_pets_by_tags_with_http_info(self, tags : Annotated[conlist(StrictStr, unique_items=True), Field(..., description="Tags to filter by")], **kwargs): # noqa: E501
"""Finds Pets by tags # noqa: E501
Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. # noqa: E501

View File

@ -17,9 +17,7 @@ import re # noqa: F401
from pydantic import validate_arguments, ValidationError
from typing_extensions import Annotated
from pydantic import Field, StrictStr
from typing import List
from pydantic import Field, StrictStr, conlist
from petstore_api.models.user import User
@ -202,7 +200,7 @@ class UserApi(object):
_request_auth=_params.get('_request_auth'))
@validate_arguments
def create_users_with_array_input(self, user : Annotated[List[User], Field(..., description="List of user object")], **kwargs) -> None: # noqa: E501
def create_users_with_array_input(self, user : Annotated[conlist(User), Field(..., description="List of user object")], **kwargs) -> None: # noqa: E501
"""Creates list of users with given input array # noqa: E501
# noqa: E501
@ -233,7 +231,7 @@ class UserApi(object):
return self.create_users_with_array_input_with_http_info(user, **kwargs) # noqa: E501
@validate_arguments
def create_users_with_array_input_with_http_info(self, user : Annotated[List[User], Field(..., description="List of user object")], **kwargs): # noqa: E501
def create_users_with_array_input_with_http_info(self, user : Annotated[conlist(User), Field(..., description="List of user object")], **kwargs): # noqa: E501
"""Creates list of users with given input array # noqa: E501
# noqa: E501
@ -346,7 +344,7 @@ class UserApi(object):
_request_auth=_params.get('_request_auth'))
@validate_arguments
def create_users_with_list_input(self, user : Annotated[List[User], Field(..., description="List of user object")], **kwargs) -> None: # noqa: E501
def create_users_with_list_input(self, user : Annotated[conlist(User), Field(..., description="List of user object")], **kwargs) -> None: # noqa: E501
"""Creates list of users with given input array # noqa: E501
# noqa: E501
@ -377,7 +375,7 @@ class UserApi(object):
return self.create_users_with_list_input_with_http_info(user, **kwargs) # noqa: E501
@validate_arguments
def create_users_with_list_input_with_http_info(self, user : Annotated[List[User], Field(..., description="List of user object")], **kwargs): # noqa: E501
def create_users_with_list_input_with_http_info(self, user : Annotated[conlist(User), Field(..., description="List of user object")], **kwargs): # noqa: E501
"""Creates list of users with given input array # noqa: E501
# noqa: E501

View File

@ -16,7 +16,7 @@ import json
import pprint
import re # noqa: F401
from typing import Optional
from typing import List, Optional
from pydantic import BaseModel, Field, StrictStr, ValidationError, conint, conlist, constr, validator
from typing import Any, List
from pydantic import StrictStr, Field

View File

@ -18,7 +18,7 @@ import json
from typing import List, Optional
from pydantic import BaseModel, Field
from pydantic import BaseModel, Field, conlist
class ArrayOfArrayOfNumberOnly(BaseModel):
"""NOTE: This class is auto generated by OpenAPI Generator.
@ -26,7 +26,7 @@ class ArrayOfArrayOfNumberOnly(BaseModel):
Do not edit the class manually.
"""
array_array_number: Optional[List[List[float]]] = Field(None, alias="ArrayArrayNumber")
array_array_number: Optional[conlist(conlist(float))] = Field(None, alias="ArrayArrayNumber")
__properties = ["ArrayArrayNumber"]
class Config:

View File

@ -18,7 +18,7 @@ import json
from typing import List, Optional
from pydantic import BaseModel, Field
from pydantic import BaseModel, Field, conlist
class ArrayOfNumberOnly(BaseModel):
"""NOTE: This class is auto generated by OpenAPI Generator.
@ -26,7 +26,7 @@ class ArrayOfNumberOnly(BaseModel):
Do not edit the class manually.
"""
array_number: Optional[List[float]] = Field(None, alias="ArrayNumber")
array_number: Optional[conlist(float)] = Field(None, alias="ArrayNumber")
__properties = ["ArrayNumber"]
class Config:

View File

@ -28,8 +28,8 @@ class ArrayTest(BaseModel):
Do not edit the class manually.
"""
array_of_string: Optional[conlist(StrictStr, max_items=3, min_items=0)] = None
array_array_of_integer: Optional[List[List[StrictInt]]] = None
array_array_of_model: Optional[List[List[ReadOnlyFirst]]] = None
array_array_of_integer: Optional[conlist(conlist(StrictInt))] = None
array_array_of_model: Optional[conlist(conlist(ReadOnlyFirst))] = None
__properties = ["array_of_string", "array_array_of_integer", "array_array_of_model"]
class Config:

View File

@ -18,7 +18,7 @@ import json
from typing import List, Optional
from pydantic import BaseModel, StrictStr, validator
from pydantic import BaseModel, StrictStr, conlist, validator
class EnumArrays(BaseModel):
"""NOTE: This class is auto generated by OpenAPI Generator.
@ -27,7 +27,7 @@ class EnumArrays(BaseModel):
Do not edit the class manually.
"""
just_symbol: Optional[StrictStr] = None
array_enum: Optional[List[StrictStr]] = None
array_enum: Optional[conlist(StrictStr)] = None
__properties = ["just_symbol", "array_enum"]
@validator('just_symbol')

View File

@ -18,7 +18,7 @@ import json
from typing import List, Optional
from pydantic import BaseModel
from pydantic import BaseModel, conlist
from petstore_api.models.file import File
class FileSchemaTestClass(BaseModel):
@ -28,7 +28,7 @@ class FileSchemaTestClass(BaseModel):
Do not edit the class manually.
"""
file: Optional[File] = None
files: Optional[List[File]] = None
files: Optional[conlist(File)] = None
__properties = ["file", "files"]
class Config:

View File

@ -18,7 +18,7 @@ import json
from datetime import date, datetime
from typing import Any, Dict, List, Optional
from pydantic import BaseModel, StrictBool, StrictInt, StrictStr
from pydantic import BaseModel, StrictBool, StrictInt, StrictStr, conlist
class NullableClass(BaseModel):
"""NOTE: This class is auto generated by OpenAPI Generator.
@ -33,9 +33,9 @@ class NullableClass(BaseModel):
string_prop: Optional[StrictStr] = None
date_prop: Optional[date] = None
datetime_prop: Optional[datetime] = None
array_nullable_prop: Optional[List[Dict[str, Any]]] = None
array_and_items_nullable_prop: Optional[List[Dict[str, Any]]] = None
array_items_nullable: Optional[List[Dict[str, Any]]] = None
array_nullable_prop: Optional[conlist(Dict[str, Any])] = None
array_and_items_nullable_prop: Optional[conlist(Dict[str, Any])] = None
array_items_nullable: Optional[conlist(Dict[str, Any])] = None
object_nullable_prop: Optional[Dict[str, Dict[str, Any]]] = None
object_and_items_nullable_prop: Optional[Dict[str, Dict[str, Any]]] = None
object_items_nullable: Optional[Dict[str, Dict[str, Any]]] = None

View File

@ -18,7 +18,7 @@ import json
from typing import List, Optional
from pydantic import BaseModel, Field, StrictStr
from pydantic import BaseModel, Field, StrictStr, conlist
from petstore_api.models.deprecated_object import DeprecatedObject
class ObjectWithDeprecatedFields(BaseModel):
@ -30,7 +30,7 @@ class ObjectWithDeprecatedFields(BaseModel):
uuid: Optional[StrictStr] = None
id: Optional[float] = None
deprecated_ref: Optional[DeprecatedObject] = Field(None, alias="deprecatedRef")
bars: Optional[List[StrictStr]] = None
bars: Optional[conlist(StrictStr)] = None
__properties = ["uuid", "id", "deprecatedRef", "bars"]
class Config:

View File

@ -18,7 +18,7 @@ import json
from typing import List, Optional
from pydantic import BaseModel, Field, StrictInt, StrictStr, validator
from pydantic import BaseModel, Field, StrictInt, StrictStr, conlist, validator
from petstore_api.models.category import Category
from petstore_api.models.tag import Tag
@ -31,8 +31,8 @@ class Pet(BaseModel):
id: Optional[StrictInt] = None
category: Optional[Category] = None
name: StrictStr = ...
photo_urls: List[StrictStr] = Field(..., alias="photoUrls", unique_items=True)
tags: Optional[List[Tag]] = None
photo_urls: conlist(StrictStr, min_items=0, unique_items=True) = Field(..., alias="photoUrls")
tags: Optional[conlist(Tag)] = None
status: Optional[StrictStr] = Field(None, description="pet status in the store")
__properties = ["id", "category", "name", "photoUrls", "tags", "status"]

View File

@ -19,9 +19,9 @@ from typing_extensions import Annotated
from datetime import date, datetime
from pydantic import Field, StrictBool, StrictFloat, StrictInt, StrictStr, confloat, conint, constr, validator
from pydantic import Field, StrictBool, StrictFloat, StrictInt, StrictStr, confloat, conint, conlist, constr, validator
from typing import Dict, List, Optional
from typing import Dict, Optional
from petstore_api.models.client import Client
from petstore_api.models.file_schema_test_class import FileSchemaTestClass
@ -2522,7 +2522,7 @@ class FakeApi(object):
_request_auth=_params.get('_request_auth'))
@validate_arguments
def test_query_parameter_collection_format(self, pipe : List[StrictStr], ioutil : List[StrictStr], http : List[StrictStr], url : List[StrictStr], context : List[StrictStr], allow_empty : StrictStr, language : Optional[Dict[str, StrictStr]] = None, **kwargs) -> None: # noqa: E501
def test_query_parameter_collection_format(self, pipe : conlist(StrictStr), ioutil : conlist(StrictStr), http : conlist(StrictStr), url : conlist(StrictStr), context : conlist(StrictStr), allow_empty : StrictStr, language : Optional[Dict[str, StrictStr]] = None, **kwargs) -> None: # noqa: E501
"""test_query_parameter_collection_format # noqa: E501
To test the collection format in query parameters # noqa: E501
@ -2565,7 +2565,7 @@ class FakeApi(object):
return self.test_query_parameter_collection_format_with_http_info(pipe, ioutil, http, url, context, allow_empty, language, **kwargs) # noqa: E501
@validate_arguments
def test_query_parameter_collection_format_with_http_info(self, pipe : List[StrictStr], ioutil : List[StrictStr], http : List[StrictStr], url : List[StrictStr], context : List[StrictStr], allow_empty : StrictStr, language : Optional[Dict[str, StrictStr]] = None, **kwargs): # noqa: E501
def test_query_parameter_collection_format_with_http_info(self, pipe : conlist(StrictStr), ioutil : conlist(StrictStr), http : conlist(StrictStr), url : conlist(StrictStr), context : conlist(StrictStr), allow_empty : StrictStr, language : Optional[Dict[str, StrictStr]] = None, **kwargs): # noqa: E501
"""test_query_parameter_collection_format # noqa: E501
To test the collection format in query parameters # noqa: E501

View File

@ -17,7 +17,7 @@ import re # noqa: F401
from pydantic import validate_arguments, ValidationError
from typing_extensions import Annotated
from pydantic import Field, StrictInt, StrictStr, validator
from pydantic import Field, StrictInt, StrictStr, conlist, validator
from typing import List, Optional
@ -332,7 +332,7 @@ class PetApi(object):
_request_auth=_params.get('_request_auth'))
@validate_arguments
def find_pets_by_status(self, status : Annotated[List[StrictStr], Field(..., description="Status values that need to be considered for filter")], **kwargs) -> List[Pet]: # noqa: E501
def find_pets_by_status(self, status : Annotated[conlist(StrictStr), Field(..., description="Status values that need to be considered for filter")], **kwargs) -> List[Pet]: # noqa: E501
"""Finds Pets by status # noqa: E501
Multiple status values can be provided with comma separated strings # noqa: E501
@ -363,7 +363,7 @@ class PetApi(object):
return self.find_pets_by_status_with_http_info(status, **kwargs) # noqa: E501
@validate_arguments
def find_pets_by_status_with_http_info(self, status : Annotated[List[StrictStr], Field(..., description="Status values that need to be considered for filter")], **kwargs): # noqa: E501
def find_pets_by_status_with_http_info(self, status : Annotated[conlist(StrictStr), Field(..., description="Status values that need to be considered for filter")], **kwargs): # noqa: E501
"""Finds Pets by status # noqa: E501
Multiple status values can be provided with comma separated strings # noqa: E501
@ -477,7 +477,7 @@ class PetApi(object):
_request_auth=_params.get('_request_auth'))
@validate_arguments
def find_pets_by_tags(self, tags : Annotated[List[StrictStr], Field(..., description="Tags to filter by", unique_items=True)], **kwargs) -> List[Pet]: # noqa: E501
def find_pets_by_tags(self, tags : Annotated[conlist(StrictStr, unique_items=True), Field(..., description="Tags to filter by")], **kwargs) -> List[Pet]: # noqa: E501
"""Finds Pets by tags # noqa: E501
Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. # noqa: E501
@ -508,7 +508,7 @@ class PetApi(object):
return self.find_pets_by_tags_with_http_info(tags, **kwargs) # noqa: E501
@validate_arguments
def find_pets_by_tags_with_http_info(self, tags : Annotated[List[StrictStr], Field(..., description="Tags to filter by", unique_items=True)], **kwargs): # noqa: E501
def find_pets_by_tags_with_http_info(self, tags : Annotated[conlist(StrictStr, unique_items=True), Field(..., description="Tags to filter by")], **kwargs): # noqa: E501
"""Finds Pets by tags # noqa: E501
Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. # noqa: E501

View File

@ -17,9 +17,7 @@ import re # noqa: F401
from pydantic import validate_arguments, ValidationError
from typing_extensions import Annotated
from pydantic import Field, StrictStr
from typing import List
from pydantic import Field, StrictStr, conlist
from petstore_api.models.user import User
@ -202,7 +200,7 @@ class UserApi(object):
_request_auth=_params.get('_request_auth'))
@validate_arguments
def create_users_with_array_input(self, user : Annotated[List[User], Field(..., description="List of user object")], **kwargs) -> None: # noqa: E501
def create_users_with_array_input(self, user : Annotated[conlist(User), Field(..., description="List of user object")], **kwargs) -> None: # noqa: E501
"""Creates list of users with given input array # noqa: E501
# noqa: E501
@ -233,7 +231,7 @@ class UserApi(object):
return self.create_users_with_array_input_with_http_info(user, **kwargs) # noqa: E501
@validate_arguments
def create_users_with_array_input_with_http_info(self, user : Annotated[List[User], Field(..., description="List of user object")], **kwargs): # noqa: E501
def create_users_with_array_input_with_http_info(self, user : Annotated[conlist(User), Field(..., description="List of user object")], **kwargs): # noqa: E501
"""Creates list of users with given input array # noqa: E501
# noqa: E501
@ -346,7 +344,7 @@ class UserApi(object):
_request_auth=_params.get('_request_auth'))
@validate_arguments
def create_users_with_list_input(self, user : Annotated[List[User], Field(..., description="List of user object")], **kwargs) -> None: # noqa: E501
def create_users_with_list_input(self, user : Annotated[conlist(User), Field(..., description="List of user object")], **kwargs) -> None: # noqa: E501
"""Creates list of users with given input array # noqa: E501
# noqa: E501
@ -377,7 +375,7 @@ class UserApi(object):
return self.create_users_with_list_input_with_http_info(user, **kwargs) # noqa: E501
@validate_arguments
def create_users_with_list_input_with_http_info(self, user : Annotated[List[User], Field(..., description="List of user object")], **kwargs): # noqa: E501
def create_users_with_list_input_with_http_info(self, user : Annotated[conlist(User), Field(..., description="List of user object")], **kwargs): # noqa: E501
"""Creates list of users with given input array # noqa: E501
# noqa: E501

View File

@ -16,7 +16,7 @@ import json
import pprint
import re # noqa: F401
from typing import Optional
from typing import List, Optional
from pydantic import BaseModel, Field, StrictStr, ValidationError, conint, conlist, constr, validator
from typing import Any, List
from pydantic import StrictStr, Field

View File

@ -18,7 +18,7 @@ import json
from typing import List, Optional
from pydantic import BaseModel, Field, StrictFloat
from pydantic import BaseModel, Field, StrictFloat, conlist
class ArrayOfArrayOfNumberOnly(BaseModel):
"""NOTE: This class is auto generated by OpenAPI Generator.
@ -26,7 +26,7 @@ class ArrayOfArrayOfNumberOnly(BaseModel):
Do not edit the class manually.
"""
array_array_number: Optional[List[List[StrictFloat]]] = Field(None, alias="ArrayArrayNumber")
array_array_number: Optional[conlist(conlist(StrictFloat))] = Field(None, alias="ArrayArrayNumber")
additional_properties: Dict[str, Any] = {}
__properties = ["ArrayArrayNumber"]

View File

@ -18,7 +18,7 @@ import json
from typing import List, Optional
from pydantic import BaseModel, Field, StrictFloat
from pydantic import BaseModel, Field, StrictFloat, conlist
class ArrayOfNumberOnly(BaseModel):
"""NOTE: This class is auto generated by OpenAPI Generator.
@ -26,7 +26,7 @@ class ArrayOfNumberOnly(BaseModel):
Do not edit the class manually.
"""
array_number: Optional[List[StrictFloat]] = Field(None, alias="ArrayNumber")
array_number: Optional[conlist(StrictFloat)] = Field(None, alias="ArrayNumber")
additional_properties: Dict[str, Any] = {}
__properties = ["ArrayNumber"]

View File

@ -28,8 +28,8 @@ class ArrayTest(BaseModel):
Do not edit the class manually.
"""
array_of_string: Optional[conlist(StrictStr, max_items=3, min_items=0)] = None
array_array_of_integer: Optional[List[List[StrictInt]]] = None
array_array_of_model: Optional[List[List[ReadOnlyFirst]]] = None
array_array_of_integer: Optional[conlist(conlist(StrictInt))] = None
array_array_of_model: Optional[conlist(conlist(ReadOnlyFirst))] = None
additional_properties: Dict[str, Any] = {}
__properties = ["array_of_string", "array_array_of_integer", "array_array_of_model"]

View File

@ -18,7 +18,7 @@ import json
from typing import List, Optional
from pydantic import BaseModel, StrictStr, validator
from pydantic import BaseModel, StrictStr, conlist, validator
class EnumArrays(BaseModel):
"""NOTE: This class is auto generated by OpenAPI Generator.
@ -27,7 +27,7 @@ class EnumArrays(BaseModel):
Do not edit the class manually.
"""
just_symbol: Optional[StrictStr] = None
array_enum: Optional[List[StrictStr]] = None
array_enum: Optional[conlist(StrictStr)] = None
additional_properties: Dict[str, Any] = {}
__properties = ["just_symbol", "array_enum"]

View File

@ -18,7 +18,7 @@ import json
from typing import List, Optional
from pydantic import BaseModel
from pydantic import BaseModel, conlist
from petstore_api.models.file import File
class FileSchemaTestClass(BaseModel):
@ -28,7 +28,7 @@ class FileSchemaTestClass(BaseModel):
Do not edit the class manually.
"""
file: Optional[File] = None
files: Optional[List[File]] = None
files: Optional[conlist(File)] = None
additional_properties: Dict[str, Any] = {}
__properties = ["file", "files"]

View File

@ -18,7 +18,7 @@ import json
from datetime import date, datetime
from typing import Any, Dict, List, Optional
from pydantic import BaseModel, StrictBool, StrictFloat, StrictInt, StrictStr
from pydantic import BaseModel, StrictBool, StrictFloat, StrictInt, StrictStr, conlist
class NullableClass(BaseModel):
"""NOTE: This class is auto generated by OpenAPI Generator.
@ -33,9 +33,9 @@ class NullableClass(BaseModel):
string_prop: Optional[StrictStr] = None
date_prop: Optional[date] = None
datetime_prop: Optional[datetime] = None
array_nullable_prop: Optional[List[Dict[str, Any]]] = None
array_and_items_nullable_prop: Optional[List[Dict[str, Any]]] = None
array_items_nullable: Optional[List[Dict[str, Any]]] = None
array_nullable_prop: Optional[conlist(Dict[str, Any])] = None
array_and_items_nullable_prop: Optional[conlist(Dict[str, Any])] = None
array_items_nullable: Optional[conlist(Dict[str, Any])] = None
object_nullable_prop: Optional[Dict[str, Dict[str, Any]]] = None
object_and_items_nullable_prop: Optional[Dict[str, Dict[str, Any]]] = None
object_items_nullable: Optional[Dict[str, Dict[str, Any]]] = None

View File

@ -18,7 +18,7 @@ import json
from typing import List, Optional
from pydantic import BaseModel, Field, StrictFloat, StrictStr
from pydantic import BaseModel, Field, StrictFloat, StrictStr, conlist
from petstore_api.models.deprecated_object import DeprecatedObject
class ObjectWithDeprecatedFields(BaseModel):
@ -30,7 +30,7 @@ class ObjectWithDeprecatedFields(BaseModel):
uuid: Optional[StrictStr] = None
id: Optional[StrictFloat] = None
deprecated_ref: Optional[DeprecatedObject] = Field(None, alias="deprecatedRef")
bars: Optional[List[StrictStr]] = None
bars: Optional[conlist(StrictStr)] = None
additional_properties: Dict[str, Any] = {}
__properties = ["uuid", "id", "deprecatedRef", "bars"]

View File

@ -18,7 +18,7 @@ import json
from typing import List, Optional
from pydantic import BaseModel, Field, StrictInt, StrictStr, validator
from pydantic import BaseModel, Field, StrictInt, StrictStr, conlist, validator
from petstore_api.models.category import Category
from petstore_api.models.tag import Tag
@ -31,8 +31,8 @@ class Pet(BaseModel):
id: Optional[StrictInt] = None
category: Optional[Category] = None
name: StrictStr = ...
photo_urls: List[StrictStr] = Field(..., alias="photoUrls", unique_items=True)
tags: Optional[List[Tag]] = None
photo_urls: conlist(StrictStr, min_items=0, unique_items=True) = Field(..., alias="photoUrls")
tags: Optional[conlist(Tag)] = None
status: Optional[StrictStr] = Field(None, description="pet status in the store")
additional_properties: Dict[str, Any] = {}
__properties = ["id", "category", "name", "photoUrls", "tags", "status"]