All Projects → schwer → graphql-to-openapi

schwer / graphql-to-openapi

Licence: MIT license
Convert a graphql query + graphql schema into an openapi spec.

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to graphql-to-openapi

swaggerhub-cli
SwaggerHub CLI
Stars: ✭ 28 (-9.68%)
Mutual labels:  openapi
openapi-petstore
The pet store sample
Stars: ✭ 35 (+12.9%)
Mutual labels:  openapi
ApiCenter
A repository for all your API specifications
Stars: ✭ 26 (-16.13%)
Mutual labels:  openapi
open-api-mocker
A mock server based in OpenAPI Specification
Stars: ✭ 58 (+87.1%)
Mutual labels:  openapi
douyin-go
抖音SDK
Stars: ✭ 73 (+135.48%)
Mutual labels:  openapi
apiclarity
Reconstruct Open API Specifications from real-time workload traffic seamlessly.
Stars: ✭ 290 (+835.48%)
Mutual labels:  openapi
fusio-docker
Official docker container of Fusio an open source API management system
Stars: ✭ 25 (-19.35%)
Mutual labels:  openapi
OpenDocumenter
OpenDocumenter is a automatic documentation generator for OpenAPI v3 schemas. Simply provide your schema file in JSON or YAML, then sit back and enjoy the documentation.
Stars: ✭ 137 (+341.94%)
Mutual labels:  openapi
openapi
GitHub's official OpenAPI spec with Octokit extensions
Stars: ✭ 24 (-22.58%)
Mutual labels:  openapi
openapi-ui
React based OpenAPI 3.0+ documentation generator
Stars: ✭ 32 (+3.23%)
Mutual labels:  openapi
lodata
The OData v4.01 Producer for Laravel
Stars: ✭ 40 (+29.03%)
Mutual labels:  openapi
wapiml
An OpenAPI round-trip tool that leverages model-driven techniques to create, visualize, manage, and generate OpenAPI definitions.
Stars: ✭ 61 (+96.77%)
Mutual labels:  openapi
bow-openapi
🌐 Functional HTTP client generator from an OpenAPI/Swagger specification.
Stars: ✭ 47 (+51.61%)
Mutual labels:  openapi
openapimux
Open API router in go
Stars: ✭ 21 (-32.26%)
Mutual labels:  openapi
starling-developer-sdk
The official JavaScript development kit for building on the Starling API
Stars: ✭ 45 (+45.16%)
Mutual labels:  openapi
falcon-apispec
apispec plugin that generates OpenAPI specification (aka Swagger Docs) for Falcon web applications.
Stars: ✭ 44 (+41.94%)
Mutual labels:  openapi
Tavis.OpenApi
Parser for OpenAPI Specification
Stars: ✭ 18 (-41.94%)
Mutual labels:  openapi
Swiftgger
OpenAPI support for server side Swift projects.
Stars: ✭ 97 (+212.9%)
Mutual labels:  openapi
fastapi-azure-auth
Easy and secure implementation of Azure AD for your FastAPI APIs 🔒 B2C, single- and multi-tenant support.
Stars: ✭ 174 (+461.29%)
Mutual labels:  openapi
ApiFramework
Everything is an (Open)API
Stars: ✭ 26 (-16.13%)
Mutual labels:  openapi

graphql-to-openapi

NPM Known Vulnerabilities codecov

GraphQL → OpenAPI

Convert a graphql query + graphql schema into an openapi spec.

Demo

Not to be confused with the obviously more useful openapi-to-graphql.

Usage via CLI

npx graphql-to-openapi --yaml --schema <schemaFilename> --query <queryFilename>

GraphQL → OpenAPI

Unknown Scalar Configuration via the CLI

Unknown scalars are scalar types in the graphql schema that do not obviously map to an openapi type.

The default behavior for unknown scalars is to treat them as string types in the output openapi schema. If you desire to override that behavior, supply a scalar config file to the graphq-to-openapi tool:

Example CLI usage:

npx graphql-to-openapi --scalarConfigFile myScalarConfig.json --yaml --schema <schemaFilename> --query <queryFilename>

---

myScalarConfig.json:
{
  "DateTimeScalar": {
    "type": "string",
    "description": "YYYY-MM-DD date",
    "example": "2017-01-01",
    "format": "date",
    "pattern": "YYYY-MM-DD",
    "minLength": 0,
    "maxLength": 10
  }
}

Usage as a module

import { graphqlToOpenApi } from 'graphql-to-openapi';

const { error, openApiSchema, queryErrors, schemaError } = graphqlToOpenApi({
  schema,
  query,
});

// error will contain any graphql-to-openapi errors if they exist.
// graphql-to-openapi only throws an error if you've failed to name
// the input query. The name of the input query is used to define the
// openapi route name.

// schemaError is an error in the parsing of the input schema.

// queryErrors are errors associated with parsing and validating the input query.
// This includes any validation issues when matching the query with the schema.

// openApiSchema will contain the deserialized openapi schema for the
// specified query.

For Developers contributing to this project

To get started:

  1. Clone the github repo git clone [email protected]/schwer/graphql-to-openapi
  2. npm install // install dependencies
  3. npm run test:watch

Updating the documentation:

  1. The docs subdirectory contains a create-react-app.
  2. cd docs && npm run start
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].