Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Field ¶
type Field struct {
Name string `json:"name,omitempty"`
Type string `json:"type"`
Label string `json:"label,omitempty"`
Description string `json:"description,omitempty"`
Importance string `json:"importance,omitempty"`
Optional bool `json:"optional,omitempty"`
Default any `json:"default,omitempty"`
Common bool `json:"common,omitempty"`
Widget string `json:"widget,omitempty"`
Placeholder string `json:"placeholder,omitempty"`
// For group types
Fields []Field `json:"fields,omitempty"`
Expanded bool `json:"expanded,omitempty"`
// For list types
Entity string `json:"entity,omitempty"`
Min int `json:"min,omitempty"`
Max int `json:"max,omitempty"`
DefaultNum int `json:"defaultNum,omitempty"`
Field *Field `json:"field,omitempty"`
// For select and library types - polymorphic options field
Options interface{} `json:"options,omitempty"`
// For number types
MinValue int `json:"minValue,omitempty"`
MaxValue int `json:"maxValue,omitempty"`
Step int `json:"step,omitempty"`
Unit string `json:"unit,omitempty"`
// For text types
MaxLength int `json:"maxLength,omitempty"`
Tags []string `json:"tags,omitempty"`
// Widget-specific properties
ShowWhen *ShowWhen `json:"showWhen,omitempty"`
}
Field represents a single field in an H5P semantics definition
func (*Field) GetLibraryOptions ¶
GetLibraryOptions returns the options as a slice of library strings. This is used for library type fields where options contains library names/versions. Returns nil if the options are not in the expected format.
func (*Field) GetSelectOptions ¶
func (f *Field) GetSelectOptions() []SelectOption
GetSelectOptions returns the options as a slice of SelectOption structs. This is used for select type fields where options contains value/label pairs. Returns nil if the options are not in the expected format.
func (*Field) SetLibraryOptions ¶
SetLibraryOptions sets the options field with library strings.
func (*Field) SetSelectOptions ¶
func (f *Field) SetSelectOptions(options []SelectOption)
SetSelectOptions sets the options field with SelectOption structs.
type SelectOption ¶
SelectOption represents an option in a select field
type SemanticDefinition ¶
type SemanticDefinition []Field
SemanticDefinition represents the top-level semantics array