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 Blueprint.route() #2

Closed
DerManoMann opened this issue Jun 17, 2021 · 7 comments
Closed

Add support for Blueprint.route() #2

DerManoMann opened this issue Jun 17, 2021 · 7 comments

Comments

@DerManoMann
Copy link

While I am at it ...

The application I am working on makes extensive use of the blueprint route() method, so adding support for that in APIBlueprint would make a potential integration at lot easier.

Thanks for all the work!

@luolingchun
Copy link
Owner

APIBlueprint inherited from Blueprint, so i think you can use the route() method directly .

but it doesn't work for swagger...

@DerManoMann
Copy link
Author

Yes, that is the point. I am not quite sure what the difference is between route() and individual methods like get(), but I suppose it should be possible to override it in APIBlueprint?
That would also avoid having to refactor in cases where an endpoint supports more than one HTTP methods...

@luolingchun
Copy link
Owner

This library focuses more on RESTful APIs and OpenAPI docs.

@DerManoMann
Copy link
Author

I am sorry, this answer doesn't make sense to me. Why is that different for OpenAPI docs whether a route is registered my route() vs. get()? (As mentioned, I am not clear about the difference between the two, but both can server JSON, XML or whatever and can support different auth schemes...?)

@DerManoMann
Copy link
Author

DerManoMann commented Jun 17, 2021

I did some more digging. The API docs state that get() is a shortcut for route() with methods=["GET"]
From: https://flask.palletsprojects.com/en/2.0.x/api/#flask.Blueprint.get

However, the library does not support using route(), so that is why I am asking.

@luolingchun
Copy link
Owner

luolingchun commented Jun 19, 2021

We can make it for swagger. But if you specify two HTTP methods in route()(e.g. GET, POST), you'll get two API with same parameters in swagger,it feels weird.

I think get for query resources and post for created . Why don't we use get and post separately to make things easier?

@ghost
Copy link

ghost commented Jun 21, 2021

Fair enough.

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

No branches or pull requests

2 participants