How to Use Schema with Path Parameter?
See original GitHub issueIn the example below, I am trying to figure out how to use the ClientSchema
to correctly document and validate ClientResource.get
. Is this possible?
ma = flask_marshmallow.Marshmallow()
class ClientSchema(ma.SQLAlchemyAutoSchema):
class Meta:
model = Client
clientId = ma.auto_field(description='The ID of the client',
required=True,
validate=validate.Range(min=1))
)
@bp.route('/<int:clientId>')
class ClientResource(MethodView):
def get(self, *args, **kwargs):
pass
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Describing Parameters - Swagger
In OpenAPI, a path parameter is defined using in: path . ... To describe the parameter contents, you can use either the schema...
Read more >Path Parameters - FastAPI
You can declare the type of a path parameter in the function, using standard Python type ... And because the generated schema is...
Read more >OpenAPI Path Parameters referencing Component Properties
1 Answer 1 · Put the $ref inside the parameter schema . · Replace #components with #/components . · Enclose the reference values...
Read more >API Schemas – Path, Query, and Body parameters - Encore.dev
Path parameters are specified by the path field in the //encore:api annotation. To specify a placeholder variable, use :name and add a function...
Read more >SET PATH - Db2 SQL - IBM
SET CURRENT PATH = , 1 schema-name SYSTEM PATH SESSION_USER USER CURRENT PATH CURRENT PACKAGE PATH host-variable string-constant.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
My example above should do what you want.
I understand the will to centralize.
I’d choose my way other yours because sending clientId twice to the view func kinda sucks while my method only leaves a bit of documentation in the call to route which is not that bad.
Yours should work too.
I did think that the parameter converters could be employed to solve this issue, but I’m not familiar with werkzeug so really don’t know how to do this.