Skip to content
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

Generator crashes on binary content #156

Open
NickHardy opened this issue Nov 13, 2019 · 2 comments
Open

Generator crashes on binary content #156

NickHardy opened this issue Nov 13, 2019 · 2 comments

Comments

@NickHardy
Copy link

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
Copy link
Collaborator

0xR commented Nov 27, 2019

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?

@NickHardy
Copy link
Author

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.

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

No branches or pull requests

2 participants