Documentation ¶
Index ¶
- func DataToJSONSchema(schema *Schema, dataRef DataRef) (*js.Schema, error)
- func Normalise[T Node](n T) T
- func ProtobufSchema() string
- func Validate(schema *Schema) error
- func ValidateModule(module *Module) error
- func Visit(n Node, visit func(n Node, next func() error) error) error
- type Array
- type Bool
- type Data
- type DataRef
- type Decl
- type Field
- type Float
- type Int
- type Map
- type Metadata
- type MetadataCalls
- type MetadataIngress
- type Module
- type Node
- type Position
- type Ref
- type Schema
- type String
- type Time
- type Type
- type Verb
- type VerbRef
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DataToJSONSchema ¶ added in v0.1.1
DataToJSONSchema converts the schema for a Data object to a JSON Schema.
It takes in the full schema in order to resolve and define references.
func ProtobufSchema ¶
func ProtobufSchema() string
ProtobufSchema returns a string containing the equivalent protobuf schema for the FTL schema.
func ValidateModule ¶
ValidateModule performs the subset of semantic validation possible on a single module.
Types ¶
type Array ¶
type Bool ¶
type Data ¶
type Data struct { Pos Position `json:"pos,omitempty" parser:"" protobuf:"1,optional"` Comments []string `parser:"@Comment*" json:"comments,omitempty" protobuf:"5"` Name string `parser:"'data' @Ident '{'" json:"name,omitempty" protobuf:"2"` Fields []*Field `parser:"@@* '}'" json:"fields,omitempty" protobuf:"3"` Metadata []Metadata `parser:"@@*" json:"metadata,omitempty" protobuf:"4"` }
A Data structure.
func DataToSchema ¶
type Field ¶
type Float ¶
type Int ¶
type Map ¶
type MetadataCalls ¶
type MetadataCalls struct { Pos Position `json:"pos,omitempty" parser:"" protobuf:"1,optional"` Calls []*VerbRef `parser:"'calls' @@ (',' @@)*" json:"calls,omitempty" protobuf:"2"` }
func (*MetadataCalls) String ¶
func (m *MetadataCalls) String() string
func (*MetadataCalls) ToProto ¶
func (m *MetadataCalls) ToProto() proto.Message
type MetadataIngress ¶
type MetadataIngress struct { Pos Position `json:"pos,omitempty" parser:"" protobuf:"1,optional"` Method string `parser:"'ingress' @('GET' | 'POST')" json:"method,omitempty" protobuf:"2"` Path string `parser:"@('/' @Ident)+" json:"path,omitempty" protobuf:"3"` }
func (*MetadataIngress) String ¶
func (m *MetadataIngress) String() string
func (*MetadataIngress) ToProto ¶
func (m *MetadataIngress) ToProto() proto.Message
type Module ¶
type Module struct { Pos Position `json:"pos,omitempty" parser:"" protobuf:"1,optional"` Comments []string `parser:"@Comment*" json:"comments,omitempty" protobuf:"3"` Name string `parser:"'module' @Ident '{'" json:"name,omitempty" protobuf:"2"` Decls []Decl `parser:"@@* '}'" json:"decls,omitempty" protobuf:"4"` }
func ModuleFromBytes ¶
func ModuleFromProto ¶
ModuleFromProto converts a protobuf Module to a Module and validates it.
func ParseModuleString ¶
type Node ¶
type Node interface { String() string ToProto() proto.Message // contains filtered or unexported methods }
A Node in the schema grammar.
type Position ¶
type Ref ¶
type Ref struct { Pos Position `json:"pos,omitempty" parser:"" protobuf:"1,optional"` Module string `parser:"(@Ident '.')?" json:"module,omitempty" protobuf:"3"` Name string `parser:"@Ident" json:"name,omitempty" protobuf:"2"` }
Ref is a reference to another symbol.
type Schema ¶
type Schema struct { Pos Position `json:"pos,omitempty" parser:"" protobuf:"1,optional"` Modules []*Module `parser:"@@*" json:"modules,omitempty" protobuf:"2"` }
func ParseString ¶
func (*Schema) MarshalJSON ¶
func (*Schema) UnmarshalJSON ¶
type String ¶
type Time ¶
type Type ¶
type Type interface { Node // contains filtered or unexported methods }
Type represents a Type Node in the schema grammar.
type Verb ¶
type Verb struct { Pos Position `json:"pos,omitempty" parser:"" protobuf:"1,optional"` Comments []string `parser:"@Comment*" json:"comments,omitempty" protobuf:"3"` Name string `parser:"'verb' @Ident" json:"name,omitempty" protobuf:"2"` Request *DataRef `parser:"'(' @@ ')'" json:"request,omitempty" protobuf:"4"` Response *DataRef `parser:"@@" json:"response,omitempty" protobuf:"5"` Metadata []Metadata `parser:"@@*" json:"metadata,omitempty" protobuf:"6"` }
func VerbToSchema ¶
type VerbRef ¶
type VerbRef Ref
VerbRef is a reference to a Verb.
func VerbRefFromProto ¶
VerbRefFromProto converts a protobuf VerbRef to a VerbRef.
Click to show internal directories.
Click to hide internal directories.