@web-engine-dev/resources / ResourceFieldDescriptor
Interface: ResourceFieldDescriptor
Describes one serializable field of a scene resource.
This is the core metadata unit: it tells the serializer how to delta-encode/decode the field, and tells the editor how to render it.
Remarks
All properties are readonly to prevent accidental mutation of schema definitions at runtime. Schema objects should be defined once (typically at module load time) and treated as immutable configuration.
Properties
assetType?
readonlyoptionalassetType:string
Asset type filter for 'asset-ref' fields (e.g. 'texture', 'mesh').
category?
readonlyoptionalcategory:string
Logical category for grouping fields in the editor UI.
default
readonlydefault:unknown
The default value for this field.
Used by delta-encoding: fields matching their default are omitted from the serialized output. Must be a JSON-serializable value. Array and object defaults are deep-cloned when constructing default objects.
label?
readonlyoptionallabel:string
Display label for the editor. Falls back to the field key if omitted.
max?
readonlyoptionalmax:number
Maximum value (for 'number' fields).
min?
readonlyoptionalmin:number
Minimum value (for 'number' fields).
options?
readonlyoptionaloptions: readonlyobject[]
Option entries for 'enum' fields.
Each entry is a { value, label } pair where value is the serialized string and label is the display text (or i18n key).
order?
readonlyoptionalorder:number
Display order within the category.
Lower numbers appear first. Fields without an explicit order are sorted after those with one, in definition order.
step?
readonlyoptionalstep:number
Step increment (for 'number' and 'slider' fields).
tooltip?
readonlyoptionaltooltip:string
Tooltip shown on hover in the editor.
type
readonlytype:ResourceFieldType
The serializable type of this field.
visibleWhen?
readonlyoptionalvisibleWhen:FieldVisibilityPredicate
Conditional visibility predicate.
widget?
readonlyoptionalwidget:string
Explicit editor widget override (e.g. 'slider', 'color-picker').