Skip to content

Description for url parameter #361

Answered by greyli
jrkoiter asked this question in Q&A
Discussion options

You must be logged in to vote

Create a schema for all the path/URL parameters, then set the input(location) to path:

class EnumPathParameter(Schema):
    image_type = String(validate=OneOf(['jpg', 'png', 'tiff', 'webp']))

@app.get('images/<image_type>')
    @app.input(EnumPathParameter, location='path')
    def index(image_type, path_data):
        pass

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@greyli
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by greyli
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants