IBM / openapi-to-graphql

Translate APIs described by OpenAPI Specifications (OAS) into GraphQL
https://developer.ibm.com/open/projects/openapi-to-graphql/
MIT License
1.61k stars 211 forks source link

Error when createGraphQLSchema github rest api docs #470

Closed jihea-park closed 2 years ago

jihea-park commented 2 years ago

Describe the bug

I tried to convert github rest api openapi docs to graphql. https://raw.githubusercontent.com/github/rest-api-description/main/descriptions/api.github.com/api.github.com.json

But when I createGraphqlShcema, I got errors

/Users/user/Desktop/n3r/web-ui/node_modules/dist/openapi-to-graphql/src/schema_builder.js:353
    const itemsSchema = itemDef.schema;
                                ^
TypeError: Cannot read properties of undefined (reading 'schema')
    at createOrReuseList (/Users/user/Desktop/n3r/web-ui/node_modules/dist/openapi-to-graphql/src/schema_builder.js:353:33)
    at getGraphQLType (/Users/user/Desktop/n3r/web-ui/node_modules/dist/openapi-to-graphql/src/schema_builder.js:88:20)
    at getFieldForOperation (/Users/user/Desktop/n3r/web-ui/node_modules/dist/openapi-to-graphql/src/index.js:540:18)
    at addQueryFields (/Users/user/Desktop/n3r/web-ui/node_modules/dist/openapi-to-graphql/src/index.js:268:19)
    at /Users/user/Desktop/n3r/web-ui/node_modules/dist/openapi-to-graphql/src/index.js:153:13
    at Array.forEach (<anonymous>)
    at translateOpenAPIToGraphQL (/Users/user/Desktop/n3r/web-ui/node_modules/dist/openapi-to-graphql/src/index.js:149:37)
    at createGraphQLSchema (/Users/user/Desktop/n3r/web-ui/node_modules/dist/openapi-to-graphql/src/index.js:72:16)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)

what should I do?

To Reproduce Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem.

Additional context Add any other context about the problem here.

jihea-park commented 2 years ago

I got an answer by github. https://github.com/github/rest-api-description/issues/1330 So i'll close this issue. Thank you.