schema

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package schema provides the Apex RPC schema.

Index

Constants

This section is empty.

Variables

View Source
var SchemaJson = []byte{}/* 6036 elements not displayed */

SchemaJson holds content of schema.json

Functions

func IsBuiltin

func IsBuiltin(kind Kind) bool

IsBuiltin returns true if the type is built-in.

Types

type Example

type Example struct {
	Description string      `json:"description"`
	Value       interface{} `json:"value"`
}

Example model.

type Field

type Field struct {
	Name        string      `json:"name"`
	Description string      `json:"description"`
	Required    bool        `json:"required"`
	ReadOnly    bool        `json:"readonly"`
	Default     interface{} `json:"default"`
	Type        TypeObject  `json:"type"`
	Items       ItemsObject `json:"items"`
	Enum        []string    `json:"enum"`
}

Field model.

type Group

type Group struct {
	Name        string `json:"name"`
	Description string `json:"description"`
	Summary     string `json:"summary"`
}

Group model.

type ItemsObject

type ItemsObject struct {
	Type Kind `json:"type"`
	Ref
}

ItemsObject model.

type Kind

type Kind string

Kind is a value type.

const (
	String    Kind = "string"
	Bool      Kind = "boolean"
	Int       Kind = "integer"
	Float     Kind = "float"
	Array     Kind = "array"
	Object    Kind = "object"
	Timestamp Kind = "timestamp"
)

Types available.

type Method

type Method struct {
	Name        string          `json:"name"`
	Description string          `json:"description"`
	Private     bool            `json:"private"`
	Group       string          `json:"group"`
	Inputs      []Field         `json:"inputs"`
	Outputs     []Field         `json:"outputs"`
	Examples    []MethodExample `json:"examples"`
}

Method model.

type MethodExample

type MethodExample struct {
	Name        string      `json:"name"`
	Description string      `json:"description"`
	Input       interface{} `json:"input"`
	Output      interface{} `json:"output"`
}

MethodExample model.

type Ref

type Ref struct {
	Value string `json:"$ref"`
}

Ref model.

type Schema

type Schema struct {
	Name        string          `json:"name"`
	Version     string          `json:"version"`
	Description string          `json:"description"`
	Methods     []Method        `json:"methods"`
	Groups      []Group         `json:"groups"`
	Types       map[string]Type `json:"types"`
	Go          struct {
		Tags []string `json:"tags"`
	} `json:"go"`
}

Schema model.

func Load

func Load(path string) (*Schema, error)

Load returns a schema loaded and validated from path.

func (Schema) TypesSlice

func (s Schema) TypesSlice() (v []Type)

TypesSlice returns a sorted slice of types.

type Type

type Type struct {
	Name        string    `json:"name"`
	Description string    `json:"description"`
	Private     bool      `json:"private"`
	Properties  []Field   `json:"properties"`
	Examples    []Example `json:"examples"`
}

Type model.

type TypeObject

type TypeObject struct {
	Type Kind `json:"type"`
	Ref
}

TypeObject model.

func (*TypeObject) UnmarshalJSON

func (t *TypeObject) UnmarshalJSON(b []byte) error

UnmarshalJSON implementation.

type ValidationError

type ValidationError struct {
	Result *gojsonschema.Result
}

ValidationError is a validation error.

func (ValidationError) Error

func (e ValidationError) Error() (s string)

Error implementation.

Jump to

Keyboard shortcuts

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