Documentation ¶
Index ¶
- Constants
- func GenSchemaDefaultPatch(ctx context.Context, schema *openapi3.Schema) ([]byte, error)
- func GetExtWalrusVersion(e map[string]any) string
- func IntersectSchema(s1, s2 *openapi3.Schema) *openapi3.Schema
- func IsSchemaRefEmpty(s *openapi3.SchemaRef) bool
- func MustSchemaEqual(s1, s2 *openapi3.Schema) bool
- func RemoveExt(key string, s *openapi3.Schema) *openapi3.Schema
- func RemoveExtOriginal(s *openapi3.Schema) *openapi3.Schema
- func RemoveExtUI(s *openapi3.Schema) *openapi3.Schema
- func RemoveVariableContext(s *openapi3.Schema) *openapi3.Schema
- func SchemaEqual(s1, s2 *openapi3.Schema) (bool, error)
- func UnionSchema(s1, s2 *openapi3.Schema) (*openapi3.Schema, error)
- type DefaultPatchNode
- type Ext
- func (e *Ext) Export() map[string]any
- func (e *Ext) WithOriginal(origin any) *Ext
- func (e *Ext) WithOriginalType(ty any) *Ext
- func (e *Ext) WithOriginalValueExpression(ve []byte) *Ext
- func (e *Ext) WithOriginalVariablesSequence(vq []string) *Ext
- func (e *Ext) WithUIColSpan(cs int) *Ext
- func (e *Ext) WithUIGroup(gp string) *Ext
- func (e *Ext) WithUIGroupOrder(grd ...string) *Ext
- func (e *Ext) WithUIHidden() *Ext
- func (e *Ext) WithUIImmutable() *Ext
- func (e *Ext) WithUIOrder(order int) *Ext
- func (e *Ext) WithUIShowIf(showIf string) *Ext
- func (e *Ext) WithUIWidget(widget string) *Ext
- type ExtOriginal
- type ExtUI
- type Node
- type Stack
Constants ¶
const ( // Extension for walrus. ExtWalrusKey = "x-walrus" // ExtWalrusVersionKey is a string, for walrus version constraint. ExtWalrusVersionKey = "version" )
const (
// ExtOriginalKey for original value.
ExtOriginalKey = "x-walrus-original"
)
const (
// Extension for UI.
ExtUIKey = "x-walrus-ui"
)
const OpenAPIVersion = "3.0.3"
const (
UIWidgetYamlEditor = "YamlEditor"
)
const WalrusContextVariableName = "context"
Variables ¶
This section is empty.
Functions ¶
func GenSchemaDefaultPatch ¶ added in v0.5.0
GenSchemaDefaultPatch generates the default patch for the variable schema. The input root schema type should be object.
func GetExtWalrusVersion ¶
func IntersectSchema ¶
IntersectSchema generates a openapi3.Schema with properties intersection of s1 and s2.
func IsSchemaRefEmpty ¶
func MustSchemaEqual ¶
MustSchemaEqual checks if s1 and s2 are equal, just log the error.
func RemoveVariableContext ¶ added in v0.5.0
func SchemaEqual ¶
SchemaEqual checks if s1 and s2 are equal.
Types ¶
type DefaultPatchNode ¶ added in v0.5.0
DefaultPatchNode is a implement of Node to generate default value tree.
func (*DefaultPatchNode) Children ¶ added in v0.5.0
func (n *DefaultPatchNode) Children() []Node
Children returns the children of the node.
func (*DefaultPatchNode) GetDefault ¶ added in v0.5.0
func (n *DefaultPatchNode) GetDefault() any
GetDefault returns the default value of the node.
func (*DefaultPatchNode) GetID ¶ added in v0.5.0
func (n *DefaultPatchNode) GetID() string
GetID returns the id of the node.
func (*DefaultPatchNode) GetParentID ¶ added in v0.5.0
func (n *DefaultPatchNode) GetParentID() string
GetParentID returns the id of the ancestor nodes.
type Ext ¶
type Ext struct { ExtUI ExtOriginal }
Ext is a struct wrap the extension.
func NewExtFromMap ¶
NewExtFromMap creates a new Ext from extension map.
func (*Ext) WithOriginal ¶
func (*Ext) WithOriginalType ¶
func (*Ext) WithOriginalValueExpression ¶
func (*Ext) WithOriginalVariablesSequence ¶
func (*Ext) WithUIColSpan ¶
func (*Ext) WithUIGroup ¶
func (*Ext) WithUIGroupOrder ¶
func (*Ext) WithUIHidden ¶
func (*Ext) WithUIImmutable ¶
func (*Ext) WithUIOrder ¶
func (*Ext) WithUIShowIf ¶
func (*Ext) WithUIWidget ¶
type ExtOriginal ¶
type ExtOriginal struct { // Type is a string, for original type. Type any `json:"type,omitempty" yaml:"type,omitempty"` // ValueExpression is a string, for original value expression. ValueExpression []byte `json:"value-expression,omitempty" yaml:"value-expression,omitempty"` // VariablesSequence is a list, for original variables sequence. VariablesSequence []string `json:"sequence,omitempty" yaml:"sequence,omitempty"` }
ExtOriginal is a struct wrap the original extension.
func GetExtOriginal ¶
func GetExtOriginal(e map[string]any) ExtOriginal
func (ExtOriginal) IsEmpty ¶
func (e ExtOriginal) IsEmpty() bool
IsEmpty reports if the extension is empty.
type ExtUI ¶
type ExtUI struct { // Group is a string, for grouping the properties. Group string `json:"group,omitempty" yaml:"group,omitempty"` // GroupOrder is a list, for ordering the group in the UI. GroupOrder []string `json:"groupOrder,omitempty" yaml:"groupOrder,omitempty"` // ShowIf is a string, for showing the property. ShowIf string `json:"showIf,omitempty" yaml:"showIf,omitempty"` // Hidden is a boolean, for hiding the property. Hidden bool `json:"hidden,omitempty" yaml:"hidden,omitempty"` // Immutable is a boolean, for making the property immutable. Immutable bool `json:"immutable,omitempty" yaml:"immutable,omitempty"` // Widget is a string, for customizing the UI widget. Widget string `json:"widget,omitempty" yaml:"widget,omitempty"` // Order is a number, for ordering the properties in the UI. Order int `json:"order,omitempty" yaml:"order,omitempty"` // ColSpan is a number between 1 and 12, for typical 12-column grid systems. ColSpan int `json:"colSpan,omitempty" yaml:"colSpan,omitempty"` }
ExtUI is a struct wrap the UI extension.
type Node ¶ added in v0.5.0
Node is a node in the tree.
func PreorderTraversal ¶ added in v0.5.0
PreorderTraversal traverses the tree in preorder.