marshmallow-code / marshmallow-code/flask-smorest

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

Open
#567 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Python
Stars
717
Forks
77
Avg merge
7h 49m
Merged PRs (30d)
3

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in flask_smorest/blueprint.py at the register_blueprint implementation referenced by the issue. Review how the current name option is selected, then verify that a separate documentation name can be supplied without changing the underlying Flask Blueprint name or its route references.

Written by the indexing model from the issue text.

Assessment

Tech stack
flask, openapi, python
Domain
api
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.