Skip to content

feat: Support multipart requests#6276

Open
marikaner wants to merge 2 commits intomainfrom
multipart
Open

feat: Support multipart requests#6276
marikaner wants to merge 2 commits intomainfrom
multipart

Conversation

@marikaner
Copy link
Contributor

This PR adds the capability to use formdata in the openapi requestbuilder.

`Could not parse '${allMediaTypes}', because it is not supported. Generation will continue with 'any'. This might lead to errors at runtime.`
);
return { type: 'any' };
return { schema: { type: 'any' }, mediaType: 'application/json ' };
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return { schema: { type: 'any' }, mediaType: 'application/json ' };
return { schema: { type: 'any' }, mediaType: 'application/json' };

Comment on lines +192 to +197
const formData = new FormData();
for (const key in body) {
// TODO: is it enough to just append the body[key] or does it need to be stringified?
formData.append(key, body[key]);
}
return formData;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The parquet API requires filenames (formData.append(key, body[key], 'name.parquet');). One way to avoid this issue would be to use File (which supports filenames).

We also need to consider using the form-data package which has wide support for streaming input data.

const schema = mediaType?.schema;
if (schema) {
return parseSchema(schema, refs, options);

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIRC the spec has some rules for inferring the media type, otherwise we should perhaps keep the media type optional (also to avoid breaking changes).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants