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
Add metadata to specification schema. #448
Comments
|
We use semantic versioning format for version name, so we probably want to keep that.
Note that while we plan to release Vega-Lite 1.0 soon, we do not plan to include Vega-Lite Shorthand in the official release. Vega-Lite shorthand is subject to further revision and will be released as a separate project. But once VLS is released, it makes sense to support it in |
Regarding the version number and semantic versioning, I think a "major.minor" format is probably needed. Following semver, the specification schema may add new features as part of a minor version. Non-backwards-compatible changes would require a major version change. I don't see a compelling reason to include patch numbers, which should not change the feature footprint of the specification schema. So far, it sounds like the consensus is: (1) add "version" as a supported (and strongly encouraged) JSON property of both Vega and Vega-Lite JSON specs, (2) include support for "version" and "content-type" (or similar) within the |
I like the idea of including version numbers as part of Vega/Vega-Lite specifications, and a
My only concern with this is that for the past couple of releases, we have been including breaking changes with minor version bumps. So our take on semantic versioning, thus far, has been: "major release" = major new features (e.g., declarative interaction design + streaming data) + major breaking changes; "minor release" = minor new features (e.g., new transforms) + minor breaking changes (e.g., renaming Moving forward, here are some options I see:
|
I think we should not confuse code versioning with data format versioning. Code semantic versioning is useful because code is a blackbox for the caller - so as long as the api is the same and it does the same thing for the old way of calling it, the new version will continue to work. With data, there is no API - parser must know every aspect of the data, or else it will make a mistake. There are very few situations when major/minor version distinction would make a difference for the parsing code. For example, if we add an extra field to the spec, unless parser understands it, it will produce an incorrect graph without throwing an error. Same if the meaning of a field changes, or if we allow multiple field types, e.g. both "object or a string" for a value instead of "string only". The only time when parser might still produce a correct graph without knowing of the change beforehand is if we remove (disallow) a specific field or a value - because than parser would simply not use its code to handle the removed field, and even then it might break. So in short, either the given parser version knows about the specific data version, or it doesn't, and should throw an error. Hence, lets simplify and use a number. Besides, in JSON, there is no difference between 1 and 1.0, so if we really want to introduce it later on, we could. |
Another option would be utilizing the standard |
I second @kanitw's suggestion. What are your thoughts on using Vega{
"$schema": "https://vega.github.io/vega/v3.0/schema.json",
"width": 400,
"height": 200,
"padding": 5,
"data": [
{
"name": "table",
"values": [
{"u": 1, "v": 28}, {"u": 2, "v": 55},
{"u": 3, "v": 43}, {"u": 4, "v": 91},
{"u": 5, "v": 81}, {"u": 6, "v": 53},
{"u": 7, "v": 19}, {"u": 8, "v": 87},
{"u": 9, "v": 52}, {"u": 10, "v": 48},
{"u": 11, "v": 24}, {"u": 12, "v": 49},
{"u": 13, "v": 87}, {"u": 14, "v": 66},
{"u": 15, "v": 17}, {"u": 16, "v": 27},
{"u": 17, "v": 68}, {"u": 18, "v": 16},
{"u": 19, "v": 49}, {"u": 20, "v": 15}
]
}
],
"scales": [
{
"name": "xscale",
"type": "band",
"range": "width",
"domain": {"data": "table", "field": "u"}
},
{
"name": "yscale",
"type": "linear",
"range": "height",
"domain": {"data": "table", "field": "v"},
"zero": true,
"nice": true
}
],
"axes": [
{"orient": "bottom", "scale": "xscale"},
{"orient": "left", "scale": "yscale"}
],
"marks": [
{
"type": "rect",
"from": {"data": "table"},
"encode": {
"enter": {
"x": {"scale": "xscale", "field": "u", "offset": 1},
"width": {"scale": "xscale", "band": 1, "offset": -1},
"y": {"scale": "yscale", "field": "v"},
"y2": {"scale": "yscale", "value": 0}
},
"update": {
"fill": {"value": "steelblue"}
},
"hover": {
"fill": {"value": "red"}
}
}
}
]
} Vega-Lite{
"$schema": "https://vega.github.io/vega-lite/v2.0/schema.json",
"description": "A simple bar chart with embedded data.",
"data": {
"values": [
{"a": "A","b": 28}, {"a": "B","b": 55}, {"a": "C","b": 43},
{"a": "D","b": 91}, {"a": "E","b": 81}, {"a": "F","b": 53},
{"a": "G","b": 19}, {"a": "H","b": 87}, {"a": "I","b": 52}
]
},
"mark": "bar",
"encoding": {
"x": {"field": "a", "type": "ordinal"},
"y": {"field": "b", "type": "quantitative"}
}
} The exact URLs are not set in stone but I imagine that we could have a registry of versioned schemas that also supports semantic versioning (redirecting from |
https://github.com/vega/schema has the schemas. We have to set up some infrastructure to automatically copy schema files but we are good to go to use |
I've released a little helper function to get the version and library from a schema at https://www.npmjs.com/package/vega-schema-url-parser. |
This conversation is long-closed, but...any thoughts on adding a user-defined stub for arbitrary metadata to the spec? E.g. a top-level My use case as one example: I'm converting an existing, proprietary schema to Vega, and there is information in the old schema that the application using these charts needs regardless of how the charts are specified or rendered. Currently, I'm able to use the |
@ericsoco This should be an easy addition to the schema. I support the idea but only if we do it in Vega and Vega-Lite. If everyone agrees, could you send us a PR? |
Certainly. Let me know when I have the greenlight, will follow this conversation... |
(Moving an offline discussion among @jheer, @arvind and @nyurik here for public sharing and archiving.)
Questions:
Thoughts?
The text was updated successfully, but these errors were encountered: