Skip to content

AmirF00/GraphQL_Converter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 

Repository files navigation

GraphQL Introspection Converter

A command-line tool to convert GraphQL introspection results into a human‑readable SDL (Schema Definition Language) file and generate a visual representation of your schema. The visual diagram is produced as an SVG and embedded in an HTML file with a legend, making it easy to understand complex GraphQL schemas at a glance.

Features

  • SDL Generation:
    Convert a GraphQL introspection JSON file into a clean, formatted .graphql file.

  • Visual Representation:
    Generate a scalable SVG diagram (embedded in an HTML file) that visually maps out the GraphQL schema.

    • Nodes are rendered as HTML tables with color-coded headers:
      • Light Blue: Object types
      • Light Green: Input types
      • Gold: Enum types
      • Light Gray: Scalar types
    • Edges (with labels indicating the field name and multiplicity) illustrate relationships between types.
    • For types with many fields, only a subset is displayed with an indication of additional fields.
  • Scalable & Robust:
    Uses Graphviz (via the Python graphviz package) to handle even large, complex schemas without running into text size limitations.

Prerequisites

  • Python 3.6+

  • Graphviz
    Install Graphviz on your system. For example, on macOS with Homebrew:

    brew install graphviz

    or

    pip install graphviz
  • Installation

    Clone the repository or download the script directly:

    git clone https://github.com/AmirF00/GraphQL_Converter.git
    cd GraphQL_Converter
  • Usage

    Run the converter script from the command line. The script accepts the following arguments:
    
      -f or --file: Path to the introspection JSON file.
      -o or --output: Path for the output SDL file (e.g., schema.graphql).
      -v or --visual (optional): If provided, the tool generates a visual representation (an SVG diagram and an HTML file embedding the SVG).
  • Examples

      python3 converter_v3.py -f ./introspection.json -o ./schema.graphql
      python3 converter_v3.py -f ./introspection.json -o ./schema.graphql -v
    

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages