yarax/swagger-to-graphql

Generator crashes on binary content

NickHardy opened this issue · 2 comments

I have an openapi specification which contains the following in a response:
"content": {
"application/octet-stream": {
"schema": {
"type": "string",
"format": "binary"
}
}
}

The generator fails in 'swagger.ts' line 50:
return successResponse.content['application/json'].schema;

Would be great to see it fixed so it won't fail.
Even better to add binary response support :)

0xR commented

That would be a file download. I wonder how that would make sense in GraphQL. The response of GraphQL will always be a json with { "data": { "myEndpoint: ..... } }. We could encode a file response as base64, but I think it makes more sense to use the underlying rest api directly without GraphQL.

Do other graphql servers implement file downloads?

I can't find much on graphql file download. so no problem leaving it out.

But it would be nice if the generator wouldn't fail.
Maybe just generate a comment about not supporting binary content.

This binary content is just a small portion of a big specification. so the rest would be nice to use in my graphql schema.