-
Notifications
You must be signed in to change notification settings - Fork 42
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
OpenAPI 3 / 3.1 handling of binary content #550
Comments
Thanks for reporting @PaulStryck, will check |
Hey @PaulStryck, mind adding what's the expected result here? |
Thanks for looking into it. I would expect to get Currently these type annotations are produced:
when using the following OpenAPI spec:
with the following OpenAPI spec: {
"openapi": "3.1.0",
"info": {
"version": "1.0.0",
"title": "Test",
"license": {
"name": "Apache 2.0",
"identifier": "Apache-2.0"
}
},
"servers": [
{
"url": "http://localhost"
}
],
"paths": {
"/foo": {
"get": {
"responses": {
200: {
"description": "get foo",
"content": {
"image/png": {
"schema": {
- "type": "file
+ "type": "string",
+ "contentMediaType": "image/png",
+ "contentEncoding": "base64"
}
}
}
}
}
}
},
"/bar": {
"get": {
"responses": {
200: {
"description": "get bar",
"content": {
"application/zip": {
- "schema": {
- "type": "file"
- }
}
}
}
}
}
}
}
} Any response object with an omitted schema object for a "file like" mime type should generate a |
Description
OpenAPI 3 has dropped the file type. It looks like this is not reflected here.
When using
type: file
in a schema:the corresponding typescript type is created as
(Blob | File)
. Which is the expected behaviour for OpenApi v2 but the above is not a valid OpenAPI 3 / 3.1 spec as thetype: file
is not supported anymore.In OpenAPI 3:
Or use
type: string
withcontentEncoding
keyword.However, this will generate typescript types of either
unknown
orstring
.OpenAPI specification (optional)
Configuration
No response
System information (optional)
No response
The text was updated successfully, but these errors were encountered: