openapi-to-graphql icon indicating copy to clipboard operation
openapi-to-graphql copied to clipboard

Can't generate from Slack API

Open barlock opened this issue 6 years ago • 7 comments

Describe the bug When running a server from the published slack api, error is

OpenAPI-to-GraphQL creation event error:  (Patchable) schema type must not be an array

To Reproduce Steps to reproduce the behavior:

wget https://raw.githubusercontent.com/slackapi/slack-api-specs/master/web-api/slack_web_openapi_v2.json
npx openapi-to-graphql-cli slack_web_openapi_v2.json

Expected behavior Server should start.

A better error message would also work? The error suggests that the schema is patchable, but how?

barlock avatar Nov 06 '19 13:11 barlock

Thanks for reporting this issue! Actually, I am not sure what this error message means either. To be honest, I am quite backed up with a lot of work. If you would like to investigate this problem and help contribute to OtG, then I can get you started. In any case, thanks for reporting the issue.

Alan-Cha avatar Nov 06 '19 14:11 Alan-Cha

Guesses as to where its coming from? It doesn't seem to come from this project or graphql from a dumb sting matching search.

barlock avatar Nov 06 '19 14:11 barlock

Error was thrown by swagger2openapi.

Can be "fixed" by adding a patch: true to the conversion step

await Swagger2OpenAPI.convertObj(spec, { patch: true })

or, from the cli until a PR is made

npx swagger2openapi -p slack_web_openapi_v2.json --output slack_web_openapi_v2_patched.json

Once that goes through, the def falls through to the anyOf problem fixed by #232

barlock avatar Nov 06 '19 15:11 barlock

I'm also not very familiar with swagger so I'm uncertain of the consequences of auto-patching. Any ideas?

barlock avatar Nov 06 '19 15:11 barlock

Hey! Thanks for starting to look into it! Unfortunately, I am at a conference right now and it’s difficult for me to check until later today. Thanks for being proactive!

Alan-Cha avatar Nov 06 '19 19:11 Alan-Cha

Do we still anyone looking into this ? I could take a look at it and see how best to include the { patch : true } config optionally.

isocroft avatar May 13 '20 16:05 isocroft

@isocroft I don't think anyone is looking into this right now. If you want to give it a go, that would be amazing!

Alan-Cha avatar May 13 '20 19:05 Alan-Cha