Other types of Schema

Learn the different types of schemas in DontTrust

Types of schema

There are many different types of schemas, namely:

  • string
  • number
  • boolean
  • date
  • email

Changing the schema type:

There are two ways to change the type of a schema:

# 1. Use the Schema.TYPE() function:

from donttrust import Schema

schema = Schema().string()
schema = Schema().number()
schema = Schema().boolean()
schema = Schema().date()
schema = Schema().email()


# 2. Directly use the class

from donttrust.schema import StringSchema
from donttrust.schema import BooleanSchema
from donttrust.schema import NumberSchema
from donttrust.schema import EmailSchema
from donttrust.schema import DateSchema

schema = StringSchema("fieldname")
schema = BooleanSchema("fieldname")
schema = NumberSchema("fieldname")
schema = EmailSchema("fieldname")
schema = DateSchema("fieldname")
When you use the second method, you HAVE to fill the field parameter.

Edit this page on Github