Skip to content

Validate schemas when Model constructor is invoked #7

@agarzola

Description

@agarzola

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions