How best to interpret/parse "items" with no "role" or "valType"
See original GitHub issueI realize this may not be the best place to ask this. If so please redirect me to a more appropriate forum.
My testing of a Scala wrapper failed on (among others) these mocks:
- gl2d_parcoords_select_first_last_enum.json
- cheater_constraint_greater_than_with_hill.json
- mocks/box-violin-x0-category-position.json
- indicator_format_extremes.json
- splom_lower-nodiag-matching.json
- bar-alignment-offset.json
- cheater_constraint_outer_range_hi_top.json
- fonts.json
I have realized that all have a schema with the following shape (example based on gl2d_parcoords_select_first_last_enum.json
):
"dimensions": {
"items": {
"dimension": {
"label": {
"valType": "string",
"role": "info",
"editType": "plot",
"description": "The shown name of the dimension."
},
"tickvals": {
"valType": "data_array",
"editType": "plot",
"description": "Sets the values at which ticks on this axis appear.",
"role": "data"
},
"role": "object"
},
"role": "object"
},
Looking at the JSON documents, it seems like "items"
is a JSON array that contains objects of a specific type (in the example above it would be "dimension"
). But the schema does not seem to make this explicit. Trying to work out how to parse this consistently. How should I go about it - can I assume that this is always so?
I may be missing something, but this may be a candidate for another "valOjects"
. By tagging "items"
it would make it easier to parse.
Appreciate any help.
Issue Analytics
- State:
- Created 3 years ago
- Comments:10 (7 by maintainers)
Top GitHub Comments
Anything to do with the schema should be reported here in Plotly.js, as this is where the schema is maintained. The Plotly.py project auto-generates Python code based on this schema, so we can draw lessons from how we do things in Python for your Scala project, but the “single source of truth” for the structure of things is here.
(edited for clarity)
I think that last one is just a quirk in the
indicator_attrs
mock… you’ll see in the baseline image that this is being ignored I think: https://github.com/plotly/plotly.js/blob/master/test/image/baselines/indicator_attrs.png (there is no blue range between -100 an 100. We should probably fix that mock and update the baseline!Regarding the interpretation @jonmmease will be able to better speak to how we handle this in Python but yes, in general I think we treat
to mean
things
is an ordered list ofthing
objects which have the givenspec
. I think in all cases there is a"role": "object"
set there, so it doesn’t seem all that ambiguous to me…