marshmallow-code / marshmallow-code/flask-smorest

Add url_prefix for each blueprint

Open
#152 5 comments 0 reactions 0 assignees View on GitHub
question
Dominant language
Python
Stars
717
Forks
77
Avg merge
7h 49m
Merged PRs (30d)
3

Description

Hello,

I'm considering using flask-smorest for our api. I especially like the interaction with the marshmallow library and the rather simple handling of flask-smorest.
Nevertheless, while going through this library I noticed one thing:
Since flask-smorest seems to be based on creating blueprints that are added to an app/api, I don't have the possibility to create a blueprint with a fixed url_prefix and assign many possible namespaces to that blueprint (as in flask-restx). Here in flask-smorest the blueprints are a kind of namespace under which I define different routes with endpoints. But I would like to have the possibility to define a url_prefix for all blueprints without having to write it into every blueprint by hand. How do I do this as effective as possible so that I have to modify as little internal code of the library as possible?
How do I also get the url_prefix not to be displayed in swagger ui for each endpoint?

I don't want to add all blueprints to an app, but to a kind of layer that defines a prefix for all blueprints and then add this layer to the app. Furthermore, the prefix of this layer should not appear in every route in swagger, but should be present as a kind of base url for every route.

Many greetings

Contributor guide

Open the contributing guide

Research direction

Start by tracing how Flask blueprints are registered with the app/api and how Swagger UI generates endpoint URLs. Define the intended layer-level prefix behavior and verify that the prefix is represented as a base URL rather than repeated in each documented route; the issue provides no file or test entry point.

Written by the indexing model from the issue text.

Assessment

Tech stack
flask, openapi, python
Domain
api, backend, documentation
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.