diff --git a/config/_default/presidium/frontmatter/params.yml b/config/_default/presidium/frontmatter/params.yml new file mode 100644 index 00000000..d04afc64 --- /dev/null +++ b/config/_default/presidium/frontmatter/params.yml @@ -0,0 +1,12 @@ +frontmatter: + title: + type: string + required: true + placeholder_message: Enter a title + validation_message: Please ensure your article has a title + author: + type: email + required: true + placeholder_message: Enter author email + validation_message: Please ensure your article has an author email address + diff --git a/frontmatter-config-design/samples/frontmatter-config-1.yaml b/frontmatter-config-design/samples/frontmatter-config-1.yaml new file mode 100644 index 00000000..5c98be34 --- /dev/null +++ b/frontmatter-config-design/samples/frontmatter-config-1.yaml @@ -0,0 +1,46 @@ +author: + type: email + required: true + placeholder_message: Enter author email + validation_message: Please ensure your article has an author email address + +title: + type: string + required: true + placeholder_message: Enter a title + validation_message: Please ensure your article has a title + max_length: 100 + +status: + type: option + required: true + placeholder_message: Select status + validation_message: Please select a valid status from the dropdown + items_type: string + items: + - Draft + - Review + - Published + - Deprecated + +slug: + type: string + required: true + placeholder_message: eg. example-slug + validation_message: Invalid slug format. Use lowercase letters, numbers, underscores and hyphens only (e.g. "validate" or "solution-definition") + pattern: ^[a-z]+(-[a-z]+)*$ + +URL: + type: string + required: true + placeholder_message: https://example.com + validation_message: Please enter a valid URL (e.g. https://example.com) + pattern: ^(\/[a-zA-Z0-9-._~]+)*\/?$ + +weight: + type: number + required: true + placeholder_message: eg. 5 + validation_message: Weight must be a non-negative integer + integer: true + minimum: 1 \ No newline at end of file diff --git a/frontmatter-config-design/samples/frontmatter-config-2.yaml b/frontmatter-config-design/samples/frontmatter-config-2.yaml new file mode 100644 index 00000000..7d31960e --- /dev/null +++ b/frontmatter-config-design/samples/frontmatter-config-2.yaml @@ -0,0 +1,60 @@ +# object example (PRSDM-9766 example) +persona: + type: object + required: true + placeholder_message: Enter persona details + validation_message: Please provide all the required persona information + properties: + name: + type: string + required: true + placeholder_message: Enter the persona's name + validation_message: Name is required + role: + type: string + required: true + placeholder_message: Enter the persona's role + validation_message: Role is required + +# array of objects example 1 (PRSDM-9766 example) +attributes: + type: array + required: true + items_type: object + items_properties: + name: + type: string + required: true + placeholder_message: Enter attribute name + validation_message: Attribute name is required + key-role: + type: string + required: true + placeholder_message: Enter key role + validation_message: Key role is required + optionality: + type: string + required: true + placeholder_message: Enter optionality + validation_message: Optionality is required + description: + type: string + required: true + placeholder_message: Enter description + validation_message: Description is required + +# array of objects example 2 +related_articles: + type: array + required: false + items_type: object + items_properties: + title: + type: string + required: true + url: + type: string + required: true + description: + type: string + required: false diff --git a/frontmatter-config-design/schemas/data-types.yaml b/frontmatter-config-design/schemas/data-types.yaml new file mode 100644 index 00000000..5d3f3517 --- /dev/null +++ b/frontmatter-config-design/schemas/data-types.yaml @@ -0,0 +1,35 @@ +string: + extends: root # Inherits attributes from root type + pattern: string # [Optional] - Regex pattern for validation + min_length: number # [Default: 0] - Minimum length of the string + max_length: number # [Optional] - Maximum length of the string + +#number: probably needed in future +# extends: root # Inherits attributes from root type +# minimum: number # [Optional] - Minimum value +# maximum: number # [Optional] - Maximum value +# integer: boolean # [Default: false] - Whether the number should be an integer + +boolean: + extends: root # Inherits attributes from root type + +array: + extends: root # Inherits attributes from root type + items_type: string # [Required] - Type of items in the array + items: array # [Optional] - List of allowed items + min_items: number # [Default: 0] - Minimum number of items + items_properties: # [required | items_type: object] - Properties of each item if items_type is object + key: # Property name + type: string # Type of the property + required: boolean # Whether the property is required + placeholder_message: string # [Required] - Placeholder message + validation_message: string # [Optional] - Custom validation message + +object: + extends: root # Inherits attributes from root type + properties: # [Required] - Properties of the object + key: # Property name + type: string # Type of the property + required: boolean # Whether the property is required + placeholder_message: string # [Required] - Placeholder message + validation_message: string # [Optional] - Custom validation message \ No newline at end of file diff --git a/frontmatter-config-design/schemas/format-types.yaml b/frontmatter-config-design/schemas/format-types.yaml new file mode 100644 index 00000000..c2b720d3 --- /dev/null +++ b/frontmatter-config-design/schemas/format-types.yaml @@ -0,0 +1,18 @@ +text: + extends: string + rows: number # [Optional] - Number of rows for textarea + +email: + extends: string + pattern: '^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$' # predefined Email regex pattern + +date: + extends: string + pattern: '^\d{4}-\d{2}-\d{2}$' # YYYY-MM-DD format + +datetime: + extends: string + pattern: '^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(Z|[+-]\d{2}:\d{2})$' # ISO 8601 format + +option: + extends: array \ No newline at end of file diff --git a/frontmatter-config-design/schemas/root-type.yaml b/frontmatter-config-design/schemas/root-type.yaml new file mode 100644 index 00000000..e60b2f4e --- /dev/null +++ b/frontmatter-config-design/schemas/root-type.yaml @@ -0,0 +1,5 @@ +root: + type: string # [Required] - The type name + required: boolean # [Default: false] - Whether field is mandatory + placeholder_message: string # [Required] - Placeholder message + validation_message: string # [Optional] - Custom validation message