Documentation
¶
Index ¶
- Constants
- 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 SchemaEqual(s1, s2 *openapi3.Schema) (bool, error)
- func UnionSchema(s1, s2 *openapi3.Schema) (*openapi3.Schema, error)
- 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
Constants ¶
View Source
const ( // Extension for walrus. ExtWalrusKey = "x-walrus" // ExtWalrusVersionKey is a string, for walrus version constraint. ExtWalrusVersionKey = "version" )
View Source
const (
// ExtOriginalKey for original value.
ExtOriginalKey = "x-walrus-original"
)
View Source
const (
// Extension for UI.
ExtUIKey = "x-walrus-ui"
)
View Source
const OpenAPIVersion = "3.0.3"
Variables ¶
This section is empty.
Functions ¶
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 SchemaEqual ¶
SchemaEqual checks if s1 and s2 are equal.
Types ¶
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.
Click to show internal directories.
Click to hide internal directories.