Module definition of Validator property decorators.
Validator decorators ensure that a decorated property adheres
to an expected format or value. These decorators validate the value
of a property against predefined rules, such as matching a specific value,
conforming to an enumeration, or meeting a custom condition.
If validation fails, an error is raised, allowing developers to identify
and debug discrepancies between the binary data and its expected format.
The validation happens as the final step of the property reading loop, after
the property has been fully read and transformed.
%%{init:{"theme":"dark"}}%%
flowchart TB
subgraph s1[For each properties]
direction TB
PreOperation[__Pre__ property reading operations] --> Condition
click PreOperation "/binspector/modules/PrePost.html" "Documentation for 'Pre' type decorators"
Condition[__Condition__ get the definitive subtype to read based on current state] --> s2
click Condition "/binspector/modules/Condition.html" "Documentation for 'Condtion' type decorators"
subgraph s2[Reading subtype]
Controller[__Controller__ decides when to stop reading the subtype based on a set of arbitrary conditions] --> TypeReading[Read __Relation__ or __Primitive__]
click Controller "/binspector/modules/Controller.html" "Documentation for 'Controller' type decorators"
click TypeReading "/binspector/modules/Primitive.html" "Documentation for 'Primitive' type decorators"
end
TypeReading --> Controller
s2 --> Transform[__Transform__ the value we read into something else]
click Transform "/binspector/modules/Transformer.html" "Documentation for 'Transformer' type decorators"
Transform --> Validate[__Validate__ the final value]
click Validate "/binspector/modules/Validator.html" "Documentation for 'Validator' type decorators"
Validate --> PostOperation[__Post__ property reading operations]
click PostOperation "/binspector/modules/PrePost.html" "Documentation for 'Post' type decorators"
end
PostOperation --> A@{ shape: framed-circle, label: "Stop" }
style Validate fill:blue,stroke:#f66,stroke-width:2px,color:#fff,stroke-dasharray: 5 5
%%{init:{"theme":"default"}}%%
flowchart TB
subgraph s1[For each properties]
direction TB
PreOperation[__Pre__ property reading operations] --> Condition
click PreOperation "/binspector/modules/PrePost.html" "Documentation for 'Pre' type decorators"
Condition[__Condition__ get the definitive subtype to read based on current state] --> s2
click Condition "/binspector/modules/Condition.html" "Documentation for 'Condtion' type decorators"
subgraph s2[Reading subtype]
Controller[__Controller__ decides when to stop reading the subtype based on a set of arbitrary conditions] --> TypeReading[Read __Relation__ or __Primitive__]
click Controller "/binspector/modules/Controller.html" "Documentation for 'Controller' type decorators"
click TypeReading "/binspector/modules/Primitive.html" "Documentation for 'Primitive' type decorators"
end
TypeReading --> Controller
s2 --> Transform[__Transform__ the value we read into something else]
click Transform "/binspector/modules/Transformer.html" "Documentation for 'Transformer' type decorators"
Transform --> Validate[__Validate__ the final value]
click Validate "/binspector/modules/Validator.html" "Documentation for 'Validator' type decorators"
Validate --> PostOperation[__Post__ property reading operations]
click PostOperation "/binspector/modules/PrePost.html" "Documentation for 'Post' type decorators"
end
PostOperation --> A@{ shape: framed-circle, label: "Stop" }
style Validate fill:blue,stroke:#f66,stroke-width:2px,color:#fff,stroke-dasharray: 5 5
flowchart TB
subgraph s1[For each properties]
direction TB
PreOperation[__Pre__ property reading operations] --> Condition
click PreOperation "/binspector/modules/PrePost.html" "Documentation for 'Pre' type decorators"
Condition[__Condition__ get the definitive subtype to read based on current state] --> s2
click Condition "/binspector/modules/Condition.html" "Documentation for 'Condtion' type decorators"
subgraph s2[Reading subtype]
Controller[__Controller__ decides when to stop reading the subtype based on a set of arbitrary conditions] --> TypeReading[Read __Relation__ or __Primitive__]
click Controller "/binspector/modules/Controller.html" "Documentation for 'Controller' type decorators"
click TypeReading "/binspector/modules/Primitive.html" "Documentation for 'Primitive' type decorators"
end
TypeReading --> Controller
s2 --> Transform[__Transform__ the value we read into something else]
click Transform "/binspector/modules/Transformer.html" "Documentation for 'Transformer' type decorators"
Transform --> Validate[__Validate__ the final value]
click Validate "/binspector/modules/Validator.html" "Documentation for 'Validator' type decorators"
Validate --> PostOperation[__Post__ property reading operations]
click PostOperation "/binspector/modules/PrePost.html" "Documentation for 'Post' type decorators"
end
PostOperation --> A@{ shape: framed-circle, label: "Stop" }
style Validate fill:blue,stroke:#f66,stroke-width:2px,color:#fff,stroke-dasharray: 5 5
The Validator category define various decorators to perform
validation.
Generic Validator: Defines custom validator function using
the Validate decorator.
Magic Number Validator: Verify the value of the decorated
property against a pre-defined value with the Match
decorator.
Enum Validator: Verify a value belong to a TypeScript enum
with the Enum decorator.
Module definition of Validator property decorators.
Validator decorators ensure that a decorated property adheres to an expected format or value. These decorators validate the value of a property against predefined rules, such as matching a specific value, conforming to an enumeration, or meeting a custom condition.
If validation fails, an error is raised, allowing developers to identify and debug discrepancies between the binary data and its expected format.
The validation happens as the final step of the property reading loop, after the property has been fully read and transformed.
The Validator category define various decorators to perform validation.
Generic Validator: Defines custom validator function using the Validate decorator.
Magic Number Validator: Verify the value of the decorated property against a pre-defined value with the Match decorator.
Enum Validator: Verify a value belong to a TypeScript enum with the Enum decorator.