Skip to content

Conversation

@ricardo-devis-agullo
Copy link
Collaborator

Add enum validation support to component parameters

Changes

  • Added enum validation to component parameters allowing restriction of parameter values to specific sets
  • Enhanced type definitions with optional enum property supporting string, number, and boolean arrays
  • Added comprehensive test coverage for enum validation across all data types and edge cases
  • Fixed validation precedence ensuring type validation takes priority over enum validation

Technical Details

  • Parameters with enum constraints now validate that provided values are within the allowed set
  • Type validation occurs before enum validation to provide clear error messages
  • Added new error message: PARAMETER_WRONG_VALUE for enum validation failures
  • Maintains backward compatibility with existing parameter validation

Example Usage

{
  status: {
    type: 'string',
    mandatory: true,
    enum: ['active', 'inactive', 'pending']
  }
}

Testing

  • Added 15+ new test cases covering string, number, boolean enums
  • Tests edge cases: empty arrays, single values, multiple parameters
  • Ensures proper error message formatting and validation precedence

@ricardo-devis-agullo ricardo-devis-agullo merged commit 6ecde5c into master Aug 18, 2025
3 checks passed
@ricardo-devis-agullo ricardo-devis-agullo deleted the add-enum branch August 18, 2025 10:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants