cancel
Showing results for 
Search instead for 
Did you mean: 

RequestBody content media type not validating image extension

New 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?

1 REPLY 1
Moderator

Re: RequestBody content media type not validating image extension

Hi there! It looks like this question is more specific to Connexion's interpretation of the media type described. As Connexion is not one of our tools, we'd recommend filing a ticket in their repo.

New Here?
Join us and watch the welcome video:
Watch the New Interview
APITestingMistake#2
Top Kudoed Authors