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

Anonymous schema #12

Open
moll opened this issue Feb 8, 2015 · 4 comments
Open

Anonymous schema #12

moll opened this issue Feb 8, 2015 · 4 comments

Comments

@moll
Copy link

moll commented Feb 8, 2015

Hey,

When I create a simple anonymous schema (without an explicit "id"), I've got to call its validate function with a fake "0" as the schema name. Could this implementation detail be hidden to just allow calling the function with an object and without a name?

var validate = Themis.validator(schema)
validate({}, "0")

Thanks!

@kumarharsh
Copy link
Member

Hi. The issue is that the validator function can work with both a schema object, and an array of schemas. It's is a minor inconvenience though :)

@moll
Copy link
Author

moll commented Aug 1, 2015

Mkay, then validator could return different types of validate functions depending on whether given an array or not, right?

@atrniv
Copy link
Member

atrniv commented Aug 1, 2015

@moll, I think returning different types of validate functions makes sense. You can open a pull request for the same and I'll merge it.

@kumarharsh
Copy link
Member

Actually I was working on this (the first proposal, of allowing the retrieval of a lone schema), but seems like it's not going to be as trivial as I first presumed... especially, as the _schemas object keeps changing, and the sub-schemas are added to the original schema list passed by the user.

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

No branches or pull requests

3 participants