Skip to content

[PYTHON-LEGACY] Use programmer-provided Configuration() objects when possible #8499

@adpoliak

Description

@adpoliak
Description

The generated PACKAGENAME.configuration.Configuration() class has means of persisting options via its set_default() class method.
However, in order for the persisted options to be used on future instances, the Configuration.get_default_copy() class method must be used instead of the Configurator() constructor.
This isn't currently done in any of the generated models, so the programmer is unable to override self.local_vars_configuration.client_side_validation to help deal with non-conforming server responses.
Updating the Python templates to use the get_default_copy() class method solves this.

openapi-generator version

5.0.1-SNAPSHOT (commit 3d23b99)

OpenAPI declaration file content or url

https://bitwarden.com/help/api/specs/public/swagger.json (relevant to why I'm working with openapi-generator, but unrelated to the issue itself)

Command line used for generation
PYTHON_POST_PROCESS_FILE="/opt/local/bin/yapf -i" \
java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generate --skip-validate-spec \
-i ../PROJECT/input/swagger.json -g python-legacy -o ../PROJECT --enable-post-process-file \
--library=asyncio --verbose --package-name=PACKAGE_NAME --git-host=GIT-SERVER --git-user-id=GIT-USER \
--git-repo-id=GIT-REPO-ID --additional-properties=hideGenerationTimestamp=false,projectName=PROJECT_NAME
Steps to reproduce

Generate the API Client with the existing templates

Related issues/PRs

N/A

Suggest a fix/enhancement

The Contributing Guidelines say to submit an issue before submitting a PR.
It will be submitted shortly.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions