OpenAPI / Swagger

image

This handler allows you to load remote or local OpenAPI (2/3) and Swagger schemas. Based on OpenAPI-to-GraphQL.

You can import it using remote/local .json or .yaml.

To get started, install the handler library from NPM:

$ yarn add @graphql-mesh/openapi

Now, you can use it directly in your Mesh config file:

sources:
- name: MyOpenapiApi
handler:
openapi:
source: ./my-schema.json

We have a lot of examples for OpenAPI Handler;

Config API Reference

  • source (type: String, required) - A pointer to your API source - could be a local file, remote file or url endpoint
  • operationHeaders (type: JSON) - JSON object representing the Headers to add to the runtime of the API calls
  • schemaHeaders (type: JSON) - If you are using a remote URL endpoint to fetch your schema, you can set headers for the HTTP request to fetch your schema.
  • baseUrl (type: String) - Specifies the URL on which all paths will be based on. Overrides the server object in the OAS.
  • skipSchemaValidation (type: Boolean) - Skip OpenAPI 3 Schema Validation