-
-
Notifications
You must be signed in to change notification settings - Fork 228
fix: Support multipart requests with type: array #452
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
fix: Support multipart requests with type: array #452
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, thanks for fixing this so quick! I'll wait to hear back from the reporters before merging, in case they had something else in mind.
I'm still having the issue if I try to generate a client from this YAML (I've writted it manually and I'm not an OpenAPI expert so maybe there are conceptual mistakes): openapi: 3.0.2
info:
title: ''
version: ''
paths:
/api/media/upload-file/:
post:
operationId: uploadFile
requestBody:
content:
multipart/form-data:
schema:
properties:
file:
type: string
format: binary
responses:
'200':
content:
application/json:
schema:
properties:
filename:
type: string
maxLength: 128
required:
- filename
description: '' |
@slamora Ok, this is a slightly different issue, and a more complicated one! TLDR; if you add Your schema is valid, because As it currently stands, your schema says: "this could be anything, but if it's an object, it must have these properties". Unfortunately we don't have code to handle this case, so we just interpret this schema as simply "this could be anything" and ignore the
|
Thanks @csymeonides-mf for your tip! I guess that it's a very uncommon situation so the effort to support it doesn't compensate. As reminder, I've created this YAML by hand to be able to reproduce the issue so it's and edge case that AFAIK doesn't exist on a real environment. IMHO, you can follow with the PR merge workflow. |
Excellent, sounds like the major issue is solved here then! Thanks again for fixing this so quickly! |
Fixes #451 though perhaps a better "fix" would be to disallow multipart request bodies with
type: array
?