Skip to content

Fix consecutive-acronym handling in generated examples and apis/__init__.py - #3454

Open
pdv wants to merge 2 commits into
masterfrom
pdv/consecutive-acronyms
Open

Fix consecutive-acronym handling in generated examples and apis/__init__.py#3454
pdv wants to merge 2 commits into
masterfrom
pdv/consecutive-acronyms

Conversation

@pdv

@pdv pdv commented Apr 27, 2026

Copy link
Copy Markdown

Summary

Fixes broken imports in generated examples and apis/__init__.py when an OpenAPI tag contains consecutive acronyms (e.g. Bits AI SRE).

The library files themselves (bits_ai_sre_api.py) generate correctly because cli.py snake_cases the raw tag. But two places worked from a spaceless PascalCase form (BitsAISRE / BitsAISREApi) and re-snake_cased that, which produced bits_aisre_api.

Changes:

  • templates/apis.j2: snake_case the raw tag (loop variable api) instead of the class name.
  • templates/example.j2: import from raw_tag|safe_snake_case instead of name|safe_snake_case.
  • .generator/conftest.py: stash the raw tag in context["api_instance"] so templates can use it.

Behavior is unchanged for any tag without consecutive acronyms.

Test plan

  • Run ./generate.sh locally with "Bits AI SRE" tag

Links

@pdv
pdv marked this pull request as ready for review April 27, 2026 17:41
@pdv
pdv requested review from a team as code owners April 27, 2026 17:41
@github-actions

Copy link
Copy Markdown

This PR has been automatically marked as stale because it has not had activity in the last 30 days.
If there is no activity for another 90 days, this issue will be automatically closed.

@github-actions github-actions Bot added the stale label May 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant