Late Binding #51

Open
gak10100 opened this Issue Jul 27, 2012 · 1 comment

Projects

None yet

2 participants

@gak10100

Maybe I am doing something wrong but does JSV support late binding?

schemas.createSchema( { 'id' : 'test', properties : { 'propa' : { 'type' : 'string', 'required' : true } } });
schemas.createSchema( { 'id' : 'test2', properties : { 'propb' : { 'type' : 'string', 'required' : true } }, 'extends' : { '$ref' : 'test' } });

console.log(schemas.validate({ }, { '$ref' : 'test2' }).errors);

This works fine and returns errors for both prop a and prop b.

schemas.createSchema( { 'id' : 'test2', properties : { 'propb' : { 'type' : 'string', 'required' : true } }, 'extends' : { '$ref' : 'test' } });
schemas.createSchema( { 'id' : 'test', properties : { 'propa' : { 'type' : 'string', 'required' : true } } });

console.log(schemas.validate({ }, { '$ref' : 'test2' }).errors);

this only validates propA

@garycourt
Owner

Late binding works for all references, except for the one case where a reference is within an "extends". This is a known bug and is due to how "extends" is implemented.

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