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

Schema Validation #5

Open
codello opened this issue Apr 6, 2020 · 0 comments
Open

Schema Validation #5

codello opened this issue Apr 6, 2020 · 0 comments
Labels
enhancement New feature or request
Projects
Milestone

Comments

@codello
Copy link
Owner

codello commented Apr 6, 2020

Pydantic supports the generation of JSON Schema. This can be used to automatically support the validation of collections. The implementation should support the following:

  • Enabling/disabling validation via a validate flag in the model’s Mongo class.
  • Customization of the generated schema (this may be done directly via Pydantic)
  • Converting the schema to a MongoDB compatible format (stripping unsupported Keys, embedding referenced models etc.)
  • Using a custom validator instead of the automatically generated schema.
  • The implementation should be compatible with polymorphic and abstract documents:
    • Abstract documents in their function as blueprints can not be validated themselves. They can however enable validation options for any subclass by default.
    • Polymorphic models can be validated. Validation has to be enabled or disabled at the root level and is implemented as an $or combination of all sub-schemas. Submodels can use custom validation rules that will be used instead of the automatically generated schemas.
    • Using a strict validation mode may be interesting. Such a mode may enforce validation not via the $or operator but by using a more complex boolean predicate based on the model’s _type (Something like _type in … and _type=abc => $schema).
@codello codello added the enhancement New feature or request label Apr 6, 2020
@codello codello added this to the Version 1.0 milestone Apr 6, 2020
@codello codello added this to To do in Version 1.0 Apr 13, 2020
@codello codello mentioned this issue Apr 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
No open projects
Version 1.0
  
To do
Development

No branches or pull requests

1 participant