-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
How best to interpret/parse "items" with no "role" or "valType" #4707
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
Comments
Hmm that does seem confusing... @nicolaskruchten @jonmmease care to comment on how plotly.py identifies container arrays in the schema? |
I have now found the indicator schema has the same structure: "steps": {
"items": {
"step": {
"color": {
"valType": "color",
"editType": "plot",
"role": "info",
"description": "Sets the background color of the arc."
},
"line": {
"color": {
"valType": "color",
"role": "info",
"dflt": "#444",
"editType": "plot",
"description": "Sets the color of the line enclosing each sector."
},
"width": {
"valType": "number",
"role": "info",
"min": 0,
"dflt": 0,
"editType": "plot",
"description": "Sets the width (in px) of the line enclosing each sector."
},
"editType": "calc",
"role": "object"
},
"thickness": {
"valType": "number",
"role": "info",
"min": 0,
"max": 1,
"dflt": 1,
"editType": "plot",
"description": "Sets the thickness of the bar as a fraction of the total thickness of the gauge."
},
"editType": "calc",
"range": {
"valType": "info_array",
"role": "info",
"items": [
{
"valType": "number",
"editType": "plot"
},
{
"valType": "number",
"editType": "plot"
}
],
"editType": "plot",
"description": "Sets the range of this axis."
},
"name": {
"valType": "string",
"role": "style",
"editType": "none",
"description": "When used in a template, named items are created in the output figure in addition to any items the figure already has in this array. You can modify these items in the output figure by making your own item with `templateitemname` matching this `name` alongside your modifications (including `visible: false` or `enabled: false` to hide it). Has no effect outside of a template."
},
"templateitemname": {
"valType": "string",
"role": "info",
"editType": "calc",
"description": "Used to refer to a named item in this array in the template. Named items from the template will be created even without a matching item in the input figure, but you can modify one by making an item with `templateitemname` matching its `name`, alongside your modifications (including `visible: false` or `enabled: false` to hide it). If there is no template or no matching item, this item will be hidden unless you explicitly show it with `visible: true`."
},
"role": "object"
}
},
"role": "object"
}, but a corresponding mock:
does not use an array but an object. So my question is: is this an example of what happens for a single item or is this a possibly invalid value (according to the schema)? TIA |
(edited for clarity) I think that last one is just a quirk in the 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 |
I guess it is a little ambiguous that "having |
@nicolaskruchten As long as it is consistent, its not ambiguous. I will change my side to look for this combination (currently not checking the |
OK, please let us know if there are any inconsistencies! If you're able to submit a PR that just deletes the ignored attributes in any broken mocks, that would be more helpful :) |
@plotly/plotly_js is this mock the kind of thing that would be caught by calling our validation code? Should we fail mocks that fail validation by default, so that we don't drag around this code in mocks that does nothing? |
Tracked in #4733. |
@nicolaskruchten Will submit a PR then. One more question: should these consistency issues be placed here in plotly.js or in plotly.py |
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. |
…as discussed in issue plotly#4707.
I 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:
I have realized that all have a schema with the following shape (example based on
gl2d_parcoords_select_first_last_enum.json
):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.
The text was updated successfully, but these errors were encountered: