Handle duplicate enum names in models by estebanthi · Pull Request #1802 · saleweaver/python-amazon-sp-api · GitHub
Skip to content

Handle duplicate enum names in models#1802

Merged
saleweaver merged 1 commit into
saleweaver:v2-01from
estebanthi:f/handle_duplicate_enum_names
Jul 1, 2025
Merged

Handle duplicate enum names in models#1802
saleweaver merged 1 commit into
saleweaver:v2-01from
estebanthi:f/handle_duplicate_enum_names

Conversation

@estebanthi

@estebanthi estebanthi commented Jul 1, 2025

Copy link
Copy Markdown

Provide context when generating enum names to avoid ending up with duplicate enums with wrong values.

Summary by Sourcery

Introduce model-context-aware enum name generation to prevent naming collisions by passing model context into property parsing and using a new helper method.

Bug Fixes:

  • Fix duplicate enum class names by including model context in enum naming to ensure enums have the correct values.

Enhancements:

  • Add _create_unique_enum_name method to build enum class names from combined model and property names.
  • Pass model_context argument to _parse_property when parsing both models and request models.
  • Replace direct enum name formatting with calls to _create_unique_enum_name in array and simple enum parsing.

@sourcery-ai

sourcery-ai Bot commented Jul 1, 2025

Copy link
Copy Markdown
Contributor

@saleweaver saleweaver merged commit 122772c into saleweaver:v2-01 Jul 1, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants