MyGit

graphql-kit/graphql-voyager

Fork: 516 Star: 7819 (更新于 2024-12-11 20:55:40)

license: MIT

Language: TypeScript .

🛰️ Represent any GraphQL API as an interactive graph

最后发布版本: v2.0.0 ( 2023-08-09 06:46:09)

官方网址 GitHub网址

GraphQL Voyager

graphql-voyager logo

Represent any GraphQL API as an interactive graph. It's time to finally see the graph behind GraphQL. You can also explore number of public GraphQL APIs from our list.

With graphql-voyager you can visually explore your GraphQL API as an interactive graph. This is a great tool when designing or discussing your data model. It includes multiple example GraphQL schemas and also allows you to connect it to your own GraphQL endpoint. What are you waiting for, explore your API!

GraphQL Weekly #42

Live Demo

voyager demo

Features

  • Quick navigation on graph
  • Left panel which provides more detailed information about every type
  • "Skip Relay" option that simplifies graph by removing Relay wrapper classes
  • Ability to choose any type to be a root of the graph

API

GraphQL Voyager exports Voyager React component and helper init function. If used without module system it is exported as GraphQLVoyager global variable.

Properties

Voyager component accepts the following properties:

  • introspection [object] - the server introspection response. If function is provided GraphQL Voyager will pass introspection query as a first function parameter. Function should return Promise which resolves to introspection response object.
  • displayOptions (optional)
    • displayOptions.skipRelay [boolean, default true] - skip relay-related entities
    • displayOptions.skipDeprecated [boolean, default true] - skip deprecated fields and entities that contain only deprecated fields.
    • displayOptions.rootType [string] - name of the type to be used as a root
    • displayOptions.sortByAlphabet [boolean, default false] - sort fields on graph by alphabet
    • displayOptions.showLeafFields [boolean, default true] - show all scalars and enums
    • displayOptions.hideRoot [boolean, default false] - hide the root type
  • allowToChangeSchema [boolean, default false] - allow users to change schema
  • hideDocs [boolean, default false] - hide the docs sidebar
  • hideSettings [boolean, default false] - hide settings panel
  • hideVoyagerLogo [boolean, default true] - hide voyager logo

Using pre-bundled version

You can get GraphQL Voyager bundle from the following places:

Note: voyager.standalone.js is bundled with react, so you just need to call renderVoyager function that's it.

HTML example

Using as a dependency

Build for the web with webpack, or any other bundle.

Webpack example

Middleware

GraphQL Voyager has middleware for the next frameworks:

Properties

Middleware supports the following properties:

  • endpointUrl [string] - the GraphQL endpoint url.
  • displayOptions [object] - same as here
  • headersJS [string, default "{}"] - object of headers serialized in string to be used on endpoint url<BR> Note: You can also use any JS expression which results in an object with header names as keys and strings as values e.g. { Authorization: localStorage['Meteor.loginToken'] }

Express

import express from 'express';
import { express as voyagerMiddleware } from 'graphql-voyager/middleware';

const app = express();

app.use('/voyager', voyagerMiddleware({ endpointUrl: '/graphql' }));

app.listen(3001);

Hapi

Version 20+

import Hapi from '@hapi/hapi';
import { hapi as voyagerMiddleware } from 'graphql-voyager/middleware';

const server = new Hapi.Server({
  port: 3001,
});

const init = async () => {
  await server.register({
    plugin: voyagerMiddleware,
    options: {
      path: '/voyager',
      endpointUrl: '/graphql',
    },
  });

  await server.start();
};

init();

Koa

import Koa from 'koa';
import KoaRouter from 'koa-router';
import { koa as voyagerMiddleware } from 'graphql-voyager/middleware';

const app = new Koa();
const router = new KoaRouter();

router.all(
  '/voyager',
  voyagerMiddleware({
    endpointUrl: '/graphql',
  }),
);

app.use(router.routes());
app.use(router.allowedMethods());
app.listen(3001);

Credits

This tool is inspired by graphql-visualizer project.

最近版本更新:(数据更新于 2024-10-03 02:19:58)

2023-08-09 06:46:09 v2.0.0

2023-05-11 19:16:41 v1.3.0

2023-04-30 06:07:32 v1.2.0

2023-04-25 21:21:10 v1.1.0

2023-04-25 21:06:54 v1.0.2

2023-04-25 18:16:04 v1.0.1

2023-04-25 18:12:48 v1.0.0

2017-07-21 22:57:30 v1.0.0-rc.7

2017-07-21 22:55:43 v1.0.0-rc.6

主题(topics):

api-documentation, graphql, graphql-tools, graphviz, visualization

graphql-kit/graphql-voyager同语言 TypeScript最近更新仓库

2024-12-22 15:05:26 elizaOS/eliza

2024-12-21 21:40:12 lobehub/lobe-chat

2024-12-21 12:01:51 siyuan-note/siyuan

2024-12-21 09:15:35 MetaCubeX/metacubexd

2024-12-21 04:50:26 mediar-ai/screenpipe

2024-12-20 19:36:48 vitejs/vite