Take any OpenAPI Specification (OAS) or Swagger and create a GraphQL interface
Introduction to project
Many organizations have built REST APIs in the last years to provide access to their business resources. Client applications typically pick and choose among these resources, and care about the relationships between them. GraphQL is an emerging technology to build the next generation of APIs.
GraphQL allows clients to write queries that precisely control which resources to retrieve or mutate, no matter if they wish to select only small parts of a single resource or large sets of related resources. GraphQL thus grants clients unprecedented flexibility in interacting with an API, without the API provider having to enable this flexibility on a per-client basis.
OpenAPI-to-GraphQL is a library that helps providers leverage existing REST APIs to use this exciting new technology. Taking as input Swagger or OpenAPI Specifications of existing REST APIs, OpenAPI-to-GraphQL autogenerates a GraphQL interface that resolves client queries by translating them into REST API requests. It is the fastest way to get started with GraphQL, without spending any effort to implement a GraphQL API manually. OpenAPI-to-GraphQL takes care of many challenges like sanitizing data to work with GraphQL or enabling authentication, while also providing advanced features like enabling deeply nested queries within a single or even across multiple REST APIs based on link definitions in an OpenAPI Specification.
Why should a developer contribute?
To date, we have added many enhancements including security, better data cleansing, error reporting, the very cool ability to override auto-generated resolvers and provide custom ones instead, and multi-OAS support to create GraphQL interfaces across APIs. We also have backlog that is community driven, such as requests for GraphQL subscriptions, more granular authentication models, and enhancements to the CLI.
We know that OAS 3.0.0 is rich, and we haven’t seen all the use cases yet. As the community experiments and finds gaps, we welcome their contributions to make OpenAPI-to-GraphQL more usable and robust. Please open issues and better yet, we welcome pull requests with fixes or new solutions for those issues.
What business problems does the project address?
OpenAPI-to-GraphQL helps you leverage REST APIs that are available in the enterprise and build mobile and client applications quicker. In a matter of minutes, you can create a GraphQL interface with a valid OAS and experience this new technology.