MCPcopy Index your code
hub / github.com/graphql-editor/graphql-editor

github.com/graphql-editor/graphql-editor @7.3.1 sqlite

repository ↗ · DeepWiki ↗ · release 7.3.1 ↗
369 symbols 1,120 edges 215 files 0 documented · 0%
README

GraphQLEditor Editor

Graph sorcery, that makes reading GraphQL schemas easier!

License stars npm npm downloads Twitter

Website  |   Docs

graphql-editor-gif

GraphQLEditor makes it easier to understand GraphQL schemas. Create a schema by using visual blocks system. GraphQL Editor will transform them into code.

With GraphQL Editor you can create visual diagrams without writing any code or present your schema in a nice way!

How it works

Create GraphQL nodes and connect them to generate a database schema. You can also use builtin text IDE with GraphQL syntax validation

💡 What is GraphQL Editor?

GraphQL Editor is Graph based system for reading and designing the GraphQL schema

GraphQL Editor is a GraphQL visualizer and designer. It allows you to create and display GraphQL schemas as a visual graph.

🚀 Features

  • Visual GraphQL Editing.
  • GraphQL Monaco based IDE
  • Selection observer. When node is clicked in visual Graph it automatically scrolls the code to the same node. When cursor is moved in code space
  • Automatically bound interfaces. When interface is implemented on type fields of the interface add to the type. If it is already implemented editing interface edits all implementing nodes
  • Writing,generating and displaying GraphQL Documentation in markdown. Generating GraphQL docs out of GraphQL descriptions in markdown
  • Comparing different versions of GraphQL schemas with special node-sort sorting nodes and its fields to show the real difference in GraphQL Schema on AST omitting line numbers

Table of contents

License

MIT

Installation

npm i -D worker-loader css-loader file-loader webpack
npm i  graphql-editor react react-dom monaco-editor @monaco-editor/react

GraphQL SDL Editor

Usage

import React, { useState } from 'react';
import { render } from 'react-dom';
import { GraphQLEditor, PassedSchema } from 'graphql-editor';

const schemas = {
  pizza: `
type Query{
    pizzas: [Pizza!]
}
`,
  pizzaLibrary: `
type Pizza{
  name:String;
}
`,
};

export const App = () => {
  const [mySchema, setMySchema] = useState<PassedSchema>({
    code: schemas.pizza,
    libraries: schemas.pizzaLibrary,
  });
  return (



      <GraphQLEditor
        setSchema={(props) => {
          setMySchema(props);
        }}
        schema={mySchema}
      />



  );
};

render(<App />, document.getElementById('root'));

GraphQLEditor component props

GraphQLEditor

property type description required default
schema PassedSchema value of the schema true
setSchema (props: PassedSchema, isInvalid?: boolean) => void; Function to be called when schema is set by the editor true
readonly boolean lock editing false false
diffSchemas Record<string, string> Record containing graphql schemas with "name" as a key and graphql schema as a "value" false
theme EditorTheme current theme MainTheme
routeState EditorRoutes listen to route changes. Don't bind it with routeState though! false
onStateChange ( r: EditorRoutes ) => void; on route state changed false
onTreeChange (tree: ParserTree) => void Function that could be fired if tree changes false
placeholder string placeholder - empty editor false

PassedSchema

property type description
code string value of the schema code
libraries string value of the current libraries

ActivePane

"relation" | "diagram" | "diff"

GraphQL Gql Editor

Usage

import React, { useState } from 'react';
import { render } from 'react-dom';
import { GraphQLEditor, PassedSchema } from 'graphql-editor';

const schema = `
type Query{
    pizzas: [Pizza!]
}
`;

export const App = () => {
  const [gql, setGql] = useState('');
  return ( ||



      <GraphQLGqlEditor
        gql={gql}
        setGql={(gqlString) => setGql(gqlString)}
        schema={{ code: schema }}
      />



  );
};

render(<App />, document.getElementById('root'));

GraphQLGqlEditor component props

GraphQLEditor

property type description required default
schema PassedSchema value of the schema true
gql string value of the gql true
placeholder string placeholder - empty editor false undefined
setGql (props: PassedSchema, isInvalid?: boolean) => void; set value of the gql true undefined
readonly boolean lock editing false false
theme EditorTheme current theme false MainTheme

GraphQL Embedded Readonly Editor

If you only want to view the schema and embed it somewhere in your app you can use our embedded editor for that reason

import React from 'react';
import { EmbeddedGraphQLEditor } from 'graphql-editor';
import * as schemas from '../schema';

export const embeddedEditor = () => {
  return (



      <EmbeddedGraphQLEditor
        schema={{
          code: schemas.googleDirectionsNew,
          libraries: '',
        }}
      />



  );
};

Support

Join our Discord Channel

Team

GraphQL Editor Website

Underlying Parsing technology

Whole graphql-editor parsing stuff is based on underlying zeus technology.

GraphQL Tutorials

Interactive GraphQL Tutorial

GraphQL Blog

Authors

Extension points exported contracts — how you extend this code

NumberNode (Interface)
(no doc)
packages/editor-worker/src/tsAlgo.ts
Theme (Interface)
(no doc)
packages/editor/emotion.d.ts
NumberConnection (Interface)
(no doc)
packages/editor-worker/src/tsAlgo.ts
DiffEditorProps (Interface)
(no doc)
packages/editor/src/DiffEditor/index.tsx
RelativeNumberConnection (Interface)
(no doc)
packages/editor-worker/src/worker/validation.worker.ts
DocsElementI (Interface)
(no doc)
packages/editor/src/Docs/DocsElement.tsx
ArgumentsListI (Interface)
(no doc)
packages/editor/src/Docs/ArgumentsList.tsx
FieldsListI (Interface)
(no doc)
packages/editor/src/Docs/FieldsList.tsx

Core symbols most depended-on inside this repo

dataIt
called by 36
packages/editor/src/Models/dataIds.ts
setTree
called by 19
packages/editor/src/state/containers/trees/index.ts
updateNode
called by 15
packages/editor/src/state/containers/trees/index.ts
isExtensionNode
called by 13
packages/editor/src/GraphQL/Resolve/Extension.tsx
hideMenu
called by 8
packages/editor/src/Graf/Node/ActiveNode/TopNodeMenu.tsx
set
called by 7
packages/editor/src/state/containers/router.ts
validate
called by 6
packages/editor-worker/src/worker/index.ts
buildBridgeForProviders
called by 6
packages/editor/src/editor/code/guild/editor/EnrichedLanguageService.ts

Shape

Function 270
Interface 68
Method 21
Class 8
Enum 2

Languages

TypeScript100%

Modules by API surface

packages/editor/src/state/containers/trees/index.ts21 symbols
packages/editor/src/editor/code/guild/editor/EnrichedLanguageService.ts10 symbols
packages/editor/src/Graf/utils/packer.ts10 symbols
packages/editor-worker/src/elk-api.ts10 symbols
packages/editor/src/editor/code/guild/editor/utils.ts9 symbols
packages/editor/src/GraphQL/Resolve/Resolve.tsx9 symbols
packages/editor/src/shared/hooks/useDomManager.ts8 symbols
packages/editor/src/editor/files/SingleFile.tsx8 symbols
packages/editor-worker/src/worker/index.ts8 symbols
packages/editor-worker/src/tsAlgo.ts8 symbols
packages/editor-worker/src/validation.ts7 symbols
packages/editor/src/shared/hooks/manageDomNode.ts6 symbols

Dependencies from manifests, versioned

@aexol-studio/hooks0.2.8 · 1×
@aexol-studio/styling-system0.2.26 · 1×
@babel/core7.15.5 · 1×
@emotion/react11.9.3 · 1×
@emotion/styled11.9.3 · 1×
@monaco-editor/react4.5.2 · 1×
@qix/elkjs-patched0.8.0-patch3 · 1×
@svgr/core6.5.1 · 1×
@types/classnames2.3.0 · 1×
@types/d37.4.0 · 1×
@types/diff5.0.2 · 1×

For agents

$ claude mcp add graphql-editor \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact