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.

Cannot generate grapqhl schema for Stripe API

See original GitHub issue

Describe the bug Not able to generate Graphql Schema with openapi-to-graphql cli using Stripe’s API OAS definition

To Reproduce Steps to reproduce the behavior:

  1. install the openapi-to-graphql-cli
  2. try generating schema by running: openapi-to-graphql https://api.apis.guru/v2/specs/stripe.com/2019-03-14/swagger.json

Expected behavior The graphql server starts with generated Stripe API schema

Actual result Getting the following error:

openapi-to-graphql https://api.apis.guru/v2/specs/stripe.com/2019-03-14/swagger.json(node:54348) ExperimentalWarning: The http2 module is an experimental API.
OpenAPI-to-GraphQL creation event error:  Cannot read property 'schema' of null

Additional context Up to date latest OAS Stripe’s spec can be grabbed here: https://github.com/stripe/openapi/blob/master/openapi/spec3.json *same generation result as described above

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:5
  • Comments:26 (10 by maintainers)

github_iconTop GitHub Comments

4reactions
Alan-Chacommented, Jan 28, 2020

Hey everyone! I know this has been a very, very long awaited feature but it is finally out. We have support for allOf, anyOf, oneOf, and not as well as more robust fallback mechanisms and we can officially say that we can wrap the Stripe API in GraphQL with the release of OtG v2.0.0!

In the screenshot, you can see that we are able to successfully run a query against the Stripe API.

Stripe_GraphQL

Let me know what your experience is! Thanks for sticking around!

4reactions
Alan-Chacommented, Jul 9, 2019

I found the problem. OAS uses a few keywords to combine schemas, namely “oneOf”, “anyOf”, “allOf”, and “not”. Currently OtG only supports “allOf”. Stripe makes use of (at least) “anyOf”.

These keywords throw a wrench in the GraphQL ecosystem. Because GraphQL enforces a strong typing system and combining schemas muddles the typing. Implementing “allOf” is easy to do, but “oneOf” and “anyOf” are tricky, and “not” may be impossible (we will probably resort to stringifying the data or use the GraphQL JSON type). For more information, see #14.

For the time being, I have improved reporting with #199.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Convert the Stripe API into a GraphQL Schema with ... - StepZen
In a new blank project, create a directory called schema and create two files inside that directory called balance.graphql and charge.graphql ...
Read more >
Getting Stripe call to resolve in GraphQL schema
I am trying to create an API endpoint using GraphQL and stripe, however I can't get the data to resolve correctly with Stripe's...
Read more >
Open Source Stripe GraphQL API - Nhost
The generated Stripe GraphQL API can be hosted using a Serverless Function and added as a Hasura Remote Schema. After that, a GraphQL...
Read more >
Converting Stripes API to GraphQL - Table Dog
Converting Stripes HTTP API to GraphQL​​ The tdog CLI continuously downloads from your Stripe account and writes to your Postgres database. ...
Read more >
12. Create schema and resolver for creating a new Stripe ...
Learn # GraphQL, In One WeekBuild a fullstack eCommerce application with GraphQL Yoga, Prisma, Planetscale, Next.js, Tailwind CSS, & Stripe ...
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