aml
aml copied to clipboard
Improve error messge when number range constraint fails.
cat schema.acorn
{
"items": [
{
aPositionNumber: number > 0
anExplicitConstant: string == "value"
aRegex: string =~ "str.*"
aNumberRange: number > 0 && number < 10 || default 1
defaultedString: "hi"
}
]
}
items: [{aPositionNumber: 1
anExplicitConstant: "value"
aRegex: "stripe"
aNumberRange: 10
defaultedString: "hello"
}
]
Following are error messages presented when aNumberRange
is set as 11 ,0, 10
aml eval --schema-file schema.acorn file.acorn
2023/10/03 15:07:07 schema violation items.0.aNumberRange: option 1: [must match alternate],
option 2: [unmatched constraint 11 < 10],
option 3: [unmatched constraint 11 == 1]
% aml eval --schema-file schema.acorn file.acorn
2023/10/03 15:08:21 schema violation items.0.aNumberRange: option 1: [must match alternate],
option 2: [unmatched constraint 0 > 0],
option 3: [unmatched constraint 0 == 1]
% aml eval --schema-file schema.acorn file.acorn
2023/10/03 15:09:00 schema violation items.0.aNumberRange: option 1: [must match alternate],
option 2: [unmatched constraint 10 < 10],
option 3: [unmatched constraint 10 == 1]
What is "must match alternate" mean here?