-
Notifications
You must be signed in to change notification settings - Fork 40
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
Only swagger generation for end-point #83
Comments
Hi there! A clarifying question so that I better understand the desire - are you referring to wanting to use the Marshmallow validators and have those requirements displayed within Swagger or something else? |
Hey @apryor6 |
@vladarefiev @apryor6 hey guys, I'm interesting in this topic as well. The main problem to me is that I cannot pass some extra params to def get_context():
return {'request': flask.request}
class Resource(...):
@responds(schema=WidgetSchema, schema_context=get_context, api=api)
def post(self):
pass and somewhere under the hood: def get_create_schema(schema_class, schema_context):
return schema_class(...., context=schema_context()) wdyt? |
let's just add |
I need |
oops, sure, I meant |
Ah okay now I follow you - thanks for the example. I think your implementation about is exactly what I would suggest. If you want to contribute an implementation with supporting tests, I would be happy to review and accept a PR. |
Started implementation and realized that we can pass an instance of schema to the decorator, so it's not a problem to pass context into constructor directly. as well as |
That’s probably the simplest approach - does it fully resolve this issue, or is there a case where you might need schema construction to happen at request time outside of what can be dynamic via the context param? |
@apryor6 yes, at least it's good to automatically update the schema context with query params
so that wdyt? |
Hello @apryor6 .
I am happy using this library, but sometimes I want to do something before validation, for example pass context to Marshmallow Schema, but I still want to generate swagger for this API.
I'd like to contribute to the library implementing such functionality. What is the best way to do it to your opinion?
accepts
andresponds
decorators withvalidate: bool
param.@swagger
just for generation swagger spec.What do you think?
The text was updated successfully, but these errors were encountered: