lightblue-platform / lightblue-docs-specs

All specifications for lightblue.
GNU General Public License v3.0
1 stars 10 forks source link

Document enum descriptions #7

Open jewzaam opened 9 years ago

jewzaam commented 9 years ago

We added support for describing enum values but it doesn't appear to be in documentation.

http://jewzaam.gitbooks.io/lightblue-specifications/content/language_specification/metadata.html

jewzaam commented 9 years ago

Quick rundown of how this works.

For an enum you can define values or annotatedValues when creating/updating entityInfo. Metadata should always return the annotatedValues structure, even if there are no descriptions.

The idea here was to not break the service contract (json schema) for metadata but move towards forcing the annotatedValues structure.

@dcrissman did I get this right? I remember talking about this but I think it wasn't written down?

References:

dcrissman commented 9 years ago

When the enum is being parsed from json, annotatedValues OR values can be used. In the case that both are provided, annotatedValues wins and values is ignored altogether.

When converting an enum back to json however, both will be returned if possible. Meaning, values will always be present, and IF any enum contains a description, then the entire set of enums will also be returned in annotatedValues.