Spec Section
The spec section is a critical part of the YAML file. It uses JSON Schema to define properties, data types, and validation rules, ensuring consistency and clarity.
Key JSON Schema Elements:
- type: Specifies the data type (e.g.,
string
,boolean
,object
). - properties: Lists the sub-properties of an object.
- items: Defines the schema for array elements.
- title: Provides a human-readable name for the property.
- description: Explains the property’s purpose.
- enum: Limits values to a predefined set.
- minimum/maximum: Sets numerical constraints.
- pattern: Uses regular expressions for string validation.
- required: Marks mandatory fields.
Custom UI Fields (x-ui-* Fields)
Facets extends JSON Schema with custom x-ui-*
fields to enhance the user interface. These custom UI fields can be added to any field in the spec section for a desired behavior and display of that resource property.
Common x-ui-* Fields:
- x-ui-api-source: Fetches dynamic data for dropdowns from an API.
- x-ui-placeholder: Provides placeholder text in input fields.
- x-ui-validation: Adds custom validation rules.
- x-ui-visible-if: Toggles visibility based on another field’s value.
- x-ui-order: Specifies the display order of properties.
- x-ui-skip: Hides certain properties from the UI.
- x-ui-command: Indicates that the values within an array represent executable commands.
- x-ui-disable-tooltip: Provides a message for a disabled tooltip.
- x-ui-dynamic-enum: Dynamically generates enum options based on another field.
- x-ui-error-message: Custom error message for validation failures.
- x-ui-lookup-regex: Defines regex to extract values for API requests.
- x-ui-no-sort: Prevents automatic sorting of dropdown options.
- x-ui-override-disable: Prevents users from overriding certain properties in the UI.
- x-ui-overrides-only: Displays only overridden fields in the UI.
- x-ui-toggle: Renders a property as a toggle switch.
- x-ui-yaml-editor: Enables YAML editor for complex structured inputs.
- x-ui-saas-default:Set a different default value for saas CPs, which will override the default value set.
- x-ui-allow-title-edit: Allows editing the title of the patternProperties set in the yaml.
- x-ui-output-type: Allows to fetch output of a particular type without calling any api.
- x-ui-allow-blueprint-merge: Allows to merge content of that field set at blueprint into overrides.
- x-ui-mask: Change the input field value to “*” to mask it and not be visible to anyone
- x-ui-secret-ref: Refer to any of the secrets in the form which are defined at the blueprint level
- x-ui-variable-ref: Refer to any of the variables in the form which are defined at the blueprint level
Updated 1 day ago