Skip to main content

InitTemplateBase._validatePropertiesDefinitions() method

Validates the structure and content of property definitions.

Signature

protected _validatePropertiesDefinitions(): void;

Returns

void

Remarks

This internal method performs comprehensive validation of the property definitions object during template construction, ensuring all definitions are well-formed and internally consistent before the template is used.

Validation steps:

  1. Overall structure:
    • Verifies that propertiesDefinitions is an object.
    • Ensures at least one property is defined (not empty).
  2. Common property fields:
    • label: Must be a non-empty string.
    • description: Must be a non-empty string.
    • isMandatory: Must be a boolean if present.
    • type: Must be defined and one of: select, string, number, boolean.
  3. Type-specific validation:
    • Select properties:
      • Must have an items object with at least one entry.
      • Each item must be either a string (description) or an object with platforms array and message string.
      • Non-mandatory properties must have a default value.
      • Default values must be non-empty strings present in the items list.
    • String properties: Default value must be a non-empty string if present.
    • Number properties: Default value must be a number if present.
    • Boolean properties: Default value must be a boolean if present.

This validation ensures that templates are correctly configured before use, preventing runtime errors during property processing and interactive prompting. Any validation failure triggers an assertion error with a descriptive message indicating the specific problem.


Generated via tsdoc2docusaurus 1.3.2 by API Extractor/Documenter 7.57.2.