spec

package
v0.0.0-...-c8b48d0 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	FieldTypeBoolean = FieldType{
						// contains filtered or unexported fields
	}
	FieldTypeDecimal = FieldType{
						// contains filtered or unexported fields
	}
	FieldTypeNumber = FieldType{
					// contains filtered or unexported fields
	}
	FieldTypeString = FieldType{
					// contains filtered or unexported fields
	}
)

Functions

This section is empty.

Types

type Endpoint

type Endpoint struct {
	Name string

	Actions      EndpointActions
	Filename     string
	Objects      []*Object
	ResourcePath string
}

func EndpointFromAPISpec

func EndpointFromAPISpec(name, filename string, values map[string]interface{}) (*Endpoint, error)

type EndpointActions

type EndpointActions struct {
	DisableCreate bool
	DisableDelete bool
	DisableGet    bool
	DisableList   bool
	DisableUpdate bool
}

type Field

type Field struct {
	Name        string
	Description string
	Type        FieldType

	JSONName   string
	Validation *regexp.Regexp
}

func (Field) DefaultDescription

func (f Field) DefaultDescription() string

type FieldType

type FieldType struct {
	// contains filtered or unexported fields
}

FieldType represents the derived type from the API specification for a field on an endpoint object.

func FieldTypeList

func FieldTypeList(element FieldType) FieldType

func FieldTypeObject

func FieldTypeObject(name string) FieldType

func (*FieldType) ElementType

func (t *FieldType) ElementType() *FieldType

ElementType returns the expected FieldType for all elements of a list. If this type is not a list the nil is returned.

func (*FieldType) IsListType

func (t *FieldType) IsListType() bool

IsListType indicates whether the type is a Golang list. Use ElementType to determine the type of the elements expected for the list.

func (*FieldType) IsObjectType

func (t *FieldType) IsObjectType() bool

IsObjectType indicates whether the type is a Golang struct.

func (*FieldType) IsPrimitiveType

func (t *FieldType) IsPrimitiveType() bool

IsPrimitiveType indicates whether the type is a Golang primitive.

func (*FieldType) UnmarshalText

func (t *FieldType) UnmarshalText(text []byte) error

type Object

type Object struct {
	Name   string
	Fields []Field
}

Jump to

Keyboard shortcuts

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