Open Torniojaws opened 5 years ago
Added to User registration form. Can use the same for all others.
Schematics seems to be abandoned. JSONSchema seems to be alive: https://python-jsonschema.readthedocs.io/en/stable/
>>> from jsonschema import validate
>>> # A sample schema, like what we'd get from json.load()
>>> schema = {
... "type" : "object",
... "properties" : {
... "price" : {"type" : "number"},
... "name" : {"type" : "string"},
... },
... }
>>> # If no exception is raised by validate(), the instance is valid.
>>> validate(instance={"name" : "Eggs", "price" : 34.99}, schema=schema)
>>> validate(
... instance={"name" : "Eggs", "price" : "Invalid"}, schema=schema,
... )
Traceback (most recent call last):
...
ValidationError: 'Invalid' is not of type 'number'
https://schematics.readthedocs.io/en/latest/
eg.
Could/Should be used in pretty much all endpoints, but the critical parts are places where Users can input something (Guestbook for now, but later all news/release/song/photo, etc comments).
Public:
User-accessible:
"Automatic" things:
Admin-only: