@@ -10,7 +10,6 @@ import type { Static, TAnySchema, TSchema } from "@sinclair/typebox";
1010
1111import type { ChangeEncodingContext } from "../core/index.js" ;
1212import type { JsonCompatibleReadOnly } from "../util/index.js" ;
13- import { noopValidator } from "./noopValidator.js" ;
1413
1514/**
1615 * Translates decoded data to encoded data.
@@ -37,7 +36,6 @@ export interface IDecoder<TDecoded, TEncoded, TContext> {
3736/**
3837 * Validates data complies with some particular schema.
3938 * Implementations are typically created by a {@link JsonValidator}.
40- * @alpha @input
4139 */
4240export interface SchemaValidationFunction < Schema extends TSchema > {
4341 /**
@@ -66,6 +64,15 @@ export interface SchemaValidationFunction<Schema extends TSchema> {
6664 */
6765export interface FormatValidator extends ErasedType < "FormatValidator" > { }
6866
67+ /**
68+ * A {@link JsonValidator} implementation which performs no validation and accepts all data as valid.
69+ * @privateRemarks Having this as an option unifies opting out of validation with selection of
70+ * validators, simplifying code performing validation.
71+ */
72+ const noopValidator : JsonValidator = {
73+ compile : < Schema extends TSchema > ( ) => ( { check : ( data ) : data is Static < Schema > => true } ) ,
74+ } ;
75+
6976/**
7077 * A {@link FormatValidator} which does no validation.
7178 * @alpha
@@ -122,11 +129,10 @@ export interface ICodecOptions {
122129 * SharedTree users are still encouraged to use a non-trivial validator (i.e. not `FormatValidatorNoOp`)
123130 * whenever reasonable: it gives better fail-fast behavior when unexpected encoded data is found,
124131 * which reduces the risk of unrecoverable data corruption.
125- *
126- * Use of {@link JsonValidator} here is deprecated and will be removed:
127- * it is recommended to use {@link FormatValidator} instead.
132+ * @privateRemarks
133+ * This property should probably be renamed to `validator` before stabilizing the API.
128134 */
129- readonly jsonValidator : JsonValidator | FormatValidator ;
135+ readonly jsonValidator : FormatValidator ;
130136}
131137
132138/**
0 commit comments