Sort plot-schema and add test to track plot-schema changes#5776
Merged
Sort plot-schema and add test to track plot-schema changes#5776
Conversation
…enerated one in dist folder
Co-authored-by: Alex Johnson <johnson.alex.c@gmail.com>
tasks/util/sort_object.js
Outdated
| for(var i = 0; i < allKeys.length; i++) { | ||
| var key = allKeys[i]; | ||
| var v = obj[key]; | ||
| newObj[key] = (typeof v === 'object' && v !== null && !(v instanceof Array)) ? |
Collaborator
There was a problem hiding this comment.
Actually we need to dig into arrays too, right? We've got stuff in the schema like:
"items": [
{
"valType": "number",
"min": 0,
"max": 1,
"editType": "calc"
},
{
"valType": "number",
"min": 0,
"max": 1,
"editType": "calc"
}
],
Contributor
Author
There was a problem hiding this comment.
Good call.
aea3022 also fixed cases where arrays e.g. enumerated valType turned into objects!
Before:
"values": {
"0": "forward",
"1": "reverse"
}After
"values": [
"forward",
"reverse"
]- ensure identical number of lines present in sorted schema
alexcjohnson
reviewed
Jul 7, 2021
Co-authored-by: Alex Johnson <johnson.alex.c@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #5588.
In PRs after this when there is a change in attributes (e.g. to implement a new feature), one should simply run
and commit the
test/plot-schema.jsonfile.On CircleCI, that schema file would be tested against the auto-generated baseline at
dist/plot-schema.json.In the case of any difference a diff is presented and test should fail.
We also added a message on CircleCI asking contributors to run
npm run schemaand commit the results in the "test" folder (i.e. similar to baseline changes).This would help track the changes to the API way before release cycles, right when a feature/documentation PR is submitted or even before.
In addition to above,
compress_attributesbrowserify transform is now disabled to generateplotly.jsfiles in thebuildfolder which not only decreases the build & rebuild times but also help make this possible.@plotly/plotly_js