Message Validation
FIX Engine can validate inbound messages and reject those that do not comply with the FIX Protocol or the active FIX Dictionary.
The following settings affect the validation of incoming messages:
- ValidateEmptyFieldValues
- ValidateCheckSum
- ValidateDuplicatedFields
- ValidateFieldValues
- ValidateRepeatingGroupEntryCount
- ValidateRepeatingGroupLeadingField
- ValidateRequiredFields
- ValidateUnknownFields
- ValidateUnknownMessages
Validation also takes place when you perform the FIX message parsing from its raw (tag=value) representation using the Parse(string, IMessageInfoDictionary, MessageValidationFlags, MessageMemoryPool) method.
To validate the message explicitly, use the Validate(MessageValidationFlags) method.
Field value validation
The field value validation can be performed in two following ways:
The validation of fields values performed in accordance with the FIX protocol data types. The 'type' attribute must be added to the 'Field' node in the FIX Dictionary xml file. The value of the 'type' attribute must be in upper case mode; please see the example.
The validation of fields values performed in accordance with enum valid values of the FIX protocol (example of 'HandlInst' field valid values). Also, you can specify your enum valid values. In this case, the 'Type' definition must be added to the FIX Dictionary xml file, and all enum values must be described in the 'Type' xml node. Additionally, the 'mode' attribute indicates that the action will be performed with your enum valid values:
- append - given valid values will be appended to valid values of the FIX protocol
- override - given valid values will replace all valid values of the FIX protocol
- remove - given valid values will be removed from valid values of the FIX protocol
The 'name' attribute of the 'Type' xml node must correspond to the value of the 'type' attribute in the field definition; please see the example.
A basic dictionary description file with the field value type definition:
<?xml version="1.0" encoding="utf-8"?>
<Dialect xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://ref.onixs.biz/fix/dialects https://ref.onixs.biz/fix/dialects/dialects-2.19.xsd" xmlns="https://onixs.biz/fix/dialects">
<FIX version="5.0">
<Message type="D">
<Field tag="52" name="SendingTime" type="UTCTIMESTAMP"/>
</Message>
</FIX>
</Dialect>
A basic dictionary description file with the enum values definition:
<?xml version="1.0" encoding="utf-8"?>
<Dialect xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://ref.onixs.biz/fix/dialects https://ref.onixs.biz/fix/dialects/dialects-2.19.xsd" xmlns="https://onixs.biz/fix/dialects">
<FIX version="5.0">
<Type name="UserDefined" mode="append">
<Value enum="4" description="enum description 4"/>
<Value enum="5" description="enum description 5"/>
</Type>
<Message type="D">
<Field tag="21" name="HandlInst" type="UserDefined"/>
</Message>
</FIX>
</Dialect>