Summary
Currently extends field is defined as oneof of single string vs array of strings. This makes validation and usage really complicated where just an array of strings where there is a validation for a single item in some cases would be much simpler
source/schemas/capability.json
Motivation
Having structures with non-defined types for fields make implementations harder where there needs to be validations for types. In this case it seems unnecesary as replacing a single string for an array of strings, and adding the restriction of a single item would be much simpler
Goals
- Simplify implementation
- define clearer types for fields
Detailed Design
{
"type": "object",
"properties": {
"extends": {
"oneOf": [
{
"type": "string",
"pattern": "^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$"
},
{
"type": "array",
"items": {
"type": "string",
"pattern": "^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$"
},
"minItems": 1
}
],
"description": "Parent capability(s) this extends. Present for extensions, absent for root capabilities. Use array for multi-parent extensions."
}
}
}
by
{
"type": "object",
"properties": {
"extends": {
"type": "array",
"items": {
"type": "string",
"pattern": "^[a-z][a-z0-9]*(?:\\.[a-z][a-z0-9_]*)+$"
},
"minItems": 1
}
"description": "Parent capability(s) this extends. Present for extensions, absent for root capabilities."
}
}
}
Risks and Mitigations
This is a breaking change as defined, unless we keep the oneof versino but discourage the use of single string.
Summary
Currently
extendsfield is defined as oneof of single string vs array of strings. This makes validation and usage really complicated where just an array of strings where there is a validation for a single item in some cases would be much simplersource/schemas/capability.json
Motivation
Having structures with non-defined types for fields make implementations harder where there needs to be validations for types. In this case it seems unnecesary as replacing a single string for an array of strings, and adding the restriction of a single item would be much simpler
Goals
Detailed Design
Data Structures: D
Replace
extendsfield in capability for array onlyby
Risks and Mitigations
This is a breaking change as defined, unless we keep the oneof versino but discourage the use of single string.