← Tools Home100% Client-Side

GraphQL SDL to JSON Schema & OpenAPI Converter

Convert GraphQL SDL schema definitions, types, queries, and mutations directly into standard JSON Schema Draft-07 and OpenAPI component schemas.

47 lines
Generated Schema Output
Types Parsed
5definitions
Fields Converted
20attributes
Schema Size
JSON Schema Draft-07
Technical Reference & Architecture Guide

GraphQL SDL to JSON Schema & OpenAPI Converter — Reference Guide

Convert GraphQL SDL schema definitions, types, queries, and mutations directly into standard JSON Schema Draft-07 and OpenAPI component schemas.

Key Parameters & Controls

schemaSdlstring

The raw GraphQL Schema Definition Language (SDL) source text defining types, inputs, enums, unions, queries, and mutations.

targetFormatstring

Target output schema specification format, such as 'json-schema-draft-07', 'json-schema-2020-12', 'openapi-3.0', or 'openapi-3.1'.

includeDirectivesboolean

Whether to translate custom GraphQL SDL directives (e.g., @deprecated, @description, validation rules) into standard schema keywords or extensions like 'x-graphql-directives'.

nullableFieldsStrategystring

Handling strategy for GraphQL nullable fields vs Non-Null ('!') types, mapping to JSON Schema 'type': ['string', 'null'] or OpenAPI 'nullable: true'.

Pro Tips & Best Practices

Common Gotchas & Troubleshooting

SyntaxError: Unexpected character / Unknown type during SDL parsing

Validate the SDL against standard GraphQL grammar specifications before conversion. Ensure all custom scalars (e.g., DateTime, JSON, UUID) are explicitly declared with 'scalar ScalarName' in the SDL.

Cyclic reference errors or infinite call stack crashes during schema generation

Disable inline schema recursion and enable reference-based generation with root '#/components/schemas' or '#/definitions' identifiers so circular structures resolve via JSON pointers.

OpenAPI 3.0 validation failures due to 'type: ["string", "null"]' constructs

Set the target format specifically to OpenAPI 3.0 to use 'type: string' paired with 'nullable: true', as multi-type arrays are unsupported prior to OpenAPI 3.1 and JSON Schema Draft-2020-12.

Frequently Asked Questions

▼

▼

▼

▼

Related Tools & Utilities

All Tools →