Skip to content

Adding support for multiple apis in one app#1

Open
petraszd wants to merge 9 commits intomasterfrom
adding-support-for-multiple-apis-in-one-app
Open

Adding support for multiple apis in one app#1
petraszd wants to merge 9 commits intomasterfrom
adding-support-for-multiple-apis-in-one-app

Conversation

@petraszd
Copy link
Copy Markdown
Collaborator

@petraszd petraszd commented Nov 25, 2022

DO NOT MERGE

This PR is created here just to collect feadback.

Comment thread flask_smorest/__init__.py Outdated
:param Flask app: Flask application
:param spec_kwargs: kwargs to pass to internal APISpec instance
:param str config_prefix: Should be used if the user is planning to use
multiple `Api`'s in the single app. If it is not empty then
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

in a single app

return flask.render_template(
"swagger_ui.html",
title=self.spec.title,
spec_url=flask.url_for(f"{self._get_doc_blueprint_name()}.openapi_json"),
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

would those name always be url safe?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

The only restriction to a blueprint's name is that period ('.') is not allowed. And config_prefix will not work with period either.

Comment thread flask_smorest/utils.py Outdated
return getattr(ctx, "config_prefix", "") + key


def get_config_value(app, ctx, key, default=None):
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

should we always use named params when calling this? The calls look a bit weird

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Good idea. It is not fully clear if app or ctx is suppose to go first.

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