Documentation
¶
Index ¶
- func AllowedScopes(scopes []string) []string
- func BootstrapDefaults(ctx context.Context, cfg BootstrapConfig, register func(DefaultDefinition), ...) error
- func CloneAnyMapValue(input map[string]any) map[string]any
- func EnsureAdminMeta(field map[string]any) map[string]any
- func EnsureSchemaProperties(schema map[string]any) map[string]any
- func ExtractSchema(doc opts.SchemaDocument) map[string]any
- func ExtractSchemaFromOpenAPI(document map[string]any) map[string]any
- func MapType(t string) string
- func MapWidget(widget string, fieldType string) string
- func SchemaField(raw any) map[string]any
- func SortRequiredKeys(keys map[string]struct{}) []string
- type BootstrapConfig
- type DefaultDefinition
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AllowedScopes ¶
AllowedScopes converts a slice of scope identifiers into strings.
func BootstrapDefaults ¶
func BootstrapDefaults(ctx context.Context, cfg BootstrapConfig, register func(DefaultDefinition), applySystem func(context.Context, map[string]any) error) error
BootstrapDefaults registers default settings definitions and applies system values.
func CloneAnyMapValue ¶
CloneAnyMapValue deep-copies a map[string]any tree.
func EnsureAdminMeta ¶
EnsureAdminMeta ensures the x-admin metadata container exists on a field.
func EnsureSchemaProperties ¶
EnsureSchemaProperties guarantees an object schema with properties map.
func ExtractSchema ¶
func ExtractSchema(doc opts.SchemaDocument) map[string]any
ExtractSchema returns the root schema from a go-options document.
func ExtractSchemaFromOpenAPI ¶
ExtractSchemaFromOpenAPI pulls the first requestBody schema from an OpenAPI document.
func SchemaField ¶
SchemaField clones a field definition into a mutable map.
func SortRequiredKeys ¶
SortRequiredKeys sorts required field keys for stable schemas.
Types ¶
type BootstrapConfig ¶
type BootstrapConfig struct {
Title string `json:"title"`
DefaultLocale string `json:"default_locale"`
Theme string `json:"theme"`
DashboardEnabled bool `json:"dashboard_enabled"`
SearchEnabled bool `json:"search_enabled"`
}
BootstrapConfig captures the inputs needed to derive default settings.
type DefaultDefinition ¶
type DefaultDefinition struct {
Key string `json:"key"`
Title string `json:"title"`
Description string `json:"description"`
Default any `json:"default"`
Type string `json:"type"`
Group string `json:"group"`
}
DefaultDefinition describes a basic setting definition used for bootstrap.
func DefaultDefinitions ¶
func DefaultDefinitions(cfg BootstrapConfig) ([]DefaultDefinition, map[string]any)
DefaultDefinitions returns the bootstrap definitions and system-scoped values.