Giter Club home page Giter Club logo

graphql-editor's Introduction

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 (
    <div
      style={{
        flex: 1,
        width: '100%',
        height: '100%',
        alignSelf: 'stretch',
        display: 'flex',
        position: 'relative',
      }}
    >
      <GraphQLEditor
        setSchema={(props) => {
          setMySchema(props);
        }}
        schema={mySchema}
      />
    </div>
  );
};

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 ( ||
    <div
      style={{
        flex: 1,
        width: '100%',
        height: '100%',
        alignSelf: 'stretch',
        display: 'flex',
        position: 'relative',
      }}
    >
      <GraphQLGqlEditor
        gql={gql}
        setGql={(gqlString) => setGql(gqlString)}
        schema={{ code: schema }}
      />
    </div>
  );
};

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 (
    <div
      style={{
        flex: 1,
        width: '100%',
        height: '100%',
        alignSelf: 'stretch',
        display: 'flex',
        position: 'relative',
      }}
    >
      <EmbeddedGraphQLEditor
        schema={{
          code: schemas.googleDirectionsNew,
          libraries: '',
        }}
      />
    </div>
  );
};

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

graphql-editor's People

Contributors

aexol avatar annalysiuk avatar c-rack avatar calinou avatar damianaexol avatar dennor avatar donroyco avatar hubertzubsh avatar hzub avatar iamrobmat avatar jedrekdabrowski avatar karolaexol avatar kkotelczuk avatar maciejkorsan avatar marcindadura avatar prawel avatar ris314 avatar sacro avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

graphql-editor's Issues

Types implementing interfaces should have fields of interface

Have the following graph:
selection_186
Which generates the following schema:

interface IElement{
	name: String!,
	id: ID!
}
type thing implements IElement{
	enabled: Boolean
}

But the way interfaces in GraphQL work is that fields of the interface should also be present in the implementation (https://graphql.org/learn/schema/#interfaces).
Hence, I think the schema should look something like this:

interface IElement{
	name: String!,
	id: ID!
}
type thing implements IElement{
	name: String!,
	id: ID!,
	enabled: Boolean
}

Pivot to a query creation?

I tried this tool and it's not a comfortable way for schema creation. You need to use mouse and keyboard.

I think that you may do a pivot and use it for QUERY creation. And it will be a really cool and comfortable tool. It's really to create the query only by mouse.

Add demo gif to README

Disclaimer: This is a bot

It looks like your repo is trending. The github_trending_videos Instgram account automatically shows the demo gifs of trending repos in Github.

Your README doesn't seem to have any demo gifs. Add one and the next time the parser runs it will pick it up and post it on its Instagram feed. If you don't want to just close this issue we won't bother you again.

add colours

Just like in atom editor add colours in code editor and match those colours with font in diagram.

UX improvements

On the left change the font to less intense and use more colours in diagram

Examples in demo

Wouldn't it be cool if on "Live Demo" you can see some real-world example schemas and not a blank grey empty window? I see you have a "Load File" maybe you can add some choices with real word examples in there, dropdown or something like that.

Logged user

When returning as a logged user I want to start in "My projects" tab

add import / export schema from file!

Sarkis Arutiunian 9:11 PM
I see 2 ways that this project may go, first one is prototyping, and visualization, kind of mockups.com for graphql, but it misses 2 main components, import/export of the schema.

Add Cypress to test editor frontend E2E

add tests to cypress folder for paths:

  • paste schema -> nodes match
  • create few nodes -> schema match
  • edit code -> schema match
  • load from url -> schema match

Load not working

Just tried to reload a model I had created this morning and... won't load. You can select the file, and it throws no errors, but the model just doesn't show up. I really love this editor and hope I'm just missing something!

I really appreciate you putting this software together. Even now when I can't load, I'm using it as a visual editor and for testing. Thanks for sharing with the community.

MacOS Mojave - tried Firefox and Safari

Import existing project to the editor

Hi! Amazing project, well done.

Is there a possibility to import existing GraphQL project and its schema to the graphql-editor?

If not - it will be great to provide a functionality which we can point a schema.json or a graphql endpoint url to the editor so that it can use introspection to draw an automatic graph (when using this feature it might be disabling automatic code generation?)

Thanks again!

Add support for Non-Null type modifier inside array

I have the following graph:
selection_185
This results in the following schema:

type type{
	number: [Int]!
}

But I marked number as required, not array. Hence, I think this be the generated schema:

type type{
	number: [Int!]
}

Crash: When linking "string" to "string" with both side

Hi, I know this is not a real problem. I'm that person who is trying this crazy stuff at first moment. I'm always doing this ๐Ÿ˜„
At first creating two string [string1, string2]
1
2. We're linking just one side of string1 to other string2
2
3. Then we're linking other side of string1 to string2
3

  1. When you try moving to string1 or string2 ta da
    ๐ŸŽ‰ Demo is crashed. And site freezing and turning to full white blank.

highlight the block with searched phrase

when searching a phrase the blocks that match should be somehow highlight e.g. border. Also when there is no match the user should be informed e.g. red semi transparent background on the right top map or red border on searching input

Enter url as path param

How it should work?

localhost:1569/?url=YOUR_URL

then it fires function controller.loadGraphQL and changes current projct to url link

[editor] Arguments tabs visibility

When there are no existing arguments, it would be cleaner to hide empty tabs in the argument section or hide whole section if there are no arguments at all.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.