Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Support for customizing how nested names are generated #305

Merged
merged 1 commit into from
Apr 24, 2023

Conversation

AndreasBBS
Copy link
Contributor

In the normal behavior the nested models are suffixed with the parent model name. This merge allows to override that behavior in the Spectree class. For example:

spec = SpecTree(
    nested_naming_strategy=lambda _, child: child 
)

…ames

✨ feat(types.py): add NestedNamingStrategy type alias
✨ feat(spec.py): add nested_naming_strategy parameter to SpecTree constructor and get_model_schema method
✨ feat(utils.py): add get_nested_key function to generate nested model reference names
The changes add support for nested model reference names in Spectree. A new type alias, NestedNamingStrategy, is added to _types.py. SpecTree constructor and get_model_schema method in spec.py now accept a new parameter, nested_naming_strategy, which is used to generate nested model reference names. get_nested_key function is added to utils.py to generate nested model reference names.
Copy link
Member

@kemingy kemingy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution! 🎉

@kemingy kemingy added this pull request to the merge queue Apr 24, 2023
@kemingy kemingy removed this pull request from the merge queue due to a manual request Apr 24, 2023
@kemingy kemingy merged commit 69fe8e0 into 0b01001001:master Apr 24, 2023
@kemingy kemingy linked an issue Apr 24, 2023 that may be closed by this pull request
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.

Feature Request: Remove Duplicate Schema Components
2 participants