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

Proposal: Allow register_blueprint option to name the Blueprint outside of Flask #567

Open
spra85 opened this issue Oct 13, 2023 · 1 comment

Comments

@spra85
Copy link

spra85 commented Oct 13, 2023

Would like to have the option to use a different, more user-friendly name for OpenAPI/Swagger UI Blueprints without needing to change the underlying Flask Blueprint name.

Currently, register_blueprint looks for the name option to be passed in and falls back on Blueprint.name (see: https://github.com/marshmallow-code/flask-smorest/blob/master/flask_smorest/blueprint.py#L180).

Suggestion, something like the below to add a docs_name option to use a different name from the name option, which is also used by the FlaskBlueprint and materially changes the actual route reference that might be used by Flask url_for.

blp_name = options.get("docs_name") or options.get("name", blueprint.name)

If this is an acceptable solution/idea, I can submit a PR. I could be misinterpreting the appropriate place for this change.

@lafrech
Copy link
Member

lafrech commented Apr 29, 2024

What is wrong about setting that user-friendly string as blueprint name?

I think this is what is do (although I don't put long sentences in there, generally a single work like "User" for the blueprint with user management routes).

The change you propose sounds reasonable but before adding API surface, I'd like to understand current limitation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants