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 server validation of documents #138

Open
deontologician opened this issue Feb 24, 2016 · 7 comments
Open

Add server validation of documents #138

deontologician opened this issue Feb 24, 2016 · 7 comments

Comments

@deontologician
Copy link
Contributor

This is to enable a write to go through by validating that the resulting document is valid, but is separate from security rules

@dalanmiller
Copy link
Contributor

Where would one specify the required schema? Via a config file?

@deontologician
Copy link
Contributor Author

Yeah, it'll have to be.

@deontologician
Copy link
Contributor Author

Things that were discussed:

  • Validation checks should be done on the final document to be written
  • We should use json-schema for validation
    • this would lend itself to being implemented in RethinkDB itself
    • Keeps the validation language simple and standardized
    • several libraries are capable of emitting json schema
  • This is orthogonal to both permissions and transactional writes
  • Not settled whether to fail if any write doesn't validate, or just to keep going and report failures

@deontologician deontologician added this to the Subsequent milestone Feb 25, 2016
@danielmewes
Copy link
Member

Not settled whether to fail if any write doesn't validate, or just to keep going and report failures

I think validation only makes sense if we fail. The case where we weren't sure was for reads (whether to filter out documents that the user doesn't have permissions on, or fail).

Another thing that we discussed:
In addition to json-schema validation, advanced users could also install their own atomic ReQL validation functions (but not arbitrary JS).

@josephg
Copy link

josephg commented May 18, 2016

Yeah this would be great. Its irresponsible to allow clients to store arbitrary documents - you really want some (simple) schema validation for almost anything you store.

Calling schema validation code from inlined javascript strings in config.toml is super awkward.

@sachinbhutani
Copy link

It would be great, if it could be a generic hook, which may be used for validation change update or something else.
Also, could it be isomorphic ?

@kiejo
Copy link

kiejo commented May 23, 2016

Making it isomorphic would be great as this should make it easier to implement offline support with optimistic updates.

What might also be interesting would be to include transformation capabilites which would allow using functions like trim or toLowerCase on fields.

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

6 participants