From ce4b2fe7bdd1529c4d0cb495d989810f871635eb Mon Sep 17 00:00:00 2001 From: William Cheng Date: Sun, 1 Oct 2023 20:41:54 +0800 Subject: [PATCH] [Python] add `float` to reserved word list (#16689) * add float as reserved world * clean up * update samples * Update modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractPythonCodegen.java Co-authored-by: Jonathan Ballet * update doc * uncomment test --------- Co-authored-by: Jonathan Ballet --- ...AdditionalPropertiesIfNotPresent-true.yaml | 2 +- bin/configs/python-echo-api.yaml | 2 +- docs/generators/python-aiohttp.md | 5 + docs/generators/python-blueplanet.md | 5 + docs/generators/python-fastapi.md | 5 + docs/generators/python-flask.md | 5 + docs/generators/python.md | 10 + .../languages/AbstractPythonCodegen.java | 3 + .../languages/PythonClientCodegen.java | 15 - .../test/resources/3_0/python/echo_api.yaml | 700 ------------------ ...ith-fake-endpoints-models-for-testing.yaml | 11 +- .../docs/NumberPropertiesOnly.md | 1 + .../models/number_properties_only.py | 4 +- .../python/docs/NumberPropertiesOnly.md | 1 + .../models/number_properties_only.py | 4 +- .../petstore/python-aiohttp/docs/FakeApi.md | 8 +- .../python-aiohttp/docs/FormatTest.md | 1 + .../petstore_api/api/fake_api.py | 20 +- .../petstore_api/models/format_test.py | 4 +- .../docs/FormatTest.md | 1 + .../petstore_api/models/format_test.py | 4 +- .../python-pydantic-v1/docs/FormatTest.md | 1 + .../petstore_api/models/format_test.py | 4 +- .../client/petstore/python/docs/FakeApi.md | 8 +- .../client/petstore/python/docs/FormatTest.md | 1 + .../python/petstore_api/api/fake_api.py | 24 +- .../python/petstore_api/models/format_test.py | 4 +- 27 files changed, 94 insertions(+), 759 deletions(-) delete mode 100644 modules/openapi-generator/src/test/resources/3_0/python/echo_api.yaml diff --git a/bin/configs/python-echo-api-disallowAdditionalPropertiesIfNotPresent-true.yaml b/bin/configs/python-echo-api-disallowAdditionalPropertiesIfNotPresent-true.yaml index c58ea0bfb8d..e91fe1929d1 100644 --- a/bin/configs/python-echo-api-disallowAdditionalPropertiesIfNotPresent-true.yaml +++ b/bin/configs/python-echo-api-disallowAdditionalPropertiesIfNotPresent-true.yaml @@ -1,6 +1,6 @@ generatorName: python outputDir: samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true -inputSpec: modules/openapi-generator/src/test/resources/3_0/python/echo_api.yaml +inputSpec: modules/openapi-generator/src/test/resources/3_0/echo_api.yaml templateDir: modules/openapi-generator/src/main/resources/python additionalProperties: hideGenerationTimestamp: "true" diff --git a/bin/configs/python-echo-api.yaml b/bin/configs/python-echo-api.yaml index a8ac37fa1eb..8c161951aca 100644 --- a/bin/configs/python-echo-api.yaml +++ b/bin/configs/python-echo-api.yaml @@ -1,6 +1,6 @@ generatorName: python outputDir: samples/client/echo_api/python -inputSpec: modules/openapi-generator/src/test/resources/3_0/python/echo_api.yaml +inputSpec: modules/openapi-generator/src/test/resources/3_0/echo_api.yaml templateDir: modules/openapi-generator/src/main/resources/python additionalProperties: hideGenerationTimestamp: "true" diff --git a/docs/generators/python-aiohttp.md b/docs/generators/python-aiohttp.md index acfdd4093e4..59d023f1e3c 100644 --- a/docs/generators/python-aiohttp.md +++ b/docs/generators/python-aiohttp.md @@ -78,10 +78,12 @@ These options may be applied as additional-properties (cli) or configOptions (pl
  • async
  • auth_settings
  • await
  • +
  • base64
  • body_params
  • break
  • class
  • continue
  • +
  • date
  • def
  • del
  • elif
  • @@ -90,6 +92,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
  • exec
  • false
  • finally
  • +
  • float
  • for
  • form_params
  • from
  • @@ -99,6 +102,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
  • import
  • in
  • is
  • +
  • json
  • lambda
  • local_var_files
  • none
  • @@ -113,6 +117,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
  • raise
  • resource_path
  • return
  • +
  • schema
  • self
  • true
  • try
  • diff --git a/docs/generators/python-blueplanet.md b/docs/generators/python-blueplanet.md index 37d3370ec48..4f7698d343a 100644 --- a/docs/generators/python-blueplanet.md +++ b/docs/generators/python-blueplanet.md @@ -78,10 +78,12 @@ These options may be applied as additional-properties (cli) or configOptions (pl
  • async
  • auth_settings
  • await
  • +
  • base64
  • body_params
  • break
  • class
  • continue
  • +
  • date
  • def
  • del
  • elif
  • @@ -90,6 +92,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
  • exec
  • false
  • finally
  • +
  • float
  • for
  • form_params
  • from
  • @@ -99,6 +102,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
  • import
  • in
  • is
  • +
  • json
  • lambda
  • local_var_files
  • none
  • @@ -113,6 +117,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
  • raise
  • resource_path
  • return
  • +
  • schema
  • self
  • true
  • try
  • diff --git a/docs/generators/python-fastapi.md b/docs/generators/python-fastapi.md index 6cf1623d23d..5597ee02e84 100644 --- a/docs/generators/python-fastapi.md +++ b/docs/generators/python-fastapi.md @@ -73,10 +73,12 @@ These options may be applied as additional-properties (cli) or configOptions (pl
  • async
  • auth_settings
  • await
  • +
  • base64
  • body_params
  • break
  • class
  • continue
  • +
  • date
  • def
  • del
  • elif
  • @@ -85,6 +87,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
  • exec
  • false
  • finally
  • +
  • float
  • for
  • form_params
  • from
  • @@ -94,6 +97,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
  • import
  • in
  • is
  • +
  • json
  • lambda
  • local_var_files
  • none
  • @@ -108,6 +112,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
  • raise
  • resource_path
  • return
  • +
  • schema
  • self
  • true
  • try
  • diff --git a/docs/generators/python-flask.md b/docs/generators/python-flask.md index 5f9062ab7ba..9e5bd29fbc6 100644 --- a/docs/generators/python-flask.md +++ b/docs/generators/python-flask.md @@ -78,10 +78,12 @@ These options may be applied as additional-properties (cli) or configOptions (pl
  • async
  • auth_settings
  • await
  • +
  • base64
  • body_params
  • break
  • class
  • continue
  • +
  • date
  • def
  • del
  • elif
  • @@ -90,6 +92,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
  • exec
  • false
  • finally
  • +
  • float
  • for
  • form_params
  • from
  • @@ -99,6 +102,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
  • import
  • in
  • is
  • +
  • json
  • lambda
  • local_var_files
  • none
  • @@ -113,6 +117,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
  • raise
  • resource_path
  • return
  • +
  • schema
  • self
  • true
  • try
  • diff --git a/docs/generators/python.md b/docs/generators/python.md index 84a01d4f301..21eb6eb5c3f 100644 --- a/docs/generators/python.md +++ b/docs/generators/python.md @@ -68,12 +68,15 @@ These options may be applied as additional-properties (cli) or configOptions (pl ## RESERVED WORDS
      +
    • all_params
    • and
    • as
    • assert
    • async
    • +
    • auth_settings
    • await
    • base64
    • +
    • body_params
    • break
    • class
    • continue
    • @@ -86,23 +89,30 @@ These options may be applied as additional-properties (cli) or configOptions (pl
    • exec
    • false
    • finally
    • +
    • float
    • 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
    • diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractPythonCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractPythonCodegen.java index c47c26afec0..ec63f284620 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractPythonCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractPythonCodegen.java @@ -110,6 +110,9 @@ public abstract class AbstractPythonCodegen extends DefaultCodegen implements Co "header_params", "form_params", "local_var_files", "body_params", "auth_settings", // @property "property", + // typing keywords + "schema", "base64", "json", + "date", "float", // python reserved words "and", "del", "from", "not", "while", "as", "elif", "global", "or", "with", "assert", "else", "if", "pass", "yield", "break", "except", "import", diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonClientCodegen.java index 68aba646583..93cebd71582 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonClientCodegen.java @@ -130,21 +130,6 @@ public class PythonClientCodegen extends AbstractPythonCodegen implements Codege // default HIDE_GENERATION_TIMESTAMP to true hideGenerationTimestamp = Boolean.TRUE; - // from https://docs.python.org/3/reference/lexical_analysis.html#keywords - setReservedWordsLowerCase( - Arrays.asList( - // pydantic keyword - "schema", "base64", "json", - "date", - // @property - "property", - // python reserved words - "and", "del", "from", "not", "while", "as", "elif", "global", "or", "with", - "assert", "else", "if", "pass", "yield", "break", "except", "import", - "print", "class", "exec", "in", "raise", "continue", "finally", "is", - "return", "def", "for", "lambda", "try", "self", "nonlocal", "None", "True", - "False", "async", "await")); - cliOptions.clear(); cliOptions.add(new CliOption(CodegenConstants.PACKAGE_NAME, "python package name (convention: snake_case).") .defaultValue("openapi_client")); diff --git a/modules/openapi-generator/src/test/resources/3_0/python/echo_api.yaml b/modules/openapi-generator/src/test/resources/3_0/python/echo_api.yaml deleted file mode 100644 index c1d504e9d49..00000000000 --- a/modules/openapi-generator/src/test/resources/3_0/python/echo_api.yaml +++ /dev/null @@ -1,700 +0,0 @@ -# -# Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech) -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -openapi: 3.0.3 -info: - title: Echo Server API - description: Echo Server API - contact: - email: team@openapitools.org - license: - name: Apache 2.0 - url: http://www.apache.org/licenses/LICENSE-2.0.html - version: 0.1.0 -servers: - - url: http://localhost:3000/ -paths: - # Path usually starts with parameter type such as path, query, header, form - # For body/form parameters, path starts with "/echo" so the the echo server - # will response with the same body in the HTTP request. - # - # path parameter tests - /path/string/{path_string}/integer/{path_integer}: - get: - tags: - - path - summary: Test path parameter(s) - description: Test path parameter(s) - operationId: tests/path/string/{path_string}/integer/{path_integer} - parameters: - - in: path - name: path_string - required: true - schema: - type: string - - in: path - name: path_integer - required: true - schema: - type: integer - responses: - '200': - description: Successful operation - content: - text/plain: - schema: - type: string - # form parameter tests - /form/integer/boolean/string: - post: - tags: - - form - summary: Test form parameter(s) - description: Test form parameter(s) - operationId: test/form/integer/boolean/string - requestBody: - content: - application/x-www-form-urlencoded: - schema: - type: object - properties: - integer_form: - type: integer - boolean_form: - type: boolean - string_form: - type: string - responses: - '200': - description: Successful operation - content: - text/plain: - schema: - type: string - # form parameter tests for oneOf schema - /form/oneof: - post: - tags: - - form - summary: Test form parameter(s) for oneOf schema - description: Test form parameter(s) for oneOf schema - operationId: test/form/oneof - requestBody: - content: - application/x-www-form-urlencoded: - schema: - type: object - oneOf: - - type: object - properties: - form1: - type: string - form2: - type: integer - - type: object - properties: - form3: - type: string - form4: - type: boolean - - $ref: '#/components/schemas/Tag' - responses: - '200': - description: Successful operation - content: - text/plain: - schema: - type: string - # header parameter tests - /header/integer/boolean/string: - get: - tags: - - header - summary: Test header parameter(s) - description: Test header parameter(s) - operationId: test/header/integer/boolean/string - parameters: - - in: header - name: integer_header - style: form #default - explode: true #default - schema: - type: integer - - in: header - name: boolean_header - style: form #default - explode: true #default - schema: - type: boolean - - in: header - name: string_header - style: form #default - explode: true #default - schema: - type: string - responses: - '200': - description: Successful operation - content: - text/plain: - schema: - type: string - # query parameter tests - /query/enum_ref_string: - get: - tags: - - query - summary: Test query parameter(s) - description: Test query parameter(s) - operationId: test/enum_ref_string - parameters: - - in: query - name: enum_ref_string_query - style: form #default - explode: true #default - schema: - $ref: '#/components/schemas/StringEnumRef' - responses: - '200': - description: Successful operation - content: - text/plain: - schema: - type: string - /query/datetime/date/string: - get: - tags: - - query - summary: Test query parameter(s) - description: Test query parameter(s) - operationId: test/query/datetime/date/string - parameters: - - in: query - name: datetime_query - style: form #default - explode: true #default - schema: - type: string - format: date-time - - in: query - name: date_query - style: form #default - explode: true #default - schema: - type: string - format: date - - in: query - name: string_query - style: form #default - explode: true #default - schema: - type: string - responses: - '200': - description: Successful operation - content: - text/plain: - schema: - type: string - /query/integer/boolean/string: - get: - tags: - - query - summary: Test query parameter(s) - description: Test query parameter(s) - operationId: test/query/integer/boolean/string - parameters: - - in: query - name: integer_query - style: form #default - explode: true #default - schema: - type: integer - - in: query - name: boolean_query - style: form #default - explode: true #default - schema: - type: boolean - - in: query - name: string_query - style: form #default - explode: true #default - schema: - type: string - responses: - '200': - description: Successful operation - content: - text/plain: - schema: - type: string - /query/style_form/explode_true/array_string: - get: - tags: - - query - summary: Test query parameter(s) - description: Test query parameter(s) - operationId: test/query/style_form/explode_true/array_string - parameters: - - in: query - name: query_object - style: form #default - explode: true #default - schema: - type: object - properties: - values: - type: array - items: - type: string - responses: - '200': - description: Successful operation - content: - text/plain: - schema: - type: string - /query/style_form/explode_true/object: - get: - tags: - - query - summary: Test query parameter(s) - description: Test query parameter(s) - operationId: test/query/style_form/explode_true/object - parameters: - - in: query - name: query_object - style: form #default - explode: true #default - schema: - $ref: '#/components/schemas/Pet' - responses: - '200': - description: Successful operation - content: - text/plain: - schema: - type: string - /query/style_form/explode_true/object/allOf: - get: - tags: - - query - summary: Test query parameter(s) - description: Test query parameter(s) - operationId: test/query/style_form/explode_true/object/allOf - parameters: - - in: query - name: query_object - style: form #default - explode: true #default - schema: - $ref: '#/components/schemas/DataQuery' - responses: - '200': - description: Successful operation - content: - text/plain: - schema: - type: string - /query/style_deepObject/explode_true/object: - get: - tags: - - query - summary: Test query parameter(s) - description: Test query parameter(s) - operationId: test/query/style_deepObject/explode_true/object - parameters: - - in: query - name: query_object - style: deepObject - explode: true #default - schema: - $ref: '#/components/schemas/Pet' - responses: - '200': - description: Successful operation - content: - text/plain: - schema: - type: string - /query/style_deepObject/explode_true/object/allOf: - get: - tags: - - query - summary: Test query parameter(s) - description: Test query parameter(s) - operationId: test/query/style_deepObject/explode_true/object/allOf - parameters: - - in: query - name: query_object - style: deepObject - explode: true #default - schema: - allOf: - - $ref: '#/components/schemas/Bird' - - $ref: '#/components/schemas/Category' - responses: - '200': - description: Successful operation - content: - text/plain: - schema: - type: string - # body parameter tests - /body/application/octetstream/binary: - post: - tags: - - body - summary: Test body parameter(s) - description: Test body parameter(s) - operationId: test/body/application/octetstream/binary - requestBody: - content: - application/octet-stream: - schema: - type: string - format: binary - responses: - '200': - description: Successful operation - content: - text/plain: - schema: - type: string - /echo/body/Pet: - post: - tags: - - body - summary: Test body parameter(s) - description: Test body parameter(s) - operationId: test/echo/body/Pet - requestBody: - $ref: '#/components/requestBodies/Pet' - responses: - '200': - description: Successful operation - content: - application/json: - schema: - $ref: '#/components/schemas/Pet' - /echo/body/Pet/response_string: - post: - tags: - - body - summary: Test empty response body - description: Test empty response body - operationId: test/echo/body/Pet/response_string - requestBody: - $ref: '#/components/requestBodies/Pet' - responses: - '200': - description: Successful operation - content: - text/plain: - schema: - type: string - /echo/body/Tag/response_string: - post: - tags: - - body - summary: Test empty json (request body) - description: Test empty json (request body) - operationId: test/echo/body/Tag/response_string - requestBody: - $ref: '#/components/requestBodies/Tag' - responses: - '200': - description: Successful operation - content: - text/plain: - schema: - type: string - /echo/body/FreeFormObject/response_string: - post: - tags: - - body - summary: Test free form object - description: Test free form object - operationId: test/echo/body/FreeFormObject/response_string - requestBody: - content: - application/json: - schema: - type: object - description: Free form object - responses: - '200': - description: Successful operation - content: - text/plain: - schema: - type: string - /binary/gif: - post: - tags: - - body - summary: Test binary (gif) response body - description: Test binary (gif) response body - operationId: test/binary/gif - responses: - '200': - description: Successful operation - content: - image/gif: - schema: - type: string - format: binary - # Array of binary in multipart mime tests - /body/application/octetstream/array_of_binary: - post: - tags: - - body - summary: Test array of binary in multipart mime - description: Test array of binary in multipart mime - operationId: test/body/multipart/formdata/array_of_binary - requestBody: - content: - multipart/form-data: - schema: - required: - - files - type: object - properties: - files: - type: array - items: - type: string - format: binary - responses: - '200': - description: Successful operation - content: - text/plain: - schema: - type: string - # To test http basic auth - /auth/http/basic: - post: - tags: - - auth - security: - - http_auth: [] - summary: To test HTTP basic authentication - description: To test HTTP basic authentication - operationId: test/auth/http/basic - responses: - '200': - description: Successful operation - content: - text/plain: - schema: - type: string -components: - securitySchemes: - http_auth: - type: http - scheme: basic - requestBodies: - Pet: - content: - application/json: - schema: - $ref: '#/components/schemas/Pet' - description: Pet object that needs to be added to the store - Tag: - content: - application/json: - schema: - $ref: '#/components/schemas/Tag' - description: Tag object - schemas: - Category: - type: object - properties: - id: - type: integer - format: int64 - example: 1 - name: - type: string - example: Dogs - xml: - name: category - Tag: - type: object - properties: - id: - type: integer - format: int64 - name: - type: string - xml: - name: tag - Pet: - required: - - name - - photoUrls - type: object - properties: - id: - type: integer - format: int64 - example: 10 - name: - type: string - example: doggie - category: - $ref: '#/components/schemas/Category' - photoUrls: - type: array - xml: - wrapped: true - items: - type: string - xml: - name: photoUrl - tags: - type: array - xml: - wrapped: true - items: - $ref: '#/components/schemas/Tag' - status: - type: string - description: pet status in the store - enum: - - available - - pending - - sold - xml: - name: pet - StringEnumRef: - type: string - enum: - - success - - failure - - unclassified - DefaultValue: - type: object - description: to test the default value of properties - properties: - array_string_enum_ref_default: - type: array - items: - $ref: '#/components/schemas/StringEnumRef' - default: - - success - - failure - array_string_enum_default: - type: array - items: - type: string - enum: - - success - - failure - - unclassified - default: - - success - - failure - array_string_default: - type: array - items: - type: string - default: - - failure - - skipped - array_integer_default: - type: array - items: - type: integer - default: - - 1 - - 3 - array_string: - type: array - items: - type: string - array_string_nullable: - nullable: true - type: array - items: - type: string - array_string_extension_nullable: - x-nullable: true - type: array - items: - type: string - string_nullable: - type: string - nullable: true - Bird: - type: object - properties: - size: - type: string - color: - type: string - Query: - type: object - x-parent: true - properties: - id: - type: integer - description: Query - format: int64 - outcomes: - type: array - items: - type: string - enum: - - SUCCESS - - FAILURE - - SKIPPED - default: - - SUCCESS - - FAILURE - DataQuery: - allOf: - - type: object - properties: - suffix: - type: string - description: test suffix - text: - type: string - description: Some text containing white spaces - example: "Some text" - date: - type: string - format: date-time - description: A date - - $ref: '#/components/schemas/Query' - NumberPropertiesOnly: - type: object - properties: - number: - type: number - # TODO: pydantic v2: this field name override the default `float` type - # If this property is uncommented, consider removing this file - # completely in favor of the parent echo_api.yaml file - #float: - #type: number - #format: float - double: - type: number - format: double - minimum: 0.8 - maximum: 50.2 diff --git a/modules/openapi-generator/src/test/resources/3_0/python/petstore-with-fake-endpoints-models-for-testing.yaml b/modules/openapi-generator/src/test/resources/3_0/python/petstore-with-fake-endpoints-models-for-testing.yaml index a38d3c60834..2894fded0d1 100644 --- a/modules/openapi-generator/src/test/resources/3_0/python/petstore-with-fake-endpoints-models-for-testing.yaml +++ b/modules/openapi-generator/src/test/resources/3_0/python/petstore-with-fake-endpoints-models-for-testing.yaml @@ -1649,12 +1649,11 @@ components: maximum: 543.2 minimum: 32.1 type: number - # TODO: pydantic v2: this field name override the default `float` type - #float: - #type: number - #format: float - #maximum: 987.6 - #minimum: 54.3 + float: + type: number + format: float + maximum: 987.6 + minimum: 54.3 double: type: number format: double diff --git a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/docs/NumberPropertiesOnly.md b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/docs/NumberPropertiesOnly.md index 7051e6165ac..709b3996be9 100644 --- a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/docs/NumberPropertiesOnly.md +++ b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/docs/NumberPropertiesOnly.md @@ -5,6 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **number** | **float** | | [optional] +**var_float** | **float** | | [optional] **double** | **float** | | [optional] ## Example diff --git a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/models/number_properties_only.py b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/models/number_properties_only.py index 23ed8e356fc..dd83b12cea2 100644 --- a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/models/number_properties_only.py +++ b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/models/number_properties_only.py @@ -29,8 +29,9 @@ class NumberPropertiesOnly(BaseModel): NumberPropertiesOnly """ number: Optional[Union[StrictFloat, StrictInt]] = None + var_float: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, alias="float") double: Optional[Union[Annotated[float, Field(le=50.2, strict=True, ge=0.8)], Annotated[int, Field(le=50, strict=True, ge=1)]]] = None - __properties: ClassVar[List[str]] = ["number", "double"] + __properties: ClassVar[List[str]] = ["number", "float", "double"] model_config = { "populate_by_name": True, @@ -76,6 +77,7 @@ class NumberPropertiesOnly(BaseModel): _obj = NumberPropertiesOnly.model_validate({ "number": obj.get("number"), + "float": obj.get("float"), "double": obj.get("double") }) return _obj diff --git a/samples/client/echo_api/python/docs/NumberPropertiesOnly.md b/samples/client/echo_api/python/docs/NumberPropertiesOnly.md index 7051e6165ac..709b3996be9 100644 --- a/samples/client/echo_api/python/docs/NumberPropertiesOnly.md +++ b/samples/client/echo_api/python/docs/NumberPropertiesOnly.md @@ -5,6 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **number** | **float** | | [optional] +**var_float** | **float** | | [optional] **double** | **float** | | [optional] ## Example diff --git a/samples/client/echo_api/python/openapi_client/models/number_properties_only.py b/samples/client/echo_api/python/openapi_client/models/number_properties_only.py index 5284b857019..0720150c100 100644 --- a/samples/client/echo_api/python/openapi_client/models/number_properties_only.py +++ b/samples/client/echo_api/python/openapi_client/models/number_properties_only.py @@ -29,8 +29,9 @@ class NumberPropertiesOnly(BaseModel): NumberPropertiesOnly """ number: Optional[Union[StrictFloat, StrictInt]] = None + var_float: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, alias="float") double: Optional[Union[Annotated[float, Field(le=50.2, strict=True, ge=0.8)], Annotated[int, Field(le=50, strict=True, ge=1)]]] = None - __properties: ClassVar[List[str]] = ["number", "double"] + __properties: ClassVar[List[str]] = ["number", "float", "double"] model_config = { "populate_by_name": True, @@ -71,6 +72,7 @@ class NumberPropertiesOnly(BaseModel): _obj = NumberPropertiesOnly.model_validate({ "number": obj.get("number"), + "float": obj.get("float"), "double": obj.get("double") }) return _obj diff --git a/samples/openapi3/client/petstore/python-aiohttp/docs/FakeApi.md b/samples/openapi3/client/petstore/python-aiohttp/docs/FakeApi.md index be5d5e850c7..5ffe9b3f068 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/docs/FakeApi.md +++ b/samples/openapi3/client/petstore/python-aiohttp/docs/FakeApi.md @@ -1120,7 +1120,7 @@ No authorization required [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **test_endpoint_parameters** -> test_endpoint_parameters(number, double, pattern_without_delimiter, byte, integer=integer, int32=int32, int64=int64, float=float, string=string, binary=binary, byte_with_max_length=byte_with_max_length, var_date=var_date, date_time=date_time, password=password, param_callback=param_callback) +> test_endpoint_parameters(number, double, pattern_without_delimiter, byte, integer=integer, int32=int32, int64=int64, var_float=var_float, string=string, binary=binary, byte_with_max_length=byte_with_max_length, var_date=var_date, date_time=date_time, password=password, param_callback=param_callback) Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 @@ -1164,7 +1164,7 @@ async with petstore_api.ApiClient(configuration) as api_client: integer = 56 # int | None (optional) int32 = 56 # int | None (optional) int64 = 56 # int | None (optional) - float = 3.4 # float | None (optional) + var_float = 3.4 # float | None (optional) string = 'string_example' # str | None (optional) binary = None # bytearray | None (optional) byte_with_max_length = None # bytearray | None (optional) @@ -1175,7 +1175,7 @@ async with petstore_api.ApiClient(configuration) as api_client: try: # Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 - await api_instance.test_endpoint_parameters(number, double, pattern_without_delimiter, byte, integer=integer, int32=int32, int64=int64, float=float, string=string, binary=binary, byte_with_max_length=byte_with_max_length, var_date=var_date, date_time=date_time, password=password, param_callback=param_callback) + await api_instance.test_endpoint_parameters(number, double, pattern_without_delimiter, byte, integer=integer, int32=int32, int64=int64, var_float=var_float, string=string, binary=binary, byte_with_max_length=byte_with_max_length, var_date=var_date, date_time=date_time, password=password, param_callback=param_callback) except Exception as e: print("Exception when calling FakeApi->test_endpoint_parameters: %s\n" % e) ``` @@ -1193,7 +1193,7 @@ Name | Type | Description | Notes **integer** | **int**| None | [optional] **int32** | **int**| None | [optional] **int64** | **int**| None | [optional] - **float** | **float**| None | [optional] + **var_float** | **float**| None | [optional] **string** | **str**| None | [optional] **binary** | **bytearray**| None | [optional] **byte_with_max_length** | **bytearray**| None | [optional] diff --git a/samples/openapi3/client/petstore/python-aiohttp/docs/FormatTest.md b/samples/openapi3/client/petstore/python-aiohttp/docs/FormatTest.md index 0f8e2aced58..4f1950492c0 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/docs/FormatTest.md +++ b/samples/openapi3/client/petstore/python-aiohttp/docs/FormatTest.md @@ -8,6 +8,7 @@ Name | Type | Description | Notes **int32** | **int** | | [optional] **int64** | **int** | | [optional] **number** | **float** | | +**var_float** | **float** | | [optional] **double** | **float** | | [optional] **decimal** | **decimal.Decimal** | | [optional] **string** | **str** | | [optional] diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/api/fake_api.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/api/fake_api.py index 31db62d60ae..ed2063c6ce3 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/api/fake_api.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/api/fake_api.py @@ -2079,7 +2079,7 @@ class FakeApi: _request_auth=_params.get('_request_auth')) @validate_call - async def test_endpoint_parameters(self, number : Annotated[float, Field(le=543.2, ge=32.1, description="None")], double : Annotated[float, Field(le=123.4, ge=67.8, description="None")], pattern_without_delimiter : Annotated[str, Field(strict=True, description="None")], byte : Annotated[Union[StrictBytes, StrictStr], Field(description="None")], integer : Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=10)]], Field(description="None")] = None, int32 : Annotated[Optional[Annotated[int, Field(le=200, strict=True, ge=20)]], Field(description="None")] = None, int64 : Annotated[Optional[StrictInt], Field(description="None")] = None, float : Annotated[Optional[Annotated[float, Field(le=987.6)]], Field(description="None")] = None, string : Annotated[Optional[Annotated[str, Field(strict=True)]], Field(description="None")] = None, binary : Annotated[Optional[Union[StrictBytes, StrictStr]], Field(description="None")] = None, byte_with_max_length : Annotated[Optional[Union[Annotated[bytes, Field(strict=True, max_length=64)], Annotated[str, Field(strict=True, max_length=64)]]], Field(description="None")] = None, var_date : Annotated[Optional[date], Field(description="None")] = None, date_time : Annotated[Optional[datetime], Field(description="None")] = None, password : Annotated[Optional[Annotated[str, Field(min_length=10, strict=True, max_length=64)]], Field(description="None")] = None, param_callback : Annotated[Optional[StrictStr], Field(description="None")] = None, **kwargs) -> None: # noqa: E501 + async def test_endpoint_parameters(self, number : Annotated[float, Field(le=543.2, ge=32.1, description="None")], double : Annotated[float, Field(le=123.4, ge=67.8, description="None")], pattern_without_delimiter : Annotated[str, Field(strict=True, description="None")], byte : Annotated[Union[StrictBytes, StrictStr], Field(description="None")], integer : Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=10)]], Field(description="None")] = None, int32 : Annotated[Optional[Annotated[int, Field(le=200, strict=True, ge=20)]], Field(description="None")] = None, int64 : Annotated[Optional[StrictInt], Field(description="None")] = None, var_float : Annotated[Optional[Annotated[float, Field(le=987.6)]], Field(description="None")] = None, string : Annotated[Optional[Annotated[str, Field(strict=True)]], Field(description="None")] = None, binary : Annotated[Optional[Union[StrictBytes, StrictStr]], Field(description="None")] = None, byte_with_max_length : Annotated[Optional[Union[Annotated[bytes, Field(strict=True, max_length=64)], Annotated[str, Field(strict=True, max_length=64)]]], Field(description="None")] = None, var_date : Annotated[Optional[date], Field(description="None")] = None, date_time : Annotated[Optional[datetime], Field(description="None")] = None, password : Annotated[Optional[Annotated[str, Field(min_length=10, strict=True, max_length=64)]], Field(description="None")] = None, param_callback : Annotated[Optional[StrictStr], Field(description="None")] = None, **kwargs) -> None: # noqa: E501 """Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 # noqa: E501 Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 # noqa: E501 @@ -2098,8 +2098,8 @@ class FakeApi: :type int32: int :param int64: None :type int64: int - :param float: None - :type float: float + :param var_float: None + :type var_float: float :param string: None :type string: str :param binary: None @@ -2127,10 +2127,10 @@ class FakeApi: if '_preload_content' in kwargs: message = "Error! Please call the test_endpoint_parameters_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 raise ValueError(message) - return await self.test_endpoint_parameters_with_http_info(number, double, pattern_without_delimiter, byte, integer, int32, int64, float, string, binary, byte_with_max_length, var_date, date_time, password, param_callback, **kwargs) # noqa: E501 + return await self.test_endpoint_parameters_with_http_info(number, double, pattern_without_delimiter, byte, integer, int32, int64, var_float, string, binary, byte_with_max_length, var_date, date_time, password, param_callback, **kwargs) # noqa: E501 @validate_call - async def test_endpoint_parameters_with_http_info(self, number : Annotated[float, Field(le=543.2, ge=32.1, description="None")], double : Annotated[float, Field(le=123.4, ge=67.8, description="None")], pattern_without_delimiter : Annotated[str, Field(strict=True, description="None")], byte : Annotated[Union[StrictBytes, StrictStr], Field(description="None")], integer : Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=10)]], Field(description="None")] = None, int32 : Annotated[Optional[Annotated[int, Field(le=200, strict=True, ge=20)]], Field(description="None")] = None, int64 : Annotated[Optional[StrictInt], Field(description="None")] = None, float : Annotated[Optional[Annotated[float, Field(le=987.6)]], Field(description="None")] = None, string : Annotated[Optional[Annotated[str, Field(strict=True)]], Field(description="None")] = None, binary : Annotated[Optional[Union[StrictBytes, StrictStr]], Field(description="None")] = None, byte_with_max_length : Annotated[Optional[Union[Annotated[bytes, Field(strict=True, max_length=64)], Annotated[str, Field(strict=True, max_length=64)]]], Field(description="None")] = None, var_date : Annotated[Optional[date], Field(description="None")] = None, date_time : Annotated[Optional[datetime], Field(description="None")] = None, password : Annotated[Optional[Annotated[str, Field(min_length=10, strict=True, max_length=64)]], Field(description="None")] = None, param_callback : Annotated[Optional[StrictStr], Field(description="None")] = None, **kwargs) -> ApiResponse: # noqa: E501 + async def test_endpoint_parameters_with_http_info(self, number : Annotated[float, Field(le=543.2, ge=32.1, description="None")], double : Annotated[float, Field(le=123.4, ge=67.8, description="None")], pattern_without_delimiter : Annotated[str, Field(strict=True, description="None")], byte : Annotated[Union[StrictBytes, StrictStr], Field(description="None")], integer : Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=10)]], Field(description="None")] = None, int32 : Annotated[Optional[Annotated[int, Field(le=200, strict=True, ge=20)]], Field(description="None")] = None, int64 : Annotated[Optional[StrictInt], Field(description="None")] = None, var_float : Annotated[Optional[Annotated[float, Field(le=987.6)]], Field(description="None")] = None, string : Annotated[Optional[Annotated[str, Field(strict=True)]], Field(description="None")] = None, binary : Annotated[Optional[Union[StrictBytes, StrictStr]], Field(description="None")] = None, byte_with_max_length : Annotated[Optional[Union[Annotated[bytes, Field(strict=True, max_length=64)], Annotated[str, Field(strict=True, max_length=64)]]], Field(description="None")] = None, var_date : Annotated[Optional[date], Field(description="None")] = None, date_time : Annotated[Optional[datetime], Field(description="None")] = None, password : Annotated[Optional[Annotated[str, Field(min_length=10, strict=True, max_length=64)]], Field(description="None")] = None, param_callback : Annotated[Optional[StrictStr], Field(description="None")] = None, **kwargs) -> ApiResponse: # noqa: E501 """Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 # noqa: E501 Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 # noqa: E501 @@ -2149,8 +2149,8 @@ class FakeApi: :type int32: int :param int64: None :type int64: int - :param float: None - :type float: float + :param var_float: None + :type var_float: float :param string: None :type string: str :param binary: None @@ -2198,7 +2198,7 @@ class FakeApi: 'integer', 'int32', 'int64', - 'float', + 'var_float', 'string', 'binary', 'byte_with_max_length', @@ -2252,8 +2252,8 @@ class FakeApi: if _params['number'] is not None: _form_params.append(('number', _params['number'])) - if _params['float'] is not None: - _form_params.append(('float', _params['float'])) + if _params['var_float'] is not None: + _form_params.append(('float', _params['var_float'])) if _params['double'] is not None: _form_params.append(('double', _params['double'])) diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/format_test.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/format_test.py index ee4069a8dd8..3f34bfd6570 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/format_test.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/format_test.py @@ -32,6 +32,7 @@ class FormatTest(BaseModel): int32: Optional[Annotated[int, Field(le=200, strict=True, ge=20)]] = None int64: Optional[StrictInt] = None number: Annotated[float, Field(le=543.2, ge=32.1)] + var_float: Optional[Annotated[float, Field(le=987.6, ge=54.3)]] = Field(default=None, alias="float") double: Optional[Annotated[float, Field(le=123.4, ge=67.8)]] = None decimal: Optional[Decimal] = None string: Optional[Annotated[str, Field(strict=True)]] = None @@ -44,7 +45,7 @@ class FormatTest(BaseModel): password: Annotated[str, Field(min_length=10, strict=True, max_length=64)] pattern_with_digits: Optional[Annotated[str, Field(strict=True)]] = Field(default=None, description="A string that is a 10 digit number. Can have leading zeros.") pattern_with_digits_and_delimiter: Optional[Annotated[str, Field(strict=True)]] = Field(default=None, description="A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01.") - __properties: ClassVar[List[str]] = ["integer", "int32", "int64", "number", "double", "decimal", "string", "string_with_double_quote_pattern", "byte", "binary", "date", "dateTime", "uuid", "password", "pattern_with_digits", "pattern_with_digits_and_delimiter"] + __properties: ClassVar[List[str]] = ["integer", "int32", "int64", "number", "float", "double", "decimal", "string", "string_with_double_quote_pattern", "byte", "binary", "date", "dateTime", "uuid", "password", "pattern_with_digits", "pattern_with_digits_and_delimiter"] @field_validator('string') def string_validate_regular_expression(cls, value): @@ -128,6 +129,7 @@ class FormatTest(BaseModel): "int32": obj.get("int32"), "int64": obj.get("int64"), "number": obj.get("number"), + "float": obj.get("float"), "double": obj.get("double"), "decimal": obj.get("decimal"), "string": obj.get("string"), diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/FormatTest.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/FormatTest.md index 0f8e2aced58..aa81e585952 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/FormatTest.md +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/FormatTest.md @@ -8,6 +8,7 @@ Name | Type | Description | Notes **int32** | **int** | | [optional] **int64** | **int** | | [optional] **number** | **float** | | +**float** | **float** | | [optional] **double** | **float** | | [optional] **decimal** | **decimal.Decimal** | | [optional] **string** | **str** | | [optional] diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/format_test.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/format_test.py index 4f1d18de768..a0abc32a659 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/format_test.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/format_test.py @@ -29,6 +29,7 @@ class FormatTest(BaseModel): int32: Optional[conint(strict=True, le=200, ge=20)] = None int64: Optional[StrictInt] = None number: confloat(le=543.2, ge=32.1) = Field(...) + float: Optional[confloat(le=987.6, ge=54.3)] = None double: Optional[confloat(le=123.4, ge=67.8)] = None decimal: Optional[condecimal()] = None string: Optional[constr(strict=True)] = None @@ -41,7 +42,7 @@ class FormatTest(BaseModel): password: constr(strict=True, max_length=64, min_length=10) = Field(...) pattern_with_digits: Optional[constr(strict=True)] = Field(None, description="A string that is a 10 digit number. Can have leading zeros.") pattern_with_digits_and_delimiter: Optional[constr(strict=True)] = Field(None, description="A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01.") - __properties = ["integer", "int32", "int64", "number", "double", "decimal", "string", "string_with_double_quote_pattern", "byte", "binary", "date", "dateTime", "uuid", "password", "pattern_with_digits", "pattern_with_digits_and_delimiter"] + __properties = ["integer", "int32", "int64", "number", "float", "double", "decimal", "string", "string_with_double_quote_pattern", "byte", "binary", "date", "dateTime", "uuid", "password", "pattern_with_digits", "pattern_with_digits_and_delimiter"] @validator('string') def string_validate_regular_expression(cls, value): @@ -123,6 +124,7 @@ class FormatTest(BaseModel): "int32": obj.get("int32"), "int64": obj.get("int64"), "number": obj.get("number"), + "float": obj.get("float"), "double": obj.get("double"), "decimal": obj.get("decimal"), "string": obj.get("string"), diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/docs/FormatTest.md b/samples/openapi3/client/petstore/python-pydantic-v1/docs/FormatTest.md index 0f8e2aced58..aa81e585952 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/docs/FormatTest.md +++ b/samples/openapi3/client/petstore/python-pydantic-v1/docs/FormatTest.md @@ -8,6 +8,7 @@ Name | Type | Description | Notes **int32** | **int** | | [optional] **int64** | **int** | | [optional] **number** | **float** | | +**float** | **float** | | [optional] **double** | **float** | | [optional] **decimal** | **decimal.Decimal** | | [optional] **string** | **str** | | [optional] diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/format_test.py b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/format_test.py index 994c52b26ac..5363f631196 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/format_test.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/format_test.py @@ -29,6 +29,7 @@ class FormatTest(BaseModel): int32: Optional[conint(strict=True, le=200, ge=20)] = None int64: Optional[StrictInt] = None number: confloat(le=543.2, ge=32.1, strict=True) = Field(...) + float: Optional[confloat(le=987.6, ge=54.3, strict=True)] = None double: Optional[confloat(le=123.4, ge=67.8, strict=True)] = None decimal: Optional[condecimal()] = None string: Optional[constr(strict=True)] = None @@ -42,7 +43,7 @@ class FormatTest(BaseModel): pattern_with_digits: Optional[constr(strict=True)] = Field(None, description="A string that is a 10 digit number. Can have leading zeros.") pattern_with_digits_and_delimiter: Optional[constr(strict=True)] = Field(None, description="A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01.") additional_properties: Dict[str, Any] = {} - __properties = ["integer", "int32", "int64", "number", "double", "decimal", "string", "string_with_double_quote_pattern", "byte", "binary", "date", "dateTime", "uuid", "password", "pattern_with_digits", "pattern_with_digits_and_delimiter"] + __properties = ["integer", "int32", "int64", "number", "float", "double", "decimal", "string", "string_with_double_quote_pattern", "byte", "binary", "date", "dateTime", "uuid", "password", "pattern_with_digits", "pattern_with_digits_and_delimiter"] @validator('string') def string_validate_regular_expression(cls, value): @@ -130,6 +131,7 @@ class FormatTest(BaseModel): "int32": obj.get("int32"), "int64": obj.get("int64"), "number": obj.get("number"), + "float": obj.get("float"), "double": obj.get("double"), "decimal": obj.get("decimal"), "string": obj.get("string"), diff --git a/samples/openapi3/client/petstore/python/docs/FakeApi.md b/samples/openapi3/client/petstore/python/docs/FakeApi.md index 5bd0489ae55..4a998d2c062 100644 --- a/samples/openapi3/client/petstore/python/docs/FakeApi.md +++ b/samples/openapi3/client/petstore/python/docs/FakeApi.md @@ -1120,7 +1120,7 @@ No authorization required [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **test_endpoint_parameters** -> test_endpoint_parameters(number, double, pattern_without_delimiter, byte, integer=integer, int32=int32, int64=int64, float=float, string=string, binary=binary, byte_with_max_length=byte_with_max_length, var_date=var_date, date_time=date_time, password=password, param_callback=param_callback) +> test_endpoint_parameters(number, double, pattern_without_delimiter, byte, integer=integer, int32=int32, int64=int64, var_float=var_float, string=string, binary=binary, byte_with_max_length=byte_with_max_length, var_date=var_date, date_time=date_time, password=password, param_callback=param_callback) Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 @@ -1164,7 +1164,7 @@ with petstore_api.ApiClient(configuration) as api_client: integer = 56 # int | None (optional) int32 = 56 # int | None (optional) int64 = 56 # int | None (optional) - float = 3.4 # float | None (optional) + var_float = 3.4 # float | None (optional) string = 'string_example' # str | None (optional) binary = None # bytearray | None (optional) byte_with_max_length = None # bytearray | None (optional) @@ -1175,7 +1175,7 @@ with petstore_api.ApiClient(configuration) as api_client: try: # Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 - api_instance.test_endpoint_parameters(number, double, pattern_without_delimiter, byte, integer=integer, int32=int32, int64=int64, float=float, string=string, binary=binary, byte_with_max_length=byte_with_max_length, var_date=var_date, date_time=date_time, password=password, param_callback=param_callback) + api_instance.test_endpoint_parameters(number, double, pattern_without_delimiter, byte, integer=integer, int32=int32, int64=int64, var_float=var_float, string=string, binary=binary, byte_with_max_length=byte_with_max_length, var_date=var_date, date_time=date_time, password=password, param_callback=param_callback) except Exception as e: print("Exception when calling FakeApi->test_endpoint_parameters: %s\n" % e) ``` @@ -1193,7 +1193,7 @@ Name | Type | Description | Notes **integer** | **int**| None | [optional] **int32** | **int**| None | [optional] **int64** | **int**| None | [optional] - **float** | **float**| None | [optional] + **var_float** | **float**| None | [optional] **string** | **str**| None | [optional] **binary** | **bytearray**| None | [optional] **byte_with_max_length** | **bytearray**| None | [optional] diff --git a/samples/openapi3/client/petstore/python/docs/FormatTest.md b/samples/openapi3/client/petstore/python/docs/FormatTest.md index 0f8e2aced58..4f1950492c0 100644 --- a/samples/openapi3/client/petstore/python/docs/FormatTest.md +++ b/samples/openapi3/client/petstore/python/docs/FormatTest.md @@ -8,6 +8,7 @@ Name | Type | Description | Notes **int32** | **int** | | [optional] **int64** | **int** | | [optional] **number** | **float** | | +**var_float** | **float** | | [optional] **double** | **float** | | [optional] **decimal** | **decimal.Decimal** | | [optional] **string** | **str** | | [optional] diff --git a/samples/openapi3/client/petstore/python/petstore_api/api/fake_api.py b/samples/openapi3/client/petstore/python/petstore_api/api/fake_api.py index 59b139c1e67..af719611c80 100755 --- a/samples/openapi3/client/petstore/python/petstore_api/api/fake_api.py +++ b/samples/openapi3/client/petstore/python/petstore_api/api/fake_api.py @@ -2335,14 +2335,14 @@ class FakeApi: _request_auth=_params.get('_request_auth')) @validate_call - def test_endpoint_parameters(self, number : Annotated[float, Field(le=543.2, strict=True, ge=32.1, description="None")], double : Annotated[float, Field(le=123.4, strict=True, ge=67.8, description="None")], pattern_without_delimiter : Annotated[str, Field(strict=True, description="None")], byte : Annotated[Union[StrictBytes, StrictStr], Field(description="None")], integer : Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=10)]], Field(description="None")] = None, int32 : Annotated[Optional[Annotated[int, Field(le=200, strict=True, ge=20)]], Field(description="None")] = None, int64 : Annotated[Optional[StrictInt], Field(description="None")] = None, float : Annotated[Optional[Annotated[float, Field(le=987.6, strict=True)]], Field(description="None")] = None, string : Annotated[Optional[Annotated[str, Field(strict=True)]], Field(description="None")] = None, binary : Annotated[Optional[Union[StrictBytes, StrictStr]], Field(description="None")] = None, byte_with_max_length : Annotated[Optional[Union[Annotated[bytes, Field(strict=True, max_length=64)], Annotated[str, Field(strict=True, max_length=64)]]], Field(description="None")] = None, var_date : Annotated[Optional[date], Field(description="None")] = None, date_time : Annotated[Optional[datetime], Field(description="None")] = None, password : Annotated[Optional[Annotated[str, Field(min_length=10, strict=True, max_length=64)]], Field(description="None")] = None, param_callback : Annotated[Optional[StrictStr], Field(description="None")] = None, **kwargs) -> None: # noqa: E501 + def test_endpoint_parameters(self, number : Annotated[float, Field(le=543.2, strict=True, ge=32.1, description="None")], double : Annotated[float, Field(le=123.4, strict=True, ge=67.8, description="None")], pattern_without_delimiter : Annotated[str, Field(strict=True, description="None")], byte : Annotated[Union[StrictBytes, StrictStr], Field(description="None")], integer : Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=10)]], Field(description="None")] = None, int32 : Annotated[Optional[Annotated[int, Field(le=200, strict=True, ge=20)]], Field(description="None")] = None, int64 : Annotated[Optional[StrictInt], Field(description="None")] = None, var_float : Annotated[Optional[Annotated[float, Field(le=987.6, strict=True)]], Field(description="None")] = None, string : Annotated[Optional[Annotated[str, Field(strict=True)]], Field(description="None")] = None, binary : Annotated[Optional[Union[StrictBytes, StrictStr]], Field(description="None")] = None, byte_with_max_length : Annotated[Optional[Union[Annotated[bytes, Field(strict=True, max_length=64)], Annotated[str, Field(strict=True, max_length=64)]]], Field(description="None")] = None, var_date : Annotated[Optional[date], Field(description="None")] = None, date_time : Annotated[Optional[datetime], Field(description="None")] = None, password : Annotated[Optional[Annotated[str, Field(min_length=10, strict=True, max_length=64)]], Field(description="None")] = None, param_callback : Annotated[Optional[StrictStr], Field(description="None")] = None, **kwargs) -> None: # noqa: E501 """Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 # noqa: E501 Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True - >>> thread = api.test_endpoint_parameters(number, double, pattern_without_delimiter, byte, integer, int32, int64, float, string, binary, byte_with_max_length, var_date, date_time, password, param_callback, async_req=True) + >>> thread = api.test_endpoint_parameters(number, double, pattern_without_delimiter, byte, integer, int32, int64, var_float, string, binary, byte_with_max_length, var_date, date_time, password, param_callback, async_req=True) >>> result = thread.get() :param number: None (required) @@ -2359,8 +2359,8 @@ class FakeApi: :type int32: int :param int64: None :type int64: int - :param float: None - :type float: float + :param var_float: None + :type var_float: float :param string: None :type string: str :param binary: None @@ -2390,17 +2390,17 @@ class FakeApi: if '_preload_content' in kwargs: message = "Error! Please call the test_endpoint_parameters_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 raise ValueError(message) - return self.test_endpoint_parameters_with_http_info(number, double, pattern_without_delimiter, byte, integer, int32, int64, float, string, binary, byte_with_max_length, var_date, date_time, password, param_callback, **kwargs) # noqa: E501 + return self.test_endpoint_parameters_with_http_info(number, double, pattern_without_delimiter, byte, integer, int32, int64, var_float, string, binary, byte_with_max_length, var_date, date_time, password, param_callback, **kwargs) # noqa: E501 @validate_call - def test_endpoint_parameters_with_http_info(self, number : Annotated[float, Field(le=543.2, strict=True, ge=32.1, description="None")], double : Annotated[float, Field(le=123.4, strict=True, ge=67.8, description="None")], pattern_without_delimiter : Annotated[str, Field(strict=True, description="None")], byte : Annotated[Union[StrictBytes, StrictStr], Field(description="None")], integer : Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=10)]], Field(description="None")] = None, int32 : Annotated[Optional[Annotated[int, Field(le=200, strict=True, ge=20)]], Field(description="None")] = None, int64 : Annotated[Optional[StrictInt], Field(description="None")] = None, float : Annotated[Optional[Annotated[float, Field(le=987.6, strict=True)]], Field(description="None")] = None, string : Annotated[Optional[Annotated[str, Field(strict=True)]], Field(description="None")] = None, binary : Annotated[Optional[Union[StrictBytes, StrictStr]], Field(description="None")] = None, byte_with_max_length : Annotated[Optional[Union[Annotated[bytes, Field(strict=True, max_length=64)], Annotated[str, Field(strict=True, max_length=64)]]], Field(description="None")] = None, var_date : Annotated[Optional[date], Field(description="None")] = None, date_time : Annotated[Optional[datetime], Field(description="None")] = None, password : Annotated[Optional[Annotated[str, Field(min_length=10, strict=True, max_length=64)]], Field(description="None")] = None, param_callback : Annotated[Optional[StrictStr], Field(description="None")] = None, **kwargs) -> ApiResponse: # noqa: E501 + def test_endpoint_parameters_with_http_info(self, number : Annotated[float, Field(le=543.2, strict=True, ge=32.1, description="None")], double : Annotated[float, Field(le=123.4, strict=True, ge=67.8, description="None")], pattern_without_delimiter : Annotated[str, Field(strict=True, description="None")], byte : Annotated[Union[StrictBytes, StrictStr], Field(description="None")], integer : Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=10)]], Field(description="None")] = None, int32 : Annotated[Optional[Annotated[int, Field(le=200, strict=True, ge=20)]], Field(description="None")] = None, int64 : Annotated[Optional[StrictInt], Field(description="None")] = None, var_float : Annotated[Optional[Annotated[float, Field(le=987.6, strict=True)]], Field(description="None")] = None, string : Annotated[Optional[Annotated[str, Field(strict=True)]], Field(description="None")] = None, binary : Annotated[Optional[Union[StrictBytes, StrictStr]], Field(description="None")] = None, byte_with_max_length : Annotated[Optional[Union[Annotated[bytes, Field(strict=True, max_length=64)], Annotated[str, Field(strict=True, max_length=64)]]], Field(description="None")] = None, var_date : Annotated[Optional[date], Field(description="None")] = None, date_time : Annotated[Optional[datetime], Field(description="None")] = None, password : Annotated[Optional[Annotated[str, Field(min_length=10, strict=True, max_length=64)]], Field(description="None")] = None, param_callback : Annotated[Optional[StrictStr], Field(description="None")] = None, **kwargs) -> ApiResponse: # noqa: E501 """Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 # noqa: E501 Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True - >>> thread = api.test_endpoint_parameters_with_http_info(number, double, pattern_without_delimiter, byte, integer, int32, int64, float, string, binary, byte_with_max_length, var_date, date_time, password, param_callback, async_req=True) + >>> thread = api.test_endpoint_parameters_with_http_info(number, double, pattern_without_delimiter, byte, integer, int32, int64, var_float, string, binary, byte_with_max_length, var_date, date_time, password, param_callback, async_req=True) >>> result = thread.get() :param number: None (required) @@ -2417,8 +2417,8 @@ class FakeApi: :type int32: int :param int64: None :type int64: int - :param float: None - :type float: float + :param var_float: None + :type var_float: float :param string: None :type string: str :param binary: None @@ -2468,7 +2468,7 @@ class FakeApi: 'integer', 'int32', 'int64', - 'float', + 'var_float', 'string', 'binary', 'byte_with_max_length', @@ -2523,8 +2523,8 @@ class FakeApi: if _params['number'] is not None: _form_params.append(('number', _params['number'])) - if _params['float'] is not None: - _form_params.append(('float', _params['float'])) + if _params['var_float'] is not None: + _form_params.append(('float', _params['var_float'])) if _params['double'] is not None: _form_params.append(('double', _params['double'])) diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/format_test.py b/samples/openapi3/client/petstore/python/petstore_api/models/format_test.py index 3879c053f66..469e4093b62 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/format_test.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/format_test.py @@ -32,6 +32,7 @@ class FormatTest(BaseModel): int32: Optional[Annotated[int, Field(le=200, strict=True, ge=20)]] = None int64: Optional[StrictInt] = None number: Annotated[float, Field(le=543.2, strict=True, ge=32.1)] + var_float: Optional[Annotated[float, Field(le=987.6, strict=True, ge=54.3)]] = Field(default=None, alias="float") double: Optional[Annotated[float, Field(le=123.4, strict=True, ge=67.8)]] = None decimal: Optional[Decimal] = None string: Optional[Annotated[str, Field(strict=True)]] = None @@ -45,7 +46,7 @@ class FormatTest(BaseModel): pattern_with_digits: Optional[Annotated[str, Field(strict=True)]] = Field(default=None, description="A string that is a 10 digit number. Can have leading zeros.") pattern_with_digits_and_delimiter: Optional[Annotated[str, Field(strict=True)]] = Field(default=None, description="A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01.") additional_properties: Dict[str, Any] = {} - __properties: ClassVar[List[str]] = ["integer", "int32", "int64", "number", "double", "decimal", "string", "string_with_double_quote_pattern", "byte", "binary", "date", "dateTime", "uuid", "password", "pattern_with_digits", "pattern_with_digits_and_delimiter"] + __properties: ClassVar[List[str]] = ["integer", "int32", "int64", "number", "float", "double", "decimal", "string", "string_with_double_quote_pattern", "byte", "binary", "date", "dateTime", "uuid", "password", "pattern_with_digits", "pattern_with_digits_and_delimiter"] @field_validator('string') def string_validate_regular_expression(cls, value): @@ -135,6 +136,7 @@ class FormatTest(BaseModel): "int32": obj.get("int32"), "int64": obj.get("int64"), "number": obj.get("number"), + "float": obj.get("float"), "double": obj.get("double"), "decimal": obj.get("decimal"), "string": obj.get("string"),