From fb5c769dc2c105e9c69f4a7478d15f749e96e3c8 Mon Sep 17 00:00:00 2001 From: m32 Date: Sun, 26 Oct 2025 22:04:37 +0100 Subject: [PATCH 1/2] allow tag override --- openapi_python_client/config.py | 3 +++ openapi_python_client/parser/openapi.py | 7 ++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/openapi_python_client/config.py b/openapi_python_client/config.py index 21cb4d182..0d16d55bd 100644 --- a/openapi_python_client/config.py +++ b/openapi_python_client/config.py @@ -40,6 +40,7 @@ class ConfigFile(BaseModel): project_name_override: Optional[str] = None package_name_override: Optional[str] = None package_version_override: Optional[str] = None + tag_override: Optional[dict[str, str]] = None use_path_prefixes_for_title_model_names: bool = True post_hooks: Optional[list[str]] = None docstrings_on_attributes: bool = False @@ -70,6 +71,7 @@ class Config: project_name_override: Optional[str] package_name_override: Optional[str] package_version_override: Optional[str] + tag_override: Optional[dict[str, str]] use_path_prefixes_for_title_model_names: bool post_hooks: list[str] docstrings_on_attributes: bool @@ -112,6 +114,7 @@ def from_sources( project_name_override=config_file.project_name_override, package_name_override=config_file.package_name_override, package_version_override=config_file.package_version_override, + tag_override=config_file.tag_override, use_path_prefixes_for_title_model_names=config_file.use_path_prefixes_for_title_model_names, post_hooks=post_hooks, docstrings_on_attributes=config_file.docstrings_on_attributes, diff --git a/openapi_python_client/parser/openapi.py b/openapi_python_client/parser/openapi.py index 7b0ff691c..ffbae9a88 100644 --- a/openapi_python_client/parser/openapi.py +++ b/openapi_python_client/parser/openapi.py @@ -64,7 +64,12 @@ def from_data( if operation is None: continue - tags = [utils.PythonIdentifier(value=tag, prefix="tag") for tag in operation.tags or ["default"]] + tags = [] + for tag in operation.tags or ["default"]: + tag_ = config.tag_override.get(tag, None) + if not tag_: + tag_ = utils.PythonIdentifier(value=tag, prefix="tag") + tags.append(tag_) if not config.generate_all_tags: tags = tags[:1] From b651bcedf674aa96c7f11d9cdff556c192cae89f Mon Sep 17 00:00:00 2001 From: m32 Date: Sun, 26 Oct 2025 22:05:18 +0100 Subject: [PATCH 2/2] include xml as standard response --- openapi_python_client/parser/bodies.py | 2 ++ openapi_python_client/parser/responses.py | 1 + 2 files changed, 3 insertions(+) diff --git a/openapi_python_client/parser/bodies.py b/openapi_python_client/parser/bodies.py index 7d0b12954..899464cfb 100644 --- a/openapi_python_client/parser/bodies.py +++ b/openapi_python_client/parser/bodies.py @@ -87,6 +87,8 @@ def body_from_data( body_type = BodyType.FILES elif simplified_content_type == "application/octet-stream": body_type = BodyType.CONTENT + elif simplified_content_type == "application/xml": + body_type = BodyType.CONTENT elif simplified_content_type == "application/json" or simplified_content_type.endswith("+json"): body_type = BodyType.JSON else: diff --git a/openapi_python_client/parser/responses.py b/openapi_python_client/parser/responses.py index 704a35f2d..a48cfe994 100644 --- a/openapi_python_client/parser/responses.py +++ b/openapi_python_client/parser/responses.py @@ -139,6 +139,7 @@ def _source_by_content_type(content_type: str, config: Config) -> Optional[_Resp known_content_types = { "application/json": JSON_SOURCE, "application/octet-stream": BYTES_SOURCE, + "application/xml": BYTES_SOURCE, } source = known_content_types.get(parsed_content_type) if source is None and parsed_content_type.endswith("+json"):