docs

package module
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2020 License: MIT Imports: 8 Imported by: 0

README

GraphQL Docs

A helper project for go-graphql, to build html documentation from schema

Usage

GO111MODULE=on go get github.com/borosr/graphql-docs

package main

import (
 "github.com/borosr/graphql-docs"
 "github.com/graphql-go/graphql"
)


func main() {
    s, _ := graphql.NewSchema(graphql.SchemaConfig{
        Query: Query(), // some query
    })
    docs.Init(s, docs.Config{Html: true}) // creates returns the documentation's content
}
Config values:
Config{
    Sysout:   true,
    Pretty:   true,
    Html:     true,
    Md:       true,
    Json:     true,
    Filename: "graphql-docs",
}
Output on console (with Sysout: true, Pretty: true)
query{
	graph(repo:"",filter:{value:"",filterIn:""}){
		nodes{
			attributes{
				functions
				methods{
					name
					receiver{
						name
						fields{
							name
							type
						}
					}
				}
				structs{
					name
					fields{
						name
						type
					}
				}
			}
			title
			weight
			color
			font{
				color
			}
			id
			label
		}
		edges{
			from
			to
			arrows
			attributes{
				functions
				methods{
					name
					receiver{
						name
						fields{
							name
							type
						}
					}
				}
				structs{
					name
					fields{
						name
						type
					}
				}
			}
			title
		}
	}
}
Output in html or md

You can check them, after pulling this repo and a go test .

License

License

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init

func Init(s graphql.Schema, c Config) string

Types

type Config

type Config struct {
	Sysout   bool
	Pretty   bool
	Html     bool
	Md       bool
	Filename string
}

Jump to

Keyboard shortcuts

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