Bug Report Checklist
Description
After migrating from openapi-generator v5.4 to v7.16.0 (Docker image: openapitools/openapi-generator-cli:v7.16.0), the generated Python client's README example for string enum parameters no longer quotes the default value. In v5.4, the example showed:
order_by = "date_status_changed" # str | ... (default to "date_status_changed")
but in v7.16, the output is:
order_by = date_status_changed # str | ... (default to date_status_changed)
This is not valid Python and breaks copy-paste experience. There are no custom templates used.
openapi-generator version
Tested:
- v5.4 (previously worked as expected)
- v7.16.0 (regression)
OpenAPI declaration file content or url
openapi: 3.0.0
info:
title: Test Enum Default Value
version: 1.0.0
servers:
- url: https://api.example.com
paths:
/test:
get:
summary: Test endpoint with enum parameter
operationId: testEnum
parameters:
- name: order_by
in: query
schema:
type: string
enum:
- 'name'
- 'date_created'
- 'date_status_changed'
default: 'date_status_changed'
description: Test ordering parameter
responses:
'200':
description: Success
content:
application/json:
schema:
type: object
properties:
result:
type: string
Generation Details
docker run --rm -v "${PWD}:/local" openapitools/openapi-generator-cli:v7.16.0 generate -i /local/openapi.yaml -g python -o /local/test_client
Steps to reproduce
- Save the above OpenAPI YAML as openapi.yaml.
- Run the docker command above.
- Inspect the generated README (test_client/docs/DefaultApi.md) or example code. The
order_by parameter is shown as unquoted in the example assignment.
Related issues/PRs
But none specifically address the unquoted string default in Python README/example.
Suggest a fix
Enum parameter default values should be rendered as quoted strings in generated Python examples and documentation, restoring the previous correct behavior. Please update the template so string defaults are always quoted in the example assignment and README.
Bug Report Checklist
Description
After migrating from openapi-generator v5.4 to v7.16.0 (Docker image:
openapitools/openapi-generator-cli:v7.16.0), the generated Python client's README example for string enum parameters no longer quotes the default value. In v5.4, the example showed:but in v7.16, the output is:
This is not valid Python and breaks copy-paste experience. There are no custom templates used.
openapi-generator version
Tested:
OpenAPI declaration file content or url
Generation Details
docker run --rm -v "${PWD}:/local" openapitools/openapi-generator-cli:v7.16.0 generate -i /local/openapi.yaml -g python -o /local/test_clientSteps to reproduce
order_byparameter is shown as unquoted in the example assignment.Related issues/PRs
$ref#18843 (default not applied for $ref enum)But none specifically address the unquoted string default in Python README/example.
Suggest a fix
Enum parameter default values should be rendered as quoted strings in generated Python examples and documentation, restoring the previous correct behavior. Please update the template so string defaults are always quoted in the example assignment and README.