Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. GraphQL
  3. swagger-to-graphql

swagger-to-graphql

MITTypeScript1.4.0

Convert Swagger/OpenAPI schemas to executable GraphQL schemas with resolvers that make HTTP calls to existing REST endpoints.

GitHubGitHub
922 stars145 forks0 contributors

What is swagger-to-graphql?

Swagger-to-GraphQL is a library that converts Swagger/OpenAPI schemas into executable GraphQL schemas. It solves the problem of migrating from REST to GraphQL by automatically generating GraphQL resolvers that perform HTTP calls to existing REST endpoints, enabling teams to maintain both API styles with minimal effort.

Target Audience

Backend and full-stack developers working with existing REST APIs who want to expose a GraphQL layer without rewriting backend services, particularly in organizations transitioning to GraphQL incrementally.

Value Proposition

Developers choose Swagger-to-GraphQL because it provides a zero-rewrite path to GraphQL adoption, full control over HTTP calls through customizable adapters, and support for both Swagger and OpenAPI 3 specifications with TypeScript readiness.

Overview

Swagger to GraphQL API adapter

Use Cases

Best For

  • Adding a GraphQL layer over legacy REST APIs without modifying backend code
  • Incrementally migrating from REST to GraphQL while maintaining both endpoints
  • Generating GraphQL schema definitions from existing OpenAPI specifications
  • Integrating multiple REST services into a unified GraphQL API
  • Prototyping GraphQL interfaces for existing REST-based microservices
  • Building federated GraphQL architectures with mixed REST and GraphQL services

Not Ideal For

  • APIs requiring real-time GraphQL subscriptions or WebSocket support
  • High-performance systems where HTTP overhead per resolver is unacceptable
  • Teams wanting a fully managed GraphQL solution with built-in caching and batching
  • Projects with poorly maintained or inaccurate Swagger schemas

Pros & Cons

Pros

Zero Backend Rewrites

Generates GraphQL schemas directly from existing Swagger/OpenAPI specs, allowing teams to expose GraphQL without modifying REST services, as emphasized in the README's value proposition.

Custom HTTP Control

Enables developers to use their own HTTP client via the callBackend function, providing full control over authentication, caching, and headers, as shown in the node-fetch and request-promise examples.

Dual Specification Support

Works with both Swagger (OpenAPI 2) and OpenAPI 3, covering a broad range of API documentation formats, which is a key feature highlighted in the README.

TypeScript Integration

Includes TypeScript types for improved developer experience and type safety, making it easier to integrate into modern TypeScript projects.

Cons

Performance Overhead

Each GraphQL resolver makes a separate HTTP call, which can lead to n+1 query problems and increased latency without manual optimization, a trade-off inherent in REST-to-GraphQL bridging.

Manual Adapter Complexity

Implementing custom HTTP adapters for non-standard APIs or complex authentication requires significant development effort, as the README admits with examples needing full client setup.

Limited GraphQL Features

Does not natively support GraphQL subscriptions or real-time updates, as it's tied to REST's request-response model, limiting advanced GraphQL use cases.

Frequently Asked Questions

Quick Stats

Stars922
Forks145
Contributors0
Open Issues25
Last commit3 years ago
CreatedSince 2016

Tags

#graphql#swagger#rest-to-graphql#cli-tool#typescript#openapi#api-adapter#http-client#schema-conversion#apollo-federation

Built With

E
Express
G
GraphQL
T
TypeScript
N
Node.js

Included in

GraphQL15.0k
Auto-fetched 19 hours ago

Related Projects

PrismaPrisma

Next-generation ORM for Node.js & TypeScript | PostgreSQL, MySQL, MariaDB, SQL Server, SQLite, MongoDB and CockroachDB

Stars47,378
Forks2,403
Last commit1 day ago
BitBit

AI-powered development workspaces with reusable components, architectural clarity and zero overhead.

Stars18,432
Forks956
Last commit1 day ago
AmplicationAmplication

Amplication brings order to the chaos of large-scale software development by creating Golden Paths for developers - streamlined workflows that drive consistency, enable high-quality code practices, simplify onboarding, and accelerate standardized delivery across teams.

Stars16,015
Forks1,547
Last commit24 days ago
graphql-code-generatorgraphql-code-generator

A tool for generating code based on a GraphQL schema and GraphQL operations (query/mutation/subscription), with flexible support for custom plugins.

Stars11,265
Forks1,395
Last commit1 day ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub