docgen

package
v0.0.0-...-4e9d6c2 Latest Latest
Warning

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

Go to latest
Published: May 12, 2023 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Overview

Package docgen generates an OpenRPC spec for the Elysium Node. It has been inspired by and adapted from Filecoin's Lotus API implementation.

Index

Constants

View Source
const (
	APIDescription = "The Elysium Node API is the collection of RPC methods that " +
		"can be used to interact with the services provided by Elysium Data Availability Nodes."
	APIName  = "Elysium Node API"
	DocsURL  = "https://github.com/furyaxyz/elysium-node"
	DocsName = "Elysium Node GitHub"
)

Variables

View Source
var ExampleValues = map[reflect.Type]interface{}{
	reflect.TypeOf(""):                       "string value",
	reflect.TypeOf(uint64(42)):               uint64(42),
	reflect.TypeOf(uint32(42)):               uint32(42),
	reflect.TypeOf(int32(42)):                int32(42),
	reflect.TypeOf(int64(42)):                int64(42),
	reflect.TypeOf(42):                       42,
	reflect.TypeOf(byte(7)):                  byte(7),
	reflect.TypeOf(float64(42)):              float64(42),
	reflect.TypeOf(true):                     true,
	reflect.TypeOf([]byte{}):                 []byte("byte array"),
	reflect.TypeOf(node.Full):                node.Full,
	reflect.TypeOf(auth.Permission("admin")): auth.Permission("admin"),
	reflect.TypeOf(byzantine.BadEncoding):    byzantine.BadEncoding,
	reflect.TypeOf((*fraud.Proof)(nil)).Elem(): byzantine.CreateBadEncodingProof(
		[]byte("bad encoding proof"),
		42,
		&byzantine.ErrByzantine{
			Index:  0,
			Axis:   rsmt2d.Axis(0),
			Shares: []*byzantine.ShareWithProof{},
		},
	),
	reflect.TypeOf((*error)(nil)).Elem(): fmt.Errorf("error"),
}

Functions

func ExampleValue

func ExampleValue(t, parent reflect.Type) (interface{}, error)

func NewOpenRPCDocument

func NewOpenRPCDocument(comments Comments, permissions Comments) *go_openrpc_reflect.Document

func OpenRPCSchemaTypeMapper

func OpenRPCSchemaTypeMapper(ty reflect.Type) *jsonschema.Type

func ParseCommentsFromNodebuilderModules

func ParseCommentsFromNodebuilderModules(moduleNames ...string) (Comments, Comments)

Types

type Comments

type Comments = map[string]string

type Visitor

type Visitor struct {
	Methods map[string]ast.Node
}

func (*Visitor) Visit

func (v *Visitor) Visit(node ast.Node) ast.Visitor

Jump to

Keyboard shortcuts

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