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

Validate schemas when Model constructor is invoked #7

Open
agarzola opened this issue Jun 16, 2018 · 0 comments
Open

Validate schemas when Model constructor is invoked #7

agarzola opened this issue Jun 16, 2018 · 0 comments

Comments

@agarzola
Copy link
Member

When a CustomModel is created, the object passed in to the Model constructor should be validated. Criteria should be as follows:

  • type and endpoint must be strings and cannot be missing.
  • endpoint should start with a / and have only URL-safe characters.
  • Schema object should not have any property names that collide with Jsonmonger’s interface:
    • built-in method and property names: fetch, save, destroy, toObject, saved
    • common internal property names, such as __schema, __changed, etc.
    • It might make sense to validate this programmatically, so that new internal properties or built-ins are automatically reserved.
  • Properties pointing at relationships should be checked for depth. relationships.field_name is correct; relationships.field_name.data is not.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant