-
Notifications
You must be signed in to change notification settings - Fork 55
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
More precise typing of XML elements #177
Comments
If we are doing cardinality we should consider it for records to be able to do better schemas for json too. See: https://docs.google.com/document/d/1U7tCYaTC9Xx2pKeNrH-Xdw14zPHGm9T2uWTE52SPw10/edit for json schema to Ballerina mapping work. |
What is cardinality for records in JSON schema? |
So in our terms a min/max constraint on the length of a mapping value? That's pretty funky. Not obvious to me what the use cases for that are. |
Yes that's what it means. Definitely funky .. |
There's a reasonably obvious syntax for us for the array case |
Note that this issue is not about extending the value space of the XML basic type to handle the PSVI (see issue #249), it's about being able to describe useful subtypes of the our current XML value space. |
There is an obvious way to handle ordering and cardinality, which is described in issue #251. |
We can build on #176 to provide more precise typing of XML elements, by making an xmlelement have type parameters
xmlelement<E,A,C>
, wheremap<string>
specifying attributes, andxml<xmlelement|string>
specifying type ofx.getChildren().strip()
(this is because you want comments, PIs, and whitespace to always automatically allowed)We can then use our type system to write a useful schema for an XML document. Other things that would make this work better include:
ns:*
as a subtype of string typeThis doesn't deal with the ordering or cardinality of child elements. I think ordering would be very hard, but perhaps cardinality is doable. By cardinality I mean saying that this element has between M and N elements named foo (typically M is 0 or 1 and M is 1 or unlimited).
The text was updated successfully, but these errors were encountered: