Skip to content

add enum prop for params #1427

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 18, 2025
Merged

add enum prop for params #1427

merged 1 commit into from
Aug 18, 2025

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.

1 participant