question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to convert Swagger 2.0 to GraphQL

See original GitHub issue

I’m currently using swagger-to-graphql and was hoping I could easily replace it with openapi-to-graphql. I replaced the createSchema call with createGraphQLSchema and hoped for the best.

I got this error when I ran it: UnhandledPromiseRejectionWarning: Could not convert Swagger to OpenAPI Specification. (Patchable) parameter.type is mandatory for non-body parameters

I’m using a Swagger 2.0 object and calling: const { schema, report } = await createGraphQLSchema(swaggerObject);

Is there something I’m doing wrong?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
florin-f-maneacommented, May 5, 2021

Sorry, should be: const { schema, report } = await createGraphQLSchema(swaggerObject, {swagger2OpenAPIOptions: { patch: true } });

0reactions
KolbySiskcommented, May 5, 2021

That appears to have worked, ty @florin-f-manea!

Seems the documentation could benefit by having this included.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Not able to convert swagger openapi spec to GraphQL #64
Describe the bug oasgraph cli was not able to convert openapi spec to GraphQL To Reproduce oasgraph openapi.json Expected behavior GraphQL ...
Read more >
Start with GraphQL today by converting your Swagger schema
This will execute queries using the generated GraphQL schema, whereas the default Apollo configuration assumes a remote GraphQL server.
Read more >
IBM/openapi-to-graphql - Gitter
I have recently started working on converting an existing swagger 2.0 spec to graphql schema, Does openapi-to-graphql currently support ...
Read more >
How can I run OpenAPI -> GraphQL conversion?
If your OAS (or swagger) is properly formed You can quickly have a GraphQL interface up and running in minutes.
Read more >
GraphQL schema basics - Apollo GraphQL Docs
Your GraphQL server uses a schema to describe the shape of your available data ... If ! appears outside the square brackets, the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found