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
Define TD Fragment #579
Define TD Fragment #579
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: "JSON Fragment" has been defined as a JSON element that is not an object or array, e.g. a basic value like a string or number. A TD Fragment could be a JSON Fragment (i.e. just a string) but it MIGHT also be an object or array (eg a DataSchema) (at least in the Discovery use case).
We have to decide if the name will be confusing because of this. If we feel it would be, we might want to pick another name. Options might include "TD Component", "TD Element", or "TD Node". "Component" may conflict with names we might want to use later for modularity, though. "Node" may conflict with use of this term in RDF. So if we DO have to change the name, I'd vote for "TD Element". We might also want to see if there is a definition in JSON for the concept we want and use that to align better with JSON.
Update: I looked at various JSON docs and it seems "Element" is used with the meaning we want (superclass of Arrays, Objects, and (JSON) Fragments).
<dd> | ||
A <a>TD Fragment</a> is a substructure of the data model of a TD. | ||
It is a valid object structure that can be validated syntactically against a part of the TD datamodel | ||
defined in chapter 5 of the TD spec, however the fragment may omit some context that allows full validation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should replace reference to "chapter 5" with a link that uses the section name (eg "Information Model"). Also, the link should probably not be an actual link, but a reference.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mmccool Please provide an appropriate link
omitting outer elements, curly braces etc. present in a full TD. | ||
|
||
As a use case the <a>TD Fragment</a> is useful for Discovery results returned by a JSON-Path query. | ||
See the <a href="https://www.w3.org/TR/wot-discovery/</a> for more details. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Direct link should be a reference. It might also be helpful to mention a particular section or link to an example.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mmccool Please provide an appropriate link
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question. Is the following a valid TD fragment? It is not valid JSON...
"status": {
"type": "string"
}
<dd> | ||
A <a>TD Fragment</a> is a substructure of the data model of a TD. | ||
It is a valid object structure that can be validated syntactically against a part of the TD datamodel | ||
defined in chapter 5 of the TD spec, however the fragment may omit some context that allows full validation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"the fragment" perhaps should be "the TD Fragment" to be consistent with other usages
BTW, some refs for JSON, although I can't find definitions of "JSON fragment" or "JSON element" in there. I will do a bit more research; these do seem to be common terms, but may not be in the official standards: |
ECMA-404 defines the "JSON Value" grammar, which I think is what we want to call "JSON Element" I came across the following "JSON fragment" definition (https://medium.com/grand-parade/creating-type-safe-json-in-swift-74a612991893), which may be useful: A JSON fragment is a JSON that does not have an Object or an Array as the root. |
I think there are different interpretations what a fragment is.
|
Arch call on 11.2. |
Adding TD Fragment definition as proposed in arch call 2 weeks ago.
May need some minor editorial changes.
resolves #574
Preview | Diff