Structure
Structure v1
Structure v1
  • Introduction
  • Schema concept
    • Shorthand and complete type descriptor
    • Circular reference
    • Nullable attributes
  • Coercion
    • Primitive type coercion
    • Arrays coercion
    • Generic coercion
    • Recursive coercion
    • Observations
  • Validation
    • String validations
    • Number validations
    • Boolean validations
    • Date validations
    • Array validations
    • Attribute reference
    • Nested validations
    • Validate raw data
  • Strict mode
  • Cloning an instance
  • Serialization
  • Contributing
  • License
  • GitHub
Powered by GitBook
On this page

Was this helpful?

Coercion

PreviousNullable attributesNextPrimitive type coercion

Last updated 5 years ago

Was this helpful?

Structure does type coercion based on the declared . It's important to note that it never coerces the following scenarios:

  • undefined;

  • null when nullable option is enabled;

  • value is already of the declared type (except for arrays, we'll talk more about this soon).

Let's break the coercion into 3 categories.

schema