On 11/11/2011 7:19 PM, Erik Sundvall wrote: > When a value (e.g. upper bound) may be either a number or a symbol (* > or infinity) most recieveing software will need to have logic > separating the cases anyway, no matter how they are serialized. > So then I wonder how much harder it would be to include string parsing > logic so that we can have JSON-fields with string values like... > "occurrences": "1..*" > > Will a string pattern be good enough for validation by auto-generated > validators or does separation into fields clearly make auto-generated > validators more capable in this case? I'd agree with Eric here. The minute the receiving end has to deal with "*" or "number" then the data binder is going to need some special logic. You mind as well make the logic deal with parsing "1..*". It's not like that is much more of a challenge.
So from an XML point of view we could then have <children node_id="at0005" occurrences="1..*"> or for where we need elements <occurrences value="1..*"> To specify wildcards for "upper" in XSD would have taken a regex string restriction anyway - the regex for the "n..*" form is similar complexity. The range string is easily implementable for JSON and YAML. Andrew

