-
Notifications
You must be signed in to change notification settings - Fork 63
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
Rename of label to title and enum titles 'oneOf' #156
Comments
Good question. In general, JSON Schema offers the term title for such kind of purpose (also see http://json-schema.org/latest/json-schema-validation.html#rfc.section.10.1). It seems that we have a conflict with TD's label term (which I would prefer). In tomorrow's web meeting I will discuss this issue. |
In Hypertext Links in HTML, it is advised that "title" was meant for an advisory title for the linked resource, whereas "label" was a label for the link. |
This is related to the Way forward
|
After some distance, I am in preference of
|
@handrews As I saw some recent activity, may I ask your input on the naming of a human-readable field to shortly describe Interactions? (name, label, title, ...) In particular, I would like to know the history on why 'title' in JSON Schema. My guess is Web Linking, yet (also historically there) a title is for a document and not individual items within a representation... |
@mkovatsc There are two Both are intended for short human-readable descriptions (with As for |
@mkovatsc wrote:
I think that's correct, title in web linking provides a title for the linked document. From a purely linguistic point of view I'd say that in English "title" is most commonly used to mean the name of a book, document. composition or artistic work. Also the name of a position or job, and in law a "title" is a right or claim to the ownership of property. "name" or "label" seem like more obvious choices for this use case. @handrews: The only mention of "title" I could find in JSON Schema Core spec is in section 4.3.3. Root Schema and Subschemas. Is that intended as a title for the schema? |
@benfrancis The Core spec only defines a few keywords (although in the next draft a few more move over to core for reasons too involved to go into here and not immediately relevant). This means that when we need examples in the Core spec we often have to use keywords from elsewhere. It's on my TODO list to be more clear about where those examples come from. The two places |
Oops forgot to actually answer the question- that |
I took the information from http://json-schema.org/latest/json-schema-validation.html#rfc.section.10.1
For TD, it is kind of a dice roll between May I ask for opinions on which to choose? |
@mkovatsc The "can be used to decorate a user interface..." is basically an example of usage (hence "can" rather than "SHOULD" or even "MAY"). "application-defined" in this sense could include the TD saying "in the context of the TD, JSON Schema's I wouldn't call the behavior "unsettled". Rather, as we realized the very wide range of possible reasonable uses of these keywords, we settled on deferring specifics to applications to avoid either invalidating common use cases or having an explosion of keywords with very minor behavioral differences among them. I'm still working on how to best explain this flexibility in the spec. From a JSON Schema perspective, if |
@handrews To paraphrase it a bit, I would say the spec encourages to use term Would you agree with this statement? |
@mkovatsc The current spec does give that impression, but I've actually been meaning to take out the UI usage references and emphasize the flexibility instead. The keywords in the Schema Annotation section, including The larger plan is to have a UI-specific vocabulary, which would build on what's already in the validation spec but would add keywords with clear and predictable UI-oriented semantics. There are similar plans for a code generation vocabulary, which would add keywords to disambiguate things like "is this The current "Schema Annotations" section will still exist as a really basic and flexible set of common keywords, but for more complex scenarios where clear, well-defined semantics are needed, we want to encourage developing specific vocabularies for those scenarios. Most of the work in draft-08 is going towards enabling well-defined, compose-able schema vocabularies. Which is not a real formal concept in JSON Schema right now. |
Another related use case that has come up is providing human-readable labels for enums. Where the options for a property or action input are rendered as a drop-down in a form it can be helpful to provide human-readable labels in addition to machine-readable values. An example pointed to by @trentrand shows two ways this is sometimes done with JSON Schema. One using a non-standard enumNames field:
And one using a more standard (from JSON Schema Validation) but verbose schema:
Either of which might be rendered as:
|
@sebastiankb We need to move forward here. Since there were no objections, I would say we change Choosing @benfrancis The issue with enum titles should probably brought to JSON Schema, and we pull it back into TD. @handrews , of course we can work together on this. |
@benfrancis BTW, from where do you get the vocabulary for |
@mkovatsc wrote:
This rationale all makes sense, it's just slightly unfortunate that we landed on "title" because linguistically "title" feels a bit awkward for these use cases, both "name" and "label" would sound better to my ear. I don't have another suggestion so I've asked our team for input just in case.
We reference SI units (The [SI] reference in ReSpec points to https://www.bipm.org/en/publications/si-brochure/) and use the long form (e.g. "metre"/"kilogram"). |
@mkovatsc the recommended way for to handle titled enumerations of uniform type is:
One-element |
@handrews Thanks, that should solve the use case. @benfrancis I fail to get a proper vocabulary from https://www.bipm.org/en/publications/si-brochure/. It seems to be just a documentation about the SI system. For instance, there is already a mismatch between their "metre" and your "meters" used above. This will not work for M2M. |
@mkovatsc wrote:
If by a "proper vocabulary" you mean an RDF vocabulary, then no, we haven't found that necessary. It's a human readable specification. The 7 base units are:
then there are many possible derived units and non-SI units accepted for use with the SI.
That's just a mistake on my part. |
I chatted with the people behind QUDT and their work is pretty thorough, and relates to the underlying dimensional basis for each unit. However, QUDT can be rather cumbersome compared to a simpler approach that defines vocabularies of terms that combine what is being measured (e.g. electrical current), the unit (amperes) and the scale (1000 for milliamperes). An ontology then maps these to the QUDT framework. In practice, for JSON, you can then write "units": "milliamps". The common abbreviations for units in a few cases may be used for different things in different fields. This can be easily addressed through the JSON-LD context for a given field. People would then be able to write "units": "mA". Common abbreviations may use greek letters e.g "μA" for microamps. These can be a little difficult to enter, but browser extensions etc. make this much easier. |
I would also like to throw the UCUM specification into the ring. There is a recent paper by @maximelefrancois86 (one of the SSN editors) which introduces a very usable unit system. |
@lgleim Yes, I also had that one in mind, as it was used in CoRE, LWM2M, and IPSO before. I was not sure if an RDF vocabulary exists ready to use. |
@mkovatsc The corresponding vocabulary would be http://w3id.org/lindt/custom_datatypes - as far as I understand there are two ways this vocabulary could be employed:
There is also a nice playground to see the vocabulary in action: https://ci.mines-stetienne.fr/lindt/playground.html I have seen a demo of UCUM + RDF before and found it quite convincing but I am not familiar with QUDT. Maybe @maximelefrancois86 can clarify a bit more, since he should be familiar with both vocabularies given his involvement in the SSN design? |
fyi: |
oneOf is now also part in the TD: 094e9ae |
@sebastiankb ,thank you for the change. |
@takuki thanks |
When adding labels to properties and actions in Mozilla's implementation as per the latest Editor's Draft, @mrstegeman asked:
Should there also be labels for events, event data and action inputs?
As an example use case, we generate graphical forms for action inputs from the JSON Schema in a Thing Description.
For example, an action like:
Would be rendered like this:
It would be nice to provide more human-friendly labels for those input fields.
We also render a log of events, like this:
It could be straightforward to add
label
to events as well as properties and actions. Could JSON Schema also accommodate human-friendlylabel
s for sub-properties of objects?The text was updated successfully, but these errors were encountered: