extension

package
v0.4.6 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2024 License: Apache-2.0 Imports: 8 Imported by: 3

Documentation

Index

Constants

View Source
const MasterTestingSchema = `` /* 663-byte string literal not displayed */

Variables

This section is empty.

Functions

func ValidPrimitiveType

func ValidPrimitiveType(t string) bool

Types

type FunctionSchema

type FunctionSchema struct {
	Name        string `hcl:"name,label"`
	Description string `hcl:"description,optional"`
	Params      string `hcl:"params,optional"`
	Return      string `hcl:"return,optional"`
}

func (*FunctionSchema) Normalize

func (s *FunctionSchema) Normalize()

func (*FunctionSchema) Validate

func (s *FunctionSchema) Validate(knownFunctions map[string]struct{}) error

type Info

type Info struct {
	Name    string
	Path    string
	Version string
	Package string
}

type InterfaceSchema

type InterfaceSchema struct {
	Name        string            `hcl:"name,label"`
	Description string            `hcl:"description,optional"`
	Functions   []*FunctionSchema `hcl:"function,block"`
}

func (*InterfaceSchema) Normalize

func (s *InterfaceSchema) Normalize()

func (*InterfaceSchema) Validate

func (s *InterfaceSchema) Validate(knownInterfaces map[string]map[string]struct{}) error

type Schema

type Schema struct {
	Version    string                   `hcl:"version,attr"`
	Interfaces []*InterfaceSchema       `hcl:"interface,block"`
	Functions  []*FunctionSchema        `hcl:"function,block"`
	Enums      []*signature.EnumSchema  `hcl:"enum,block"`
	Models     []*signature.ModelSchema `hcl:"model,block"`
	// contains filtered or unexported fields
}

Schema is the top-level structure of a Scale Extension schema

func ReadSchema

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

ReadSchema reads a Scale Extension schema from a file at the given path

func (*Schema) Clone

func (s *Schema) Clone() (*Schema, error)

Clone returns a deep copy of the schema

func (*Schema) CloneWithDisabledAccessorsValidatorsAndModifiers

func (s *Schema) CloneWithDisabledAccessorsValidatorsAndModifiers() (*Schema, error)

CloneWithDisabledAccessorsValidatorsAndModifiers returns a clone of the schema with all accessors, validators, and modifiers disabled

func (*Schema) Decode

func (s *Schema) Decode(data []byte) error

Decode decodes the given byte slice into the Schema

Note: This function modifies the Schema in-place and validates/normalizes it as well.

func (*Schema) Encode

func (s *Schema) Encode() ([]byte, error)

Encode encodes the Schema into a byte slice

func (*Schema) HasCaseModifier

func (s *Schema) HasCaseModifier() bool

func (*Schema) HasLengthValidator

func (s *Schema) HasLengthValidator() bool

func (*Schema) HasLimitValidator

func (s *Schema) HasLimitValidator() bool

func (*Schema) HasRegexValidator

func (s *Schema) HasRegexValidator() bool

func (*Schema) Hash

func (s *Schema) Hash() ([]byte, error)

Hash returns the SHA256 hash of the schema

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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