Skip to content
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 validation for sprite2 and sprite3 files #39

Merged
merged 3 commits into from
May 3, 2018

Conversation

kchadha
Copy link
Contributor

@kchadha kchadha commented May 3, 2018

Proposed Changes

Add support for .sprite2 and .sprite3 files (these aren't being created yet, so this PR does not include .sprite3 test fixtures). These changes include a refactor of the existing SB2 and SB3 validation such that:

  • Definitions have been moved to separate schema files (so that subschemas can be reused across sprite and project validation).
  • A new boolean arg is added to the top level API of this repo as well as the necessary library functions (unpack, unzip, validate) -- if true, this arg indicates that the given input should be validated as a sprite, if false, this arg indicates that the given input should be validated as a whole project.

Reason for Changes

scratchfoundation/scratch-gui#222

Test Coverage

kchadha added 3 commits May 2, 2018 23:46
refactor schemas to support sprite2 and sprite3 files, while reusing rules in common with sb2 and
sb3 files

BREAKING CHANGE: Change to main API which now takes an additional boolean argument indicating
whether a sprite or project is being validated
provide test coverage for sprite2 validation, and update sprite2_schema
Copy link
Contributor

@thisandagain thisandagain left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! I like how you have split up the schema. Just one major comment, but otherwise I think this is 👍 .

* @param {Function} callback Returns error or project data
*/
module.exports = function (input, callback) {
module.exports = function (input, isSprite, callback) {

This comment was marked as abuse.

This comment was marked as abuse.

This comment was marked as abuse.

This comment was marked as abuse.

@@ -7,7 +7,7 @@ test('sb', function (t) {
var set = data.sb;
t.plan(set.length * 2);
for (var i in data.sb) {
parser(data.sb[i], function (err, res) {
parser(data.sb[i], false, function (err, res) {

This comment was marked as abuse.

@thisandagain thisandagain removed their assignment May 3, 2018
@kchadha kchadha dismissed thisandagain’s stale review May 3, 2018 15:33

Merging as per conversation in the comments/offline

@kchadha kchadha merged commit f095938 into scratchfoundation:master May 3, 2018
@kchadha
Copy link
Contributor Author

kchadha commented May 3, 2018

🎉 This PR is included in version 4.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants