ctardivo
6 years agoNew Member
RequestBody content media type not validating image extension
Hi,
I am building a ReSTful API using Python 3.5, Flask, Connexion and Swagger 3.0.
Writing the .yml swagger file I declared a POST method that accept an image with this code:
paths:
/myfunction:
post:
requestBody:
content:
image/png:
schema:
type: string
format: binary
What I expected using this code is to have a sort of input validation for the input file. However it seems that it works perfectly even with JPG and SVG files.
What are the main differences (if any) between
image/*
and
image/png
??
For sure I can implement a validation of the input file extension in the Python/Flask layer, however is it possible to enable this validation with the swagger specification?