graphqlviz

package module
v0.0.0-...-3c65dfc Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 3, 2021 License: MIT Imports: 11 Imported by: 0

README

GraphQLViz

An application that reads a graphql schema and generates an interactive visualization of the relations between objects in the schema.

Installation

cd cmd/graphqlviz && go install

Usage

To visualize some schema files either pipe them to graphqlviz or pass as arguments.

cat *.graphql | graphqlviz
graphqlviz query.graphql mutation.graphql

By default graphqlviz will open a browser to display the graph however using -f text-based representations of the graph will be printed instead.

Optionally -defaultScalars can be used to add Time and Int64 scalars to the schema before parsing.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Edge

type Edge struct {
	// Node that the edge is pointing to.
	Node string
	// Label is the label for the edge.
	Label string
}

Edges are the relations between types in the schema.

type Graph

type Graph struct {
	// Nodes are the types in the Schema.
	Nodes map[string][]*Edge
}

Graph represents a parsed GraphQL schema and has methods to print different representations of it.

func NewGraph

func NewGraph(sdl io.Reader, includeDefaultScalars bool) (*Graph, error)

NewGraph returns a graph from the provided GraphQL schema. If includeDefaultScalars is true, default Int64 and Time scalars will be added to the schema.

func (*Graph) DotNotation

func (g *Graph) DotNotation() string

DotNotation returns a dot-language representation of the graph. https://graphviz.org/doc/info/lang.html

func (*Graph) MermaidNotation

func (g *Graph) MermaidNotation() string

MermaidNotation returns a mermaid-language representation of the graph. https://mermaid-js.github.io/mermaid/#/

func (*Graph) MermaidWeb

func (g *Graph) MermaidWeb()

MermaidWeb generates a mermaid representation of the graph, starts a web server to serve the diagram, and opens the browser to the web page.

func (*Graph) Orphans

func (g *Graph) Orphans() []string

Orphans returns the set of nodes in the graph that are not connected to any other node by an edge.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL