ICodecOptions Interface
Options relating to handling of persisted data.
To use, import via fluid-framework/alpha
.
For more information about our API support guarantees, see here.
This type is "input," meaning that code outside of the library defining it should not read from it. Future versions of this type may add optional members or make typing of members more general.
Signature
export interface ICodecOptions
Properties
Property | Alerts | Modifiers | Type | Description |
---|---|---|---|---|
jsonValidator | Alpha |
readonly |
JsonValidator | FormatValidator | FormatValidator which SharedTree uses to validate persisted data it reads & writes matches the expected encoded format (i.e. the wire format for ops and summaries). |
Property Details
jsonValidator
FormatValidator which SharedTree uses to validate persisted data it reads & writes matches the expected encoded format (i.e. the wire format for ops and summaries).
For more information about our API support guarantees, see here.
Signature
readonly jsonValidator: JsonValidator | FormatValidator;
Type: JsonValidator | FormatValidator
Remarks
See FormatValidatorNoOp and FormatValidatorBasic for out-of-the-box implementations.
This option is not "on-by-default" because JSON schema validation comes with a small but noticeable runtime performance cost, and popular schema validation libraries have relatively large bundle size.
SharedTree users are still encouraged to use a non-trivial validator (i.e. not FormatValidatorNoOp
) whenever reasonable: it gives better fail-fast behavior when unexpected encoded data is found, which reduces the risk of unrecoverable data corruption.
Use of JsonValidator here is deprecated and will be removed: it is recommended to use FormatValidator instead.
See Also
CodecWriteOptions for options that are specific to encoding data. \