diff --git a/docs/generators.md b/docs/generators.md
index 09ca42bdb3d0..2542f5a0fd2a 100644
--- a/docs/generators.md
+++ b/docs/generators.md
@@ -53,6 +53,7 @@ The following generators are available:
* [php-dt (beta)](generators/php-dt.md)
* [powershell (beta)](generators/powershell.md)
* [python](generators/python.md)
+* [python-uplink (experimental)](generators/python-uplink.md)
* [r](generators/r.md)
* [ruby](generators/ruby.md)
* [rust](generators/rust.md)
diff --git a/docs/generators/python-uplink.md b/docs/generators/python-uplink.md
new file mode 100644
index 000000000000..ddced76d52e6
--- /dev/null
+++ b/docs/generators/python-uplink.md
@@ -0,0 +1,231 @@
+---
+title: Documentation for the python-uplink Generator
+---
+
+## METADATA
+
+| Property | Value | Notes |
+| -------- | ----- | ----- |
+| generator name | python-uplink | pass this to the generate command after -g |
+| generator stability | EXPERIMENTAL | |
+| generator type | CLIENT | |
+| generator language | Python | |
+| generator default templating engine | mustache | |
+| helpTxt | Generates a python-uplink client. | |
+
+## CONFIG OPTIONS
+These options may be applied as additional-properties (cli) or configOptions (plugins). Refer to [configuration docs](https://openapi-generator.tech/docs/configuration) for more details.
+
+| Option | Description | Values | Default |
+| ------ | ----------- | ------ | ------- |
+|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
+|disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|
- **false**
- The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.
- **true**
- Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.
|true|
+|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
+|enumUnknownDefaultCase|If the server adds new enum cases, that are unknown by an old spec/client, the client will fail to parse the network response.With this option enabled, each enum will have a new case, 'unknown_default_open_api', so that when the server sends an enum case that is not known by the client/spec, they can safely fallback to this case.|- **false**
- No changes to the enum's are made, this is the default option.
- **true**
- With this option enabled, each enum will have a new case, 'unknown_default_open_api', so that when the enum case sent by the server is not known by the client/spec, can safely be decoded to this case.
|false|
+|legacyDiscriminatorBehavior|Set to false for generators with better support for discriminators. (Python, Java, Go, PowerShell, C# have this enabled by default).|- **true**
- The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.
- **false**
- The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.
|true|
+|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
+|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true|
+|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
+
+## IMPORT MAPPING
+
+| Type/Alias | Imports |
+| ---------- | ------- |
+
+
+## INSTANTIATION TYPES
+
+| Type/Alias | Instantiated By |
+| ---------- | --------------- |
+
+
+## LANGUAGE PRIMITIVES
+
+
+- Dict
+- List
+- bool
+- bytes
+- date
+- datetime
+- dict
+- file
+- float
+- int
+- list
+- object
+- str
+
+
+## RESERVED WORDS
+
+
+- all_params
+- and
+- as
+- assert
+- async
+- auth_settings
+- await
+- body_params
+- break
+- class
+- continue
+- def
+- del
+- elif
+- else
+- except
+- exec
+- false
+- finally
+- for
+- form_params
+- from
+- global
+- header_params
+- if
+- import
+- in
+- is
+- json
+- lambda
+- local_var_files
+- none
+- nonlocal
+- not
+- or
+- pass
+- path_params
+- print
+- property
+- query_params
+- raise
+- resource_path
+- return
+- schema
+- self
+- true
+- try
+- while
+- with
+- yield
+
+
+## FEATURE SET
+
+
+### Client Modification Feature
+| Name | Supported | Defined By |
+| ---- | --------- | ---------- |
+|BasePath|✗|ToolingExtension
+|Authorizations|✗|ToolingExtension
+|UserAgent|✗|ToolingExtension
+|MockServer|✗|ToolingExtension
+
+### Data Type Feature
+| Name | Supported | Defined By |
+| ---- | --------- | ---------- |
+|Custom|✗|OAS2,OAS3
+|Int32|✓|OAS2,OAS3
+|Int64|✓|OAS2,OAS3
+|Float|✓|OAS2,OAS3
+|Double|✓|OAS2,OAS3
+|Decimal|✓|ToolingExtension
+|String|✓|OAS2,OAS3
+|Byte|✓|OAS2,OAS3
+|Binary|✓|OAS2,OAS3
+|Boolean|✓|OAS2,OAS3
+|Date|✓|OAS2,OAS3
+|DateTime|✓|OAS2,OAS3
+|Password|✓|OAS2,OAS3
+|File|✓|OAS2
+|Uuid|✗|
+|Array|✓|OAS2,OAS3
+|Null|✗|OAS3
+|AnyType|✗|OAS2,OAS3
+|Object|✓|OAS2,OAS3
+|Maps|✓|ToolingExtension
+|CollectionFormat|✓|OAS2
+|CollectionFormatMulti|✓|OAS2
+|Enum|✓|OAS2,OAS3
+|ArrayOfEnum|✓|ToolingExtension
+|ArrayOfModel|✓|ToolingExtension
+|ArrayOfCollectionOfPrimitives|✓|ToolingExtension
+|ArrayOfCollectionOfModel|✓|ToolingExtension
+|ArrayOfCollectionOfEnum|✓|ToolingExtension
+|MapOfEnum|✓|ToolingExtension
+|MapOfModel|✓|ToolingExtension
+|MapOfCollectionOfPrimitives|✓|ToolingExtension
+|MapOfCollectionOfModel|✓|ToolingExtension
+|MapOfCollectionOfEnum|✓|ToolingExtension
+
+### Documentation Feature
+| Name | Supported | Defined By |
+| ---- | --------- | ---------- |
+|Readme|✗|ToolingExtension
+|Model|✗|ToolingExtension
+|Api|✗|ToolingExtension
+
+### Global Feature
+| Name | Supported | Defined By |
+| ---- | --------- | ---------- |
+|Host|✓|OAS2,OAS3
+|BasePath|✓|OAS2,OAS3
+|Info|✓|OAS2,OAS3
+|Schemes|✗|OAS2,OAS3
+|PartialSchemes|✓|OAS2,OAS3
+|Consumes|✓|OAS2
+|Produces|✓|OAS2
+|ExternalDocumentation|✓|OAS2,OAS3
+|Examples|✓|OAS2,OAS3
+|XMLStructureDefinitions|✗|OAS2,OAS3
+|MultiServer|✗|OAS3
+|ParameterizedServer|✗|OAS3
+|ParameterStyling|✗|OAS3
+|Callbacks|✓|OAS3
+|LinkObjects|✗|OAS3
+
+### Parameter Feature
+| Name | Supported | Defined By |
+| ---- | --------- | ---------- |
+|Path|✓|OAS2,OAS3
+|Query|✓|OAS2,OAS3
+|Header|✓|OAS2,OAS3
+|Body|✓|OAS2
+|FormUnencoded|✓|OAS2
+|FormMultipart|✓|OAS2
+|Cookie|✓|OAS3
+
+### Schema Support Feature
+| Name | Supported | Defined By |
+| ---- | --------- | ---------- |
+|Simple|✓|OAS2,OAS3
+|Composite|✓|OAS2,OAS3
+|Polymorphism|✓|OAS2,OAS3
+|Union|✗|OAS3
+|allOf|✗|OAS2,OAS3
+|anyOf|✗|OAS3
+|oneOf|✗|OAS3
+|not|✗|OAS3
+
+### Security Feature
+| Name | Supported | Defined By |
+| ---- | --------- | ---------- |
+|BasicAuth|✓|OAS2,OAS3
+|ApiKey|✓|OAS2,OAS3
+|OpenIDConnect|✓|OAS3
+|BearerToken|✓|OAS3
+|OAuth2_Implicit|✓|OAS2,OAS3
+|OAuth2_Password|✓|OAS2,OAS3
+|OAuth2_ClientCredentials|✓|OAS2,OAS3
+|OAuth2_AuthorizationCode|✓|OAS2,OAS3
+|SignatureAuth|✗|OAS3
+
+### Wire Format Feature
+| Name | Supported | Defined By |
+| ---- | --------- | ---------- |
+|JSON|✓|OAS2,OAS3
+|XML|✗|OAS2,OAS3
+|PROTOBUF|✗|ToolingExtension
+|Custom|✗|OAS2,OAS3
diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonUplinkClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonUplinkClientCodegen.java
index b65b039a065c..cd5a6d93f3f2 100644
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonUplinkClientCodegen.java
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonUplinkClientCodegen.java
@@ -56,12 +56,12 @@ public PythonUplinkClientCodegen() {
// at the moment
importMapping.clear();
- typeMapping.put("object", "Dict");
+ typeMapping.put("object", "Dict[str, Any]");
typeMapping.put("AnyType", "Any");
typeMapping.put("file", "bytes");
// Data types of the above values which are automatically imported
- defaultIncludes = Sets.newHashSet("Union");
+ defaultIncludes = Sets.newHashSet("Union", "Any");
modifyFeatureSet(features -> features.documentationFeatures(null)
.wireFormatFeatures(EnumSet.of(WireFormatFeature.JSON)));
@@ -71,7 +71,7 @@ public PythonUplinkClientCodegen() {
languageSpecificPrimitives.add("List");
languageSpecificPrimitives.add("Dict");
typeMapping.put("array", "List");
- typeMapping.put("map", "Dict");
+ typeMapping.put("map", "Dict[str, Any]");
}
diff --git a/modules/openapi-generator/src/main/resources/python-uplink/model.mustache b/modules/openapi-generator/src/main/resources/python-uplink/model.mustache
index 910420006126..677bab4c29b1 100644
--- a/modules/openapi-generator/src/main/resources/python-uplink/model.mustache
+++ b/modules/openapi-generator/src/main/resources/python-uplink/model.mustache
@@ -41,10 +41,10 @@ class {{classname}}(BaseModel):
*,
{{#requiredVars}}
{{#vendorExtensions.x-has-custom-name}}
- {{name}}: {{>model_field_type}} = None,
+ {{name}}: {{>model_field_type}},
{{/vendorExtensions.x-has-custom-name}}
{{^vendorExtensions.x-has-custom-name}}
- {{name}}: {{>model_field_type}} = None,
+ {{name}}: {{>model_field_type}},
{{/vendorExtensions.x-has-custom-name}}
{{/requiredVars}}
{{#optionalVars}}
diff --git a/samples/client/petstore/python-uplink/.openapi-generator/FILES b/samples/client/petstore/python-uplink/.openapi-generator/FILES
index f8ca13520efe..111c291d2305 100644
--- a/samples/client/petstore/python-uplink/.openapi-generator/FILES
+++ b/samples/client/petstore/python-uplink/.openapi-generator/FILES
@@ -11,3 +11,4 @@ openapi_client/model/order.py
openapi_client/model/pet.py
openapi_client/model/tag.py
openapi_client/model/user.py
+openapi_client/uplink_util.py
diff --git a/samples/client/petstore/python-uplink/.openapi-generator/VERSION b/samples/client/petstore/python-uplink/.openapi-generator/VERSION
index 4b448de535c7..757e67400401 100644
--- a/samples/client/petstore/python-uplink/.openapi-generator/VERSION
+++ b/samples/client/petstore/python-uplink/.openapi-generator/VERSION
@@ -1 +1 @@
-5.3.0-SNAPSHOT
\ No newline at end of file
+7.0.0-SNAPSHOT
\ No newline at end of file
diff --git a/samples/client/petstore/python-uplink/openapi_client/__init__.py b/samples/client/petstore/python-uplink/openapi_client/__init__.py
index d82a4876dd6e..2343852b76c6 100644
--- a/samples/client/petstore/python-uplink/openapi_client/__init__.py
+++ b/samples/client/petstore/python-uplink/openapi_client/__init__.py
@@ -14,13 +14,13 @@
)
__all__ = [
- ApiResponse,
- Category,
- Order,
- Pet,
- Tag,
- User,
- PetApi,
- StoreApi,
- UserApi,
+ "ApiResponse",
+ "Category",
+ "Order",
+ "Pet",
+ "Tag",
+ "User",
+ "PetApi",
+ "StoreApi",
+ "UserApi",
]
diff --git a/samples/client/petstore/python-uplink/openapi_client/api/__init__.py b/samples/client/petstore/python-uplink/openapi_client/api/__init__.py
index 4e2d6f1b1c9d..bfd3d1fd0322 100644
--- a/samples/client/petstore/python-uplink/openapi_client/api/__init__.py
+++ b/samples/client/petstore/python-uplink/openapi_client/api/__init__.py
@@ -5,7 +5,7 @@
from openapi_client.api.user import UserApi
__all__ = [
- PetApi,
- StoreApi,
- UserApi,
+ "PetApi",
+ "StoreApi",
+ "UserApi",
]
diff --git a/samples/client/petstore/python-uplink/openapi_client/api/pet.py b/samples/client/petstore/python-uplink/openapi_client/api/pet.py
index 013edc07e111..b89c2e444dc9 100644
--- a/samples/client/petstore/python-uplink/openapi_client/api/pet.py
+++ b/samples/client/petstore/python-uplink/openapi_client/api/pet.py
@@ -1,61 +1,114 @@
from uplink import (
Consumer,
- get,
Path,
Query,
Body,
- post,
+ Header,
get,
+ post,
patch,
put,
delete,
- Header,
returns,
json,
)
-from typing import Dict, List # noqa: F401
+from typing import Dict, List, Optional, Union # noqa: F401
+
+from .uplink_util import bool_query
from openapi_client.model.api_response import ApiResponse
from openapi_client.model.pet import Pet
-
class PetApi(Consumer):
+
+ async def add_pet(self, *, body: Pet):
+ """Add a new pet to the store"""
+ return await self.__add_pet(
+ body=body,
+ )
+
+ async def delete_pet(self, *, pet_id: int, api_key: Optional[str] = None):
+ """Deletes a pet"""
+ return await self.__delete_pet(
+ petId=pet_id,
+ api_key=api_key,
+ )
+
+ async def find_pets_by_status(self, *, status: List[str]) -> List[Pet]:
+ """Finds Pets by status"""
+ return await self.__find_pets_by_status(
+ status=status,
+ )
+
+ async def find_pets_by_tags(self, *, tags: List[str]) -> List[Pet]:
+ """Finds Pets by tags"""
+ return await self.__find_pets_by_tags(
+ tags=tags,
+ )
+
+ async def get_pet_by_id(self, *, pet_id: int) -> Pet:
+ """Find pet by ID"""
+ return await self.__get_pet_by_id(
+ petId=pet_id,
+ )
+
+ async def update_pet(self, *, body: Pet):
+ """Update an existing pet"""
+ return await self.__update_pet(
+ body=body,
+ )
+
+ async def update_pet_with_form(self, *, pet_id: int, name: Optional[str] = None, status: Optional[str] = None):
+ """Updates a pet in the store with form data"""
+ return await self.__update_pet_with_form(
+ petId=pet_id,
+ name=name,
+ status=status,
+ )
+
+ async def upload_file(self, *, pet_id: int, additional_metadata: Optional[str] = None, file: Optional[str] = None) -> ApiResponse:
+ """uploads an image"""
+ return await self.__upload_file(
+ petId=pet_id,
+ additional_metadata=additional_metadata,
+ file=file,
+ )
+
@json
@post("/pet")
- def add_pet(self, *, body: Body(type=Pet)):
- """Add a new pet to the store"""
+ def __add_pet(self, *, body: Body(type=Pet)):
+ """Internal uplink method for add_pet"""
@delete("/pet/{petId}")
- def delete_pet(self, *, petId: int, api_key: Header(None)):
- """Deletes a pet"""
+ def __delete_pet(self, *, petId: int, api_key: Header(None)):
+ """Internal uplink method for delete_pet"""
@returns.json
@get("/pet/findByStatus")
- def find_pets_by_status(self, *, status: Query) -> List[Pet]:
- """Finds Pets by status"""
+ def __find_pets_by_status(self, *, status: Query) -> List[Pet]:
+ """Internal uplink method for find_pets_by_status"""
@returns.json
@get("/pet/findByTags")
- def find_pets_by_tags(self, *, tags: Query) -> List[Pet]:
- """Finds Pets by tags"""
+ def __find_pets_by_tags(self, *, tags: Query) -> List[Pet]:
+ """Internal uplink method for find_pets_by_tags"""
@returns.json
@get("/pet/{petId}")
- def get_pet_by_id(self, *, petId: int) -> Pet:
- """Find pet by ID"""
+ def __get_pet_by_id(self, *, petId: int) -> Pet:
+ """Internal uplink method for get_pet_by_id"""
@json
@put("/pet")
- def update_pet(self, *, body: Body(type=Pet)):
- """Update an existing pet"""
+ def __update_pet(self, *, body: Body(type=Pet)):
+ """Internal uplink method for update_pet"""
@post("/pet/{petId}")
- def update_pet_with_form(self, *, petId: int, name: Form(None), status: Form(None)):
- """Updates a pet in the store with form data"""
+ def __update_pet_with_form(self, *, petId: int, name: Form(None), status: Form(None)):
+ """Internal uplink method for update_pet_with_form"""
@returns.json
@post("/pet/{petId}/uploadImage")
- def upload_file(self, *, petId: int, additional_metadata: Form(None), file: Form(None)) -> ApiResponse:
- """uploads an image"""
-
+ def __upload_file(self, *, petId: int, additional_metadata: Form(None), file: Form(None)) -> ApiResponse:
+ """Internal uplink method for upload_file"""
diff --git a/samples/client/petstore/python-uplink/openapi_client/api/store.py b/samples/client/petstore/python-uplink/openapi_client/api/store.py
index 03be93511f25..bc4cc3f4d818 100644
--- a/samples/client/petstore/python-uplink/openapi_client/api/store.py
+++ b/samples/client/petstore/python-uplink/openapi_client/api/store.py
@@ -1,41 +1,64 @@
from uplink import (
Consumer,
- get,
Path,
Query,
Body,
- post,
+ Header,
get,
+ post,
patch,
put,
delete,
- Header,
returns,
json,
)
-from typing import Dict, List # noqa: F401
+from typing import Dict, List, Optional, Union # noqa: F401
-from openapi_client.model.order import Order
+from .uplink_util import bool_query
+from openapi_client.model.order import Order
class StoreApi(Consumer):
- @delete("/store/order/{orderId}")
- def delete_order(self, *, orderId: str):
+
+ async def delete_order(self, *, order_id: str):
"""Delete purchase order by ID"""
+ return await self.__delete_order(
+ orderId=order_id,
+ )
+
+ async def get_inventory(self) -> Dict[str, int]:
+ """Returns pet inventories by status"""
+ return await self.__get_inventory(
+ )
+
+ async def get_order_by_id(self, *, order_id: int) -> Order:
+ """Find purchase order by ID"""
+ return await self.__get_order_by_id(
+ orderId=order_id,
+ )
+
+ async def place_order(self, *, body: Order) -> Order:
+ """Place an order for a pet"""
+ return await self.__place_order(
+ body=body,
+ )
+
+ @delete("/store/order/{orderId}")
+ def __delete_order(self, *, orderId: str):
+ """Internal uplink method for delete_order"""
@returns.json
@get("/store/inventory")
- def get_inventory(self) -> Dict[str, int]:
- """Returns pet inventories by status"""
+ def __get_inventory(self) -> Dict[str, int]:
+ """Internal uplink method for get_inventory"""
@returns.json
@get("/store/order/{orderId}")
- def get_order_by_id(self, *, orderId: int) -> Order:
- """Find purchase order by ID"""
+ def __get_order_by_id(self, *, orderId: int) -> Order:
+ """Internal uplink method for get_order_by_id"""
@returns.json
@post("/store/order")
- def place_order(self, *, body: Body(type=Order)) -> Order:
- """Place an order for a pet"""
-
+ def __place_order(self, *, body: Body(type=Order)) -> Order:
+ """Internal uplink method for place_order"""
diff --git a/samples/client/petstore/python-uplink/openapi_client/api/user.py b/samples/client/petstore/python-uplink/openapi_client/api/user.py
index e9af4209b287..d92985ab4a59 100644
--- a/samples/client/petstore/python-uplink/openapi_client/api/user.py
+++ b/samples/client/petstore/python-uplink/openapi_client/api/user.py
@@ -1,56 +1,105 @@
from uplink import (
Consumer,
- get,
Path,
Query,
Body,
- post,
+ Header,
get,
+ post,
patch,
put,
delete,
- Header,
returns,
json,
)
-from typing import Dict, List # noqa: F401
+from typing import Dict, List, Optional, Union # noqa: F401
-from openapi_client.model.user import User
+from .uplink_util import bool_query
+from openapi_client.model.user import User
class UserApi(Consumer):
- @post("/user")
- def create_user(self, *, body: Body(type=User)):
+
+ async def create_user(self, *, body: User):
"""Create user"""
+ return await self.__create_user(
+ body=body,
+ )
- @post("/user/createWithArray")
- def create_users_with_array_input(self, *, body: Body(type=List[User])):
+ async def create_users_with_array_input(self, *, body: List[User]):
"""Creates list of users with given input array"""
+ return await self.__create_users_with_array_input(
+ body=body,
+ )
- @post("/user/createWithList")
- def create_users_with_list_input(self, *, body: Body(type=List[User])):
+ async def create_users_with_list_input(self, *, body: List[User]):
"""Creates list of users with given input array"""
+ return await self.__create_users_with_list_input(
+ body=body,
+ )
- @delete("/user/{username}")
- def delete_user(self, *, username: str):
+ async def delete_user(self, *, username: str):
"""Delete user"""
+ return await self.__delete_user(
+ username=username,
+ )
+
+ async def get_user_by_name(self, *, username: str) -> User:
+ """Get user by user name"""
+ return await self.__get_user_by_name(
+ username=username,
+ )
+
+ async def login_user(self, *, username: str, password: str) -> str:
+ """Logs user into the system"""
+ return await self.__login_user(
+ username=username,
+ password=password,
+ )
+
+ async def logout_user(self):
+ """Logs out current logged in user session"""
+ return await self.__logout_user(
+ )
+
+ async def update_user(self, *, username: str, body: User):
+ """Updated user"""
+ return await self.__update_user(
+ username=username,
+ body=body,
+ )
+
+ @post("/user")
+ def __create_user(self, *, body: Body(type=User)):
+ """Internal uplink method for create_user"""
+
+ @post("/user/createWithArray")
+ def __create_users_with_array_input(self, *, body: Body(type=List[User])):
+ """Internal uplink method for create_users_with_array_input"""
+
+ @post("/user/createWithList")
+ def __create_users_with_list_input(self, *, body: Body(type=List[User])):
+ """Internal uplink method for create_users_with_list_input"""
+
+ @delete("/user/{username}")
+ def __delete_user(self, *, username: str):
+ """Internal uplink method for delete_user"""
@returns.json
@get("/user/{username}")
- def get_user_by_name(self, *, username: str) -> User:
- """Get user by user name"""
+ def __get_user_by_name(self, *, username: str) -> User:
+ """Internal uplink method for get_user_by_name"""
@returns.json
@get("/user/login")
- def login_user(self, *, username: Query, password: Query) -> str:
- """Logs user into the system"""
+ def __login_user(self, *, username: Query, password: Query) -> str:
+ """Internal uplink method for login_user"""
@get("/user/logout")
- def logout_user(self):
- """Logs out current logged in user session"""
+ def __logout_user(self):
+ """Internal uplink method for logout_user"""
@put("/user/{username}")
- def update_user(self, *, username: str, body: Body(type=User)):
- """Updated user"""
-
+ def __update_user(self, *, username: str, body: Body(type=User)):
+ """Internal uplink method for update_user"""
diff --git a/samples/client/petstore/python-uplink/openapi_client/model/__init__.py b/samples/client/petstore/python-uplink/openapi_client/model/__init__.py
index 9854843db84a..fa06b6a0bfcc 100644
--- a/samples/client/petstore/python-uplink/openapi_client/model/__init__.py
+++ b/samples/client/petstore/python-uplink/openapi_client/model/__init__.py
@@ -8,10 +8,10 @@
from openapi_client.model.user import User
__all__ = [
- ApiResponse,
- Category,
- Order,
- Pet,
- Tag,
- User,
+ "ApiResponse",
+ "Category",
+ "Order",
+ "Pet",
+ "Tag",
+ "User",
]
\ No newline at end of file
diff --git a/samples/client/petstore/python-uplink/openapi_client/model/api_response.py b/samples/client/petstore/python-uplink/openapi_client/model/api_response.py
index 00bbfc3b5df9..de9b8959ca65 100644
--- a/samples/client/petstore/python-uplink/openapi_client/model/api_response.py
+++ b/samples/client/petstore/python-uplink/openapi_client/model/api_response.py
@@ -7,7 +7,7 @@
import re # noqa: F401
from typing import Any, Dict, List, Optional, Union, Literal # noqa: F401
-from pydantic import AnyUrl, BaseModel, EmailStr, validator, Field, Extra # noqa: F401
+from pydantic import AnyUrl, BaseModel, EmailStr, validator, Field, Extra # noqa: F401
class ApiResponse(BaseModel):
@@ -38,6 +38,10 @@ def __init__(
type=type,
message=message,
**kwargs,
- )
+ )
-ApiResponse.update_forward_refs()
\ No newline at end of file
+ class Config:
+ allow_population_by_field_name = True
+
+
+ApiResponse.update_forward_refs()
diff --git a/samples/client/petstore/python-uplink/openapi_client/model/category.py b/samples/client/petstore/python-uplink/openapi_client/model/category.py
index 0142b4a94471..7c20d15108da 100644
--- a/samples/client/petstore/python-uplink/openapi_client/model/category.py
+++ b/samples/client/petstore/python-uplink/openapi_client/model/category.py
@@ -7,7 +7,7 @@
import re # noqa: F401
from typing import Any, Dict, List, Optional, Union, Literal # noqa: F401
-from pydantic import AnyUrl, BaseModel, EmailStr, validator, Field, Extra # noqa: F401
+from pydantic import AnyUrl, BaseModel, EmailStr, validator, Field, Extra # noqa: F401
class Category(BaseModel):
@@ -34,6 +34,10 @@ def __init__(
id=id,
name=name,
**kwargs,
- )
+ )
-Category.update_forward_refs()
\ No newline at end of file
+ class Config:
+ allow_population_by_field_name = True
+
+
+Category.update_forward_refs()
diff --git a/samples/client/petstore/python-uplink/openapi_client/model/order.py b/samples/client/petstore/python-uplink/openapi_client/model/order.py
index 489f2afb74c3..bb666dcb02f3 100644
--- a/samples/client/petstore/python-uplink/openapi_client/model/order.py
+++ b/samples/client/petstore/python-uplink/openapi_client/model/order.py
@@ -7,7 +7,7 @@
import re # noqa: F401
from typing import Any, Dict, List, Optional, Union, Literal # noqa: F401
-from pydantic import AnyUrl, BaseModel, EmailStr, validator, Field, Extra # noqa: F401
+from pydantic import AnyUrl, BaseModel, EmailStr, validator, Field, Extra # noqa: F401
class Order(BaseModel):
@@ -50,6 +50,10 @@ def __init__(
status=status,
complete=complete,
**kwargs,
- )
+ )
-Order.update_forward_refs()
\ No newline at end of file
+ class Config:
+ allow_population_by_field_name = True
+
+
+Order.update_forward_refs()
diff --git a/samples/client/petstore/python-uplink/openapi_client/model/pet.py b/samples/client/petstore/python-uplink/openapi_client/model/pet.py
index b70abb3938bd..8e93eca6b1ec 100644
--- a/samples/client/petstore/python-uplink/openapi_client/model/pet.py
+++ b/samples/client/petstore/python-uplink/openapi_client/model/pet.py
@@ -7,7 +7,7 @@
import re # noqa: F401
from typing import Any, Dict, List, Optional, Union, Literal # noqa: F401
-from pydantic import AnyUrl, BaseModel, EmailStr, validator, Field, Extra # noqa: F401
+from pydantic import AnyUrl, BaseModel, EmailStr, validator, Field, Extra # noqa: F401
from openapi_client.model.category import Category
from openapi_client.model.tag import Tag
@@ -18,8 +18,8 @@ class Pet(BaseModel):
Do not edit the class manually.
Pet - a model defined in OpenAPI
- name: The name of this Pet.
- photo_urls: The photo_urls of this Pet.
+ name: The name of this Pet.
+ photo_urls: The photo_urls of this Pet.
id: The id of this Pet [Optional].
category: The category of this Pet [Optional].
tags: The tags of this Pet [Optional].
@@ -52,6 +52,10 @@ def __init__(
tags=tags,
status=status,
**kwargs,
- )
+ )
-Pet.update_forward_refs()
\ No newline at end of file
+ class Config:
+ allow_population_by_field_name = True
+
+
+Pet.update_forward_refs()
diff --git a/samples/client/petstore/python-uplink/openapi_client/model/tag.py b/samples/client/petstore/python-uplink/openapi_client/model/tag.py
index f8b611781b6e..7a8ed05000f4 100644
--- a/samples/client/petstore/python-uplink/openapi_client/model/tag.py
+++ b/samples/client/petstore/python-uplink/openapi_client/model/tag.py
@@ -7,7 +7,7 @@
import re # noqa: F401
from typing import Any, Dict, List, Optional, Union, Literal # noqa: F401
-from pydantic import AnyUrl, BaseModel, EmailStr, validator, Field, Extra # noqa: F401
+from pydantic import AnyUrl, BaseModel, EmailStr, validator, Field, Extra # noqa: F401
class Tag(BaseModel):
@@ -34,6 +34,10 @@ def __init__(
id=id,
name=name,
**kwargs,
- )
+ )
-Tag.update_forward_refs()
\ No newline at end of file
+ class Config:
+ allow_population_by_field_name = True
+
+
+Tag.update_forward_refs()
diff --git a/samples/client/petstore/python-uplink/openapi_client/model/user.py b/samples/client/petstore/python-uplink/openapi_client/model/user.py
index af1337be2993..2d7b72752e2c 100644
--- a/samples/client/petstore/python-uplink/openapi_client/model/user.py
+++ b/samples/client/petstore/python-uplink/openapi_client/model/user.py
@@ -7,7 +7,7 @@
import re # noqa: F401
from typing import Any, Dict, List, Optional, Union, Literal # noqa: F401
-from pydantic import AnyUrl, BaseModel, EmailStr, validator, Field, Extra # noqa: F401
+from pydantic import AnyUrl, BaseModel, EmailStr, validator, Field, Extra # noqa: F401
class User(BaseModel):
@@ -58,6 +58,10 @@ def __init__(
phone=phone,
user_status=user_status,
**kwargs,
- )
+ )
-User.update_forward_refs()
\ No newline at end of file
+ class Config:
+ allow_population_by_field_name = True
+
+
+User.update_forward_refs()
diff --git a/samples/client/petstore/python-uplink/openapi_client/uplink_util.py b/samples/client/petstore/python-uplink/openapi_client/uplink_util.py
new file mode 100644
index 000000000000..591123594061
--- /dev/null
+++ b/samples/client/petstore/python-uplink/openapi_client/uplink_util.py
@@ -0,0 +1,8 @@
+from typing import Optional
+
+def bool_query(param: Optional[bool]):
+ # if param is boolean, we must return the json variant (e.g. True => true)
+ if isinstance(param, bool):
+ return str(param).lower()
+
+ return param