-
Notifications
You must be signed in to change notification settings - Fork 9k
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
feat(oas31): add support for file upload #10335
base: master
Are you sure you want to change the base?
Conversation
const isStringType = schema.get("type") === "string" | ||
const format = schema.get("format") | ||
const isBinaryFormat = format === "binary" | ||
const isBase64Format = format === "base64" || format === "byte" |
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.
Comment author @glowcloud:
Until now, we always checked for base64
format but not for byte
.
In 3.0.3, the data type for base64 encoded characters is byte
but when there are examples for file uploads, it specifies format: base64
.
In 3.0.4, the data type still specifies byte
and one of the examples specifies format: byte
. There is no example with format: base64
.
Not sure if we should just drop base64
.
const isBase64Encoding = schema.get("contentEncoding") === "base64" | ||
|
||
return ( | ||
(type === "string" || type === "any") && |
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.
Comment author @glowcloud:
If the type
is not specified, we will get type any
because there is no check for contentEncoding
or contentMediaType
when inferring types. I see that other types also don't have a check for all of the keywords that apply to them - not sure if that is intended or not, so I opted for checking for any
instead of adding them there.
We should now display file input when:
contentEncoding
isbase64
contentMediaType
isapplication/octet-stream
,image/*
,video/*
oraudio/*
Does not add support for file upload if schema has union type or if
type
andcontentEncoding/contentMediaType
are defined inoneOf/anyOf
.Attribution: @glowcloud