Schema Options¶
Options to be used with cion.Schema
- class cion.options.ExtraFields[source]¶
Enum that dictates what to do in the event that there is extra data
- COMBINE = 'combine'¶
Combine the extra fields and the validated data
- ERROR = 'error'¶
Return a
cion.exceptions.ValidationErrorwith a list of the unexpected fields
- IGNORE = 'ignore'¶
Ignore the extra data and only return the validated data
- class cion.options.Options[source]¶
Schema Options
- __init__(*, extra: ExtraFields = ExtraFields.IGNORE, stop_on_error: bool = False) None[source]¶
Class for creating Schema options
- Parameters:
extra (ExtraFields) –
What to do when there are extra fields in the data
See the docs for :class:
cion.options.ExtraFieldsOptionstop_on_error (bool) –
Whether or not to continue after an error If
True, when an error is raised, stop immediately and throw an errorIf
False, when an error is raised, compile a list of errors and throw the error after validation is doneEssentially, this option dictates whether you want to receive any validated data on error, or wait to get all the valid data
- Return type:
None