Skip to content

Schemas: Add maxNumberOfValues (and if feasible, minNumberOfValues) to each attribute in requiredAttributes and optionalAttributes, and include validation on these values #302

@reganwolfrom

Description

@reganwolfrom

NOTE: minNumberOfValues and maxNumberOfValues refers to the number of values, not a number within a single value.

Currently, there is no way to restrict the number of values for an attribute in a schema, i.e., you cannot restrict to only allow a single stringValue or numberValue, nor can you specify "pick at least three of".

Ideally, if there is a minNumberOfValues above the default of 0 or a maxNumberOfValues above the default of 0, validation would be used to ensure the total number of stringValue/stringValues or numberValue/numberValues is within the specific range.

In order to not create conflicting instructions, my recommendation is that there should be no minNumberOfValues=1 accepted, as this would be handled by the attribute being listed as "required"; only 0 or 2+ would be allowed. There would be no such limitation on maxNumberOfValues.

Examples:

When minNumberOfValues=0, maxNumberOfValues=0:
no validation needed

When minNumberOfValues=1,maxNumberOfValues=0:
this setting should be rejected, i.e., should fail to save, as we already use required/optional for this check

When minNumberOfValues=0,maxNumberOfValues=1
this setting prevents numberValues or stringValues from being used; only numberValue and stringValue would be allowed

When minNumberOfValues=2, maxNumberOfValues=1
this setting should be rejected, i.e., should fail to save

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions