Discuss Scratch

nXIII
Scratcher
1000+ posts

SB2 Validator

SB2 Validator
A web app to help debug tools that output Scratch files. Get it here.

It currently supports .sb2 project files and .json project info files (support for sprite files is forthcoming). Drag and drop files anywhere onto the page or click to select a file from your computer. The validator will show “Valid” if the file conforms to the most recent Scratch file format, or show “Failed!” with error details if the file does not conform.

Note: The validator is very strict. Even if a file can be read by Scratch, it may not validate—files must closely match Scratch's own format, and include most of the information that Scratch includes in its own project files. This is to establish a minimum set of properties that programs can expect to see in Scratch files.

Extensions
The validator does not allow arbitrary properties in project.json files that Scratch does not use. However, it does allow extension properties beginning with x_. This helps other programs include additional information and metadata in a project file while avoiding future name conflicts with Scratch's properties. For example:
{
    // ...
    "info": {
        "hasCloudData": false,
        "videoOn": false,
        // ...
        "x_generator": "Awesome Scratch Compiler",
        "x_version": "2.1",
        "x_projectProperties": {
            "language": "JavaScript"
        }
    }
}

Browser Support
It works on the stable branches of Chrome, Firefox, and Safari. I only test Chrome regularly, so let me know if it stops working in any of those browsers.

Bugs
It has 'em. Please report any bugs you find on this thread, with (1) a link to a project which exhibits this bug and (2) a short description of the bug. See the bottom of this post for a list of known bugs.

Source Code
SB2 Validator is written in CoffeeScript. You can get the source (and license) on the Github repo.

Specification
There's no specification for the Scratch project file format, but SB2 Validator is written in a declarative style so it's easy to understand the format of project files. The declaration of window.schema (search for “@schema = ” in validate/index.coffee) is a readable description of the objects and types in the file format.

Last edited by nXIII (Dec. 19, 2013 22:02:00)


nXIII · GitHub
blob8108
Scratcher
1000+ posts

SB2 Validator

Bug: it doesn't recognise the “backgroundIndex” property for block watchers. project

tosh · slowly becoming a grown-up adult and very confused about it
nXIII
Scratcher
1000+ posts

SB2 Validator

blob8108 wrote:

Bug: it doesn't recognise the “backgroundIndex” property for block watchers. project
Thanks—fixed. That link is broken, but I tested it with a different project.

nXIII · GitHub
blob8108
Scratcher
1000+ posts

SB2 Validator

nXIII wrote:

That link is broken, but I tested it with a different project.
Dropbox lied to me! Cool, thanks.

tosh · slowly becoming a grown-up adult and very confused about it
nXIII
Scratcher
1000+ posts

SB2 Validator

Updated the list of menu names (removed some obsolete ones).

nXIII · GitHub
nXIII
Scratcher
1000+ posts

SB2 Validator

SB2 validator is now on Github! It has a nicer, shorter URL too: http://nathan.github.io/sb2/validate/

nXIII · GitHub
drmcw
Scratcher
1000+ posts

SB2 Validator

Error messages are somewhat unfriendly;

Failed!
Expected (one of at “scripts 0.2.2.1”) or undefined at “scripts”

?

10 !
ScratchVaders or Galaga?
Maybe Eliza can help you decide?
nXIII
Scratcher
1000+ posts

SB2 Validator

drmcw wrote:

Error messages are somewhat unfriendly;

Failed!
Expected (one of [all, this script, other scripts in sprite] at “scripts 0.2.2.1”) or undefined at “scripts”
The things in quotes show the key path and the things in brackets show the valid options. Could you share the project file that you were trying to validate?

nXIII · GitHub
drmcw
Scratcher
1000+ posts

SB2 Validator

nXIII wrote:

drmcw wrote:

Error messages are somewhat unfriendly;

Failed!
Expected (one of [all, this script, other scripts in sprite] at “scripts 0.2.2.1”) or undefined at “scripts”
The things in quotes show the key path and the things in brackets show the valid options. Could you share the project file that you were trying to validate?

It was Griffpatch's Scratchnapped project!

Because I was pretty sure it would fail

Last edited by drmcw (Dec. 19, 2013 22:32:52)


10 !
ScratchVaders or Galaga?
Maybe Eliza can help you decide?
nXIII
Scratcher
1000+ posts

SB2 Validator

drmcw wrote:

It was Griffpatch's Scratchnapped project!
Thanks for reporting that bug! I also found and fixed another one using the same project, and it now validates for me.

nXIII · GitHub
drmcw
Scratcher
1000+ posts

SB2 Validator

No problem. The reason I expected the validator to fail and still do for Scrathnapped is because in the monster sprite, on the when I receive Head Pound 2, in change variable yyy by chgY. the chgY looks like a parameter but it's not in a define block. Surely that should flag an error?

10 !
ScratchVaders or Galaga?
Maybe Eliza can help you decide?
nXIII
Scratcher
1000+ posts

SB2 Validator

drmcw wrote:

No problem. The reason I expected the validator to fail and still do for Scrathnapped is because in the monster sprite, on the when I receive Head Pound 2, in change variable yyy by chgY. the chgY looks like a parameter but it's not in a define block. Surely that should flag an error?
Yeah—I'm not doing a lot of semantic checking on the scripts right now, but that would be a useful error to throw.

nXIII · GitHub
drmcw
Scratcher
1000+ posts

SB2 Validator

If you want another nice one see this project. If you look at the latest comments I think they explain the issues. Hopefully they haven't been fixed especially the “undefined” block which I understand is left in on purpose if the ST wanted to see it.

10 !
ScratchVaders or Galaga?
Maybe Eliza can help you decide?
k9lego
Scratcher
1000+ posts

SB2 Validator

What's wrong with the ability to make changes (variable lists, etc.) to custom blocks? k9lego

- Let's Eat  Grandma! This is a hidden advertisement for the Collab Hyper Cloud Inc. :)
- Let's Eat, Grandma!
Commas Save Lives!























Nothing Much here…



















If you want to reply to me, please comment with the link to the topic “On my profile page”. thanks. k9lego
nXIII
Scratcher
1000+ posts

SB2 Validator

k9lego wrote:

What's wrong with the ability to make changes (variable lists, etc.) to custom blocks?
Sorry, I'm not sure I understand what you're asking.

nXIII · GitHub
k9lego
Scratcher
1000+ posts

SB2 Validator

nXIII wrote:

k9lego wrote:

What's wrong with the ability to make changes (variable lists, etc.) to custom blocks?
Sorry, I'm not sure I understand what you're asking.
One of the features I like in scratch is the ability to create those. k9lego.

- Let's Eat  Grandma! This is a hidden advertisement for the Collab Hyper Cloud Inc. :)
- Let's Eat, Grandma!
Commas Save Lives!























Nothing Much here…



















If you want to reply to me, please comment with the link to the topic “On my profile page”. thanks. k9lego
drmcw
Scratcher
1000+ posts

SB2 Validator

k9lego wrote:

nXIII wrote:

k9lego wrote:

What's wrong with the ability to make changes (variable lists, etc.) to custom blocks?
Sorry, I'm not sure I understand what you're asking.
One of the features I like in scratch is the ability to create those. k9lego.

Did anyone say it was wrong? If you think that was what was in scratchnapped then it isn't. It is in fact a bug. See this for an example.

Last edited by drmcw (Dec. 28, 2013 09:48:22)


10 !
ScratchVaders or Galaga?
Maybe Eliza can help you decide?
AxNoodle
Scratcher
2 posts

SB2 Validator

The validator says:
Expected (((_mouse_at“childeren.0.scripts.0.2.1.1”)or(sprite name at “childeren.0.scripts.0.2.1.1”)at“childeren.0.scripts.0.2.1.1”)or undefined at“childeren.0.scripts”) or (string at “childeren.0.target”)or (string at“childeren.0.listName”)at“childeren.0”

What is wrong?

Powered by DjangoBB

Standard | Mobile