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

Late Binding #51

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

Late Binding #51

gak10100 opened this issue Jul 27, 2012 · 1 comment
Labels

Comments

@gak10100
Copy link

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
Copy link
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
Labels
Projects
None yet
Development

No branches or pull requests

2 participants