Add UUID examples and documentation (#22303)

This commit is contained in:
Enric Pou
2025-11-08 07:56:46 +01:00
committed by GitHub
parent 64c8711356
commit f37b8cce58
26 changed files with 45 additions and 35 deletions

View File

@@ -55,6 +55,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
<ul class="column-ul"> <ul class="column-ul">
<li>Dict</li> <li>Dict</li>
<li>List</li> <li>List</li>
<li>UUID</li>
<li>bool</li> <li>bool</li>
<li>bytes</li> <li>bytes</li>
<li>date</li> <li>date</li>

View File

@@ -55,6 +55,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
<ul class="column-ul"> <ul class="column-ul">
<li>Dict</li> <li>Dict</li>
<li>List</li> <li>List</li>
<li>UUID</li>
<li>bool</li> <li>bool</li>
<li>bytes</li> <li>bytes</li>
<li>date</li> <li>date</li>

View File

@@ -50,6 +50,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
<ul class="column-ul"> <ul class="column-ul">
<li>Dict</li> <li>Dict</li>
<li>List</li> <li>List</li>
<li>UUID</li>
<li>bool</li> <li>bool</li>
<li>bytes</li> <li>bytes</li>
<li>date</li> <li>date</li>

View File

@@ -55,6 +55,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
<ul class="column-ul"> <ul class="column-ul">
<li>Dict</li> <li>Dict</li>
<li>List</li> <li>List</li>
<li>UUID</li>
<li>bool</li> <li>bool</li>
<li>bytes</li> <li>bytes</li>
<li>date</li> <li>date</li>

View File

@@ -53,6 +53,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
<ul class="column-ul"> <ul class="column-ul">
<li>Dict</li> <li>Dict</li>
<li>List</li> <li>List</li>
<li>UUID</li>
<li>bool</li> <li>bool</li>
<li>bytearray</li> <li>bytearray</li>
<li>bytes</li> <li>bytes</li>

View File

@@ -108,6 +108,7 @@ public abstract class AbstractPythonCodegen extends DefaultCodegen implements Co
// TODO file and binary is mapped as `file` // TODO file and binary is mapped as `file`
languageSpecificPrimitives.add("file"); languageSpecificPrimitives.add("file");
languageSpecificPrimitives.add("bytes"); languageSpecificPrimitives.add("bytes");
languageSpecificPrimitives.add("UUID");
typeMapping.clear(); typeMapping.clear();
typeMapping.put("integer", "int"); typeMapping.put("integer", "int");
@@ -129,8 +130,7 @@ public abstract class AbstractPythonCodegen extends DefaultCodegen implements Co
// mapped to String as a workaround // mapped to String as a workaround
typeMapping.put("binary", "str"); typeMapping.put("binary", "str");
typeMapping.put("ByteArray", "str"); typeMapping.put("ByteArray", "str");
// map uuid to string for the time being typeMapping.put("UUID", "UUID");
typeMapping.put("UUID", "str");
typeMapping.put("URI", "str"); typeMapping.put("URI", "str");
typeMapping.put("null", "none_type"); typeMapping.put("null", "none_type");
@@ -571,7 +571,12 @@ public abstract class AbstractPythonCodegen extends DefaultCodegen implements Co
type = p.dataType; type = p.dataType;
} }
if ("String".equalsIgnoreCase(type) || "str".equalsIgnoreCase(type)) { if (Boolean.TRUE.equals(p.isUuid)) {
if (example == null) {
example = "38400000-8cf0-11bd-b23e-10b96e4ef00d";
}
example = "UUID('" + escapeTextInSingleQuotes(example) + "')";
} else if ("String".equalsIgnoreCase(type) || "str".equalsIgnoreCase(type)) {
if (example == null) { if (example == null) {
example = p.paramName + "_example"; example = p.paramName + "_example";
} }

View File

@@ -1328,7 +1328,7 @@ configuration = petstore_api.Configuration(
async with petstore_api.ApiClient(configuration) as api_client: async with petstore_api.ApiClient(configuration) as api_client:
# Create an instance of the API class # Create an instance of the API class
api_instance = petstore_api.FakeApi(api_client) api_instance = petstore_api.FakeApi(api_client)
uuid_example = '84529ad2-2265-4e15-b76b-c17025d848f6' # str | uuid example uuid_example = UUID('84529ad2-2265-4e15-b76b-c17025d848f6') # UUID | uuid example
try: try:
# test uuid example # test uuid example
@@ -1344,7 +1344,7 @@ async with petstore_api.ApiClient(configuration) as api_client:
Name | Type | Description | Notes Name | Type | Description | Notes
------------- | ------------- | ------------- | ------------- ------------- | ------------- | ------------- | -------------
**uuid_example** | **str**| uuid example | **uuid_example** | **UUID**| uuid example |
### Return type ### Return type

View File

@@ -18,7 +18,7 @@ Name | Type | Description | Notes
**binary** | **bytearray** | | [optional] **binary** | **bytearray** | | [optional]
**var_date** | **date** | | **var_date** | **date** | |
**date_time** | **datetime** | | [optional] **date_time** | **datetime** | | [optional]
**uuid** | **str** | | [optional] **uuid** | **UUID** | | [optional]
**password** | **str** | | **password** | **str** | |
**pattern_with_digits** | **str** | A string that is a 10 digit number. Can have leading zeros. | [optional] **pattern_with_digits** | **str** | A string that is a 10 digit number. Can have leading zeros. | [optional]
**pattern_with_digits_and_delimiter** | **str** | A string starting with &#39;image_&#39; (case insensitive) and one to three digits following i.e. Image_01. | [optional] **pattern_with_digits_and_delimiter** | **str** | A string starting with &#39;image_&#39; (case insensitive) and one to three digits following i.e. Image_01. | [optional]

View File

@@ -5,7 +5,7 @@
Name | Type | Description | Notes Name | Type | Description | Notes
------------ | ------------- | ------------- | ------------- ------------ | ------------- | ------------- | -------------
**uuid** | **str** | | [optional] **uuid** | **UUID** | | [optional]
**date_time** | **datetime** | | [optional] **date_time** | **datetime** | | [optional]
**map** | [**Dict[str, Animal]**](Animal.md) | | [optional] **map** | [**Dict[str, Animal]**](Animal.md) | | [optional]

View File

@@ -6,7 +6,7 @@ Used to test oneOf enums with only one string value.
Name | Type | Description | Notes Name | Type | Description | Notes
------------ | ------------- | ------------- | ------------- ------------ | ------------- | ------------- | -------------
**id** | **str** | | **id** | **UUID** | |
**activity** | [**TaskActivity**](TaskActivity.md) | | **activity** | [**TaskActivity**](TaskActivity.md) | |
## Example ## Example

View File

@@ -4932,7 +4932,7 @@ class FakeApi:
:param uuid_example: uuid example (required) :param uuid_example: uuid example (required)
:type uuid_example: str :type uuid_example: UUID
:param _request_timeout: timeout setting for this request. If one :param _request_timeout: timeout setting for this request. If one
number provided, it will be total request number provided, it will be total request
timeout. It can also be a pair (tuple) of timeout. It can also be a pair (tuple) of
@@ -4998,7 +4998,7 @@ class FakeApi:
:param uuid_example: uuid example (required) :param uuid_example: uuid example (required)
:type uuid_example: str :type uuid_example: UUID
:param _request_timeout: timeout setting for this request. If one :param _request_timeout: timeout setting for this request. If one
number provided, it will be total request number provided, it will be total request
timeout. It can also be a pair (tuple) of timeout. It can also be a pair (tuple) of
@@ -5064,7 +5064,7 @@ class FakeApi:
:param uuid_example: uuid example (required) :param uuid_example: uuid example (required)
:type uuid_example: str :type uuid_example: UUID
:param _request_timeout: timeout setting for this request. If one :param _request_timeout: timeout setting for this request. If one
number provided, it will be total request number provided, it will be total request
timeout. It can also be a pair (tuple) of timeout. It can also be a pair (tuple) of

View File

@@ -1328,7 +1328,7 @@ configuration = petstore_api.Configuration(
async with petstore_api.ApiClient(configuration) as api_client: async with petstore_api.ApiClient(configuration) as api_client:
# Create an instance of the API class # Create an instance of the API class
api_instance = petstore_api.FakeApi(api_client) api_instance = petstore_api.FakeApi(api_client)
uuid_example = '84529ad2-2265-4e15-b76b-c17025d848f6' # str | uuid example uuid_example = UUID('84529ad2-2265-4e15-b76b-c17025d848f6') # UUID | uuid example
try: try:
# test uuid example # test uuid example
@@ -1344,7 +1344,7 @@ async with petstore_api.ApiClient(configuration) as api_client:
Name | Type | Description | Notes Name | Type | Description | Notes
------------- | ------------- | ------------- | ------------- ------------- | ------------- | ------------- | -------------
**uuid_example** | **str**| uuid example | **uuid_example** | **UUID**| uuid example |
### Return type ### Return type

View File

@@ -18,7 +18,7 @@ Name | Type | Description | Notes
**binary** | **bytearray** | | [optional] **binary** | **bytearray** | | [optional]
**var_date** | **date** | | **var_date** | **date** | |
**date_time** | **datetime** | | [optional] **date_time** | **datetime** | | [optional]
**uuid** | **str** | | [optional] **uuid** | **UUID** | | [optional]
**password** | **str** | | **password** | **str** | |
**pattern_with_digits** | **str** | A string that is a 10 digit number. Can have leading zeros. | [optional] **pattern_with_digits** | **str** | A string that is a 10 digit number. Can have leading zeros. | [optional]
**pattern_with_digits_and_delimiter** | **str** | A string starting with &#39;image_&#39; (case insensitive) and one to three digits following i.e. Image_01. | [optional] **pattern_with_digits_and_delimiter** | **str** | A string starting with &#39;image_&#39; (case insensitive) and one to three digits following i.e. Image_01. | [optional]

View File

@@ -5,7 +5,7 @@
Name | Type | Description | Notes Name | Type | Description | Notes
------------ | ------------- | ------------- | ------------- ------------ | ------------- | ------------- | -------------
**uuid** | **str** | | [optional] **uuid** | **UUID** | | [optional]
**date_time** | **datetime** | | [optional] **date_time** | **datetime** | | [optional]
**map** | [**Dict[str, Animal]**](Animal.md) | | [optional] **map** | [**Dict[str, Animal]**](Animal.md) | | [optional]

View File

@@ -6,7 +6,7 @@ Used to test oneOf enums with only one string value.
Name | Type | Description | Notes Name | Type | Description | Notes
------------ | ------------- | ------------- | ------------- ------------ | ------------- | ------------- | -------------
**id** | **str** | | **id** | **UUID** | |
**activity** | [**TaskActivity**](TaskActivity.md) | | **activity** | [**TaskActivity**](TaskActivity.md) | |
## Example ## Example

View File

@@ -4932,7 +4932,7 @@ class FakeApi:
:param uuid_example: uuid example (required) :param uuid_example: uuid example (required)
:type uuid_example: str :type uuid_example: UUID
:param _request_timeout: timeout setting for this request. If one :param _request_timeout: timeout setting for this request. If one
number provided, it will be total request number provided, it will be total request
timeout. It can also be a pair (tuple) of timeout. It can also be a pair (tuple) of
@@ -4998,7 +4998,7 @@ class FakeApi:
:param uuid_example: uuid example (required) :param uuid_example: uuid example (required)
:type uuid_example: str :type uuid_example: UUID
:param _request_timeout: timeout setting for this request. If one :param _request_timeout: timeout setting for this request. If one
number provided, it will be total request number provided, it will be total request
timeout. It can also be a pair (tuple) of timeout. It can also be a pair (tuple) of
@@ -5064,7 +5064,7 @@ class FakeApi:
:param uuid_example: uuid example (required) :param uuid_example: uuid example (required)
:type uuid_example: str :type uuid_example: UUID
:param _request_timeout: timeout setting for this request. If one :param _request_timeout: timeout setting for this request. If one
number provided, it will be total request number provided, it will be total request
timeout. It can also be a pair (tuple) of timeout. It can also be a pair (tuple) of

View File

@@ -1328,7 +1328,7 @@ configuration = petstore_api.Configuration(
with petstore_api.ApiClient(configuration) as api_client: with petstore_api.ApiClient(configuration) as api_client:
# Create an instance of the API class # Create an instance of the API class
api_instance = petstore_api.FakeApi(api_client) api_instance = petstore_api.FakeApi(api_client)
uuid_example = '84529ad2-2265-4e15-b76b-c17025d848f6' # str | uuid example uuid_example = UUID('84529ad2-2265-4e15-b76b-c17025d848f6') # UUID | uuid example
try: try:
# test uuid example # test uuid example
@@ -1344,7 +1344,7 @@ with petstore_api.ApiClient(configuration) as api_client:
Name | Type | Description | Notes Name | Type | Description | Notes
------------- | ------------- | ------------- | ------------- ------------- | ------------- | ------------- | -------------
**uuid_example** | **str**| uuid example | **uuid_example** | **UUID**| uuid example |
### Return type ### Return type

View File

@@ -18,7 +18,7 @@ Name | Type | Description | Notes
**binary** | **bytearray** | | [optional] **binary** | **bytearray** | | [optional]
**var_date** | **date** | | **var_date** | **date** | |
**date_time** | **datetime** | | [optional] **date_time** | **datetime** | | [optional]
**uuid** | **str** | | [optional] **uuid** | **UUID** | | [optional]
**password** | **str** | | **password** | **str** | |
**pattern_with_digits** | **str** | A string that is a 10 digit number. Can have leading zeros. | [optional] **pattern_with_digits** | **str** | A string that is a 10 digit number. Can have leading zeros. | [optional]
**pattern_with_digits_and_delimiter** | **str** | A string starting with &#39;image_&#39; (case insensitive) and one to three digits following i.e. Image_01. | [optional] **pattern_with_digits_and_delimiter** | **str** | A string starting with &#39;image_&#39; (case insensitive) and one to three digits following i.e. Image_01. | [optional]

View File

@@ -5,7 +5,7 @@
Name | Type | Description | Notes Name | Type | Description | Notes
------------ | ------------- | ------------- | ------------- ------------ | ------------- | ------------- | -------------
**uuid** | **str** | | [optional] **uuid** | **UUID** | | [optional]
**date_time** | **datetime** | | [optional] **date_time** | **datetime** | | [optional]
**map** | [**Dict[str, Animal]**](Animal.md) | | [optional] **map** | [**Dict[str, Animal]**](Animal.md) | | [optional]

View File

@@ -6,7 +6,7 @@ Used to test oneOf enums with only one string value.
Name | Type | Description | Notes Name | Type | Description | Notes
------------ | ------------- | ------------- | ------------- ------------ | ------------- | ------------- | -------------
**id** | **str** | | **id** | **UUID** | |
**activity** | [**TaskActivity**](TaskActivity.md) | | **activity** | [**TaskActivity**](TaskActivity.md) | |
## Example ## Example

View File

@@ -4932,7 +4932,7 @@ class FakeApi:
:param uuid_example: uuid example (required) :param uuid_example: uuid example (required)
:type uuid_example: str :type uuid_example: UUID
:param _request_timeout: timeout setting for this request. If one :param _request_timeout: timeout setting for this request. If one
number provided, it will be total request number provided, it will be total request
timeout. It can also be a pair (tuple) of timeout. It can also be a pair (tuple) of
@@ -4998,7 +4998,7 @@ class FakeApi:
:param uuid_example: uuid example (required) :param uuid_example: uuid example (required)
:type uuid_example: str :type uuid_example: UUID
:param _request_timeout: timeout setting for this request. If one :param _request_timeout: timeout setting for this request. If one
number provided, it will be total request number provided, it will be total request
timeout. It can also be a pair (tuple) of timeout. It can also be a pair (tuple) of
@@ -5064,7 +5064,7 @@ class FakeApi:
:param uuid_example: uuid example (required) :param uuid_example: uuid example (required)
:type uuid_example: str :type uuid_example: UUID
:param _request_timeout: timeout setting for this request. If one :param _request_timeout: timeout setting for this request. If one
number provided, it will be total request number provided, it will be total request
timeout. It can also be a pair (tuple) of timeout. It can also be a pair (tuple) of

View File

@@ -1328,7 +1328,7 @@ configuration = petstore_api.Configuration(
with petstore_api.ApiClient(configuration) as api_client: with petstore_api.ApiClient(configuration) as api_client:
# Create an instance of the API class # Create an instance of the API class
api_instance = petstore_api.FakeApi(api_client) api_instance = petstore_api.FakeApi(api_client)
uuid_example = '84529ad2-2265-4e15-b76b-c17025d848f6' # str | uuid example uuid_example = UUID('84529ad2-2265-4e15-b76b-c17025d848f6') # UUID | uuid example
try: try:
# test uuid example # test uuid example
@@ -1344,7 +1344,7 @@ with petstore_api.ApiClient(configuration) as api_client:
Name | Type | Description | Notes Name | Type | Description | Notes
------------- | ------------- | ------------- | ------------- ------------- | ------------- | ------------- | -------------
**uuid_example** | **str**| uuid example | **uuid_example** | **UUID**| uuid example |
### Return type ### Return type

View File

@@ -18,7 +18,7 @@ Name | Type | Description | Notes
**binary** | **bytearray** | | [optional] **binary** | **bytearray** | | [optional]
**var_date** | **date** | | **var_date** | **date** | |
**date_time** | **datetime** | | [optional] **date_time** | **datetime** | | [optional]
**uuid** | **str** | | [optional] **uuid** | **UUID** | | [optional]
**password** | **str** | | **password** | **str** | |
**pattern_with_digits** | **str** | A string that is a 10 digit number. Can have leading zeros. | [optional] **pattern_with_digits** | **str** | A string that is a 10 digit number. Can have leading zeros. | [optional]
**pattern_with_digits_and_delimiter** | **str** | A string starting with &#39;image_&#39; (case insensitive) and one to three digits following i.e. Image_01. | [optional] **pattern_with_digits_and_delimiter** | **str** | A string starting with &#39;image_&#39; (case insensitive) and one to three digits following i.e. Image_01. | [optional]

View File

@@ -5,7 +5,7 @@
Name | Type | Description | Notes Name | Type | Description | Notes
------------ | ------------- | ------------- | ------------- ------------ | ------------- | ------------- | -------------
**uuid** | **str** | | [optional] **uuid** | **UUID** | | [optional]
**date_time** | **datetime** | | [optional] **date_time** | **datetime** | | [optional]
**map** | [**Dict[str, Animal]**](Animal.md) | | [optional] **map** | [**Dict[str, Animal]**](Animal.md) | | [optional]

View File

@@ -6,7 +6,7 @@ Used to test oneOf enums with only one string value.
Name | Type | Description | Notes Name | Type | Description | Notes
------------ | ------------- | ------------- | ------------- ------------ | ------------- | ------------- | -------------
**id** | **str** | | **id** | **UUID** | |
**activity** | [**TaskActivity**](TaskActivity.md) | | **activity** | [**TaskActivity**](TaskActivity.md) | |
## Example ## Example

View File

@@ -4932,7 +4932,7 @@ class FakeApi:
:param uuid_example: uuid example (required) :param uuid_example: uuid example (required)
:type uuid_example: str :type uuid_example: UUID
:param _request_timeout: timeout setting for this request. If one :param _request_timeout: timeout setting for this request. If one
number provided, it will be total request number provided, it will be total request
timeout. It can also be a pair (tuple) of timeout. It can also be a pair (tuple) of
@@ -4998,7 +4998,7 @@ class FakeApi:
:param uuid_example: uuid example (required) :param uuid_example: uuid example (required)
:type uuid_example: str :type uuid_example: UUID
:param _request_timeout: timeout setting for this request. If one :param _request_timeout: timeout setting for this request. If one
number provided, it will be total request number provided, it will be total request
timeout. It can also be a pair (tuple) of timeout. It can also be a pair (tuple) of
@@ -5064,7 +5064,7 @@ class FakeApi:
:param uuid_example: uuid example (required) :param uuid_example: uuid example (required)
:type uuid_example: str :type uuid_example: UUID
:param _request_timeout: timeout setting for this request. If one :param _request_timeout: timeout setting for this request. If one
number provided, it will be total request number provided, it will be total request
timeout. It can also be a pair (tuple) of timeout. It can also be a pair (tuple) of