BoundarySchema<Boundary extends Object> class final

Validates with another schema while preserving the original boundary value.

This is useful when callers need a composable schema for validating wire data without retaining any runtime values produced by nested codecs.

Inheritance
Mixed-in types
Available extensions
Annotations
  • @immutable

Constructors

BoundarySchema(AckSchema<Boundary, Object> inner, {bool? isNullable, bool? isOptional, String? description, List<Constraint<Boundary>> constraints = const [], List<Refinement<Boundary>> refinements = const []})

Properties

acceptsNull → bool
Whether parse(null) and encode(null) should accept null without raising a non-nullable failure. Defaults to isNullable; subclasses with branch-level null policies (e.g. AnyOfSchema) override this hook.
no setterinherited
baseFieldsHashCode → int
Computes hash code for base schema fields.
no setterinherited
constraints → List<Constraint<Boundary>>
Returns an unmodifiable view of the constraints for this schema.
no setterinherited
description → String?
finalinherited
hashCode → int
The hash code for this object.
no setteroverride
inner → AckSchema<Boundary, Object>
The wrapped schema used for boundary-shape traversal.
final
isNullable → bool
finalinherited
isOptional → bool
finalinherited
refinements → List<Refinement<Boundary>>
Returns an unmodifiable view of the refinements for this schema.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
schemaType → SchemaType
The schema type category for this schema.
no setteroverride
schemaTypeName → String
Human-readable type name for error messages and debugging.
no setterinherited

Methods

applyConstraintsAndRefinements(Boundary value, SchemaContext context) → SchemaResult<Boundary>
Applies constraints and refinements to a runtime value.
inherited
baseFieldsEqual(AckSchema other) → bool
Compares base schema fields for equality.
inherited
codec<R extends Object>({required R decode(Runtime value), required Runtime encode(R value), AckSchema<dynamic, R>? output}) → CodecSchema<Boundary, R>

Available on AckSchema<Boundary, Runtime>, provided by the AckSchemaExtensions extension

Builds a bidirectional codec on top of this schema.
constrain(Constraint<Boundary> constraint, {String? message}) → BoundarySchema<Boundary>
Adds a raw constraint to the schema.
inherited
copyWith({bool? isNullable, bool? isOptional, String? description, List<Constraint<Boundary>>? constraints, List<Refinement<Boundary>>? refinements}) → BoundarySchema<Boundary>
Returns a copy of this schema with the given fields replaced.
override
copyWithInner(AnyAckSchema newInner) → BoundarySchema<Boundary>
Returns a copy of this wrapper with inner swapped for newInner.
describe(String description) → BoundarySchema<Boundary>
Sets the description for the schema.
inherited
encode(Boundary? value, {String? debugName}) → Boundary?
Encodes a runtime value to a boundary value, throwing on failure.
inherited
encodeAsBoundary(Boundary value, SchemaContext context) → SchemaResult<Boundary>
Helper for schemas whose boundary == runtime: validates the runtime value and, if it passes, returns it as the boundary value unchanged. Only safe to call when Boundary and Runtime are the same type.
inherited
encodeWithContext(Boundary value, SchemaContext context) → SchemaResult<Boundary>
Encodes a runtime value into a boundary value. The base class strips null before calling this; subclasses receive a non-null value.
override
failNonNullable(SchemaContext context) → SchemaResult<Boundary>
Runtime-side non-nullable failure.
inherited
failNonNullableEncode(SchemaContext context) → SchemaResult<Boundary>
Encode-side non-nullable failure.
inherited
handleNullInput(Object? inputValue, SchemaContext context) → SchemaResult<Boundary>?
Centralized null gate for the parse/validate paths. Returns null when inputValue is non-null; otherwise returns Ok(null) if acceptsNull is true or a non-nullable failure.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
nullable({bool value = true}) → BoundarySchema<Boundary>
Marks the schema as nullable.
inherited
optional({bool value = true}) → BoundarySchema<Boundary>
Marks the schema as optional so the field can be omitted from an object.
inherited
parse(Object? value, {String? debugName}) → Boundary?
Parses and validates a value, throwing an AckException if it fails.
inherited
parseAs<TOut extends Object>(Object? value, TOut map(Boundary? validated), {String? debugName}) → TOut
Parses and validates a value, then maps the validated value to TOut.
inherited
parseWithContext(Object? value, SchemaContext context) → SchemaResult<Boundary>
Decodes a boundary value into a runtime value.
override
refine(bool validate(Boundary value), {String message = 'The value did not pass the custom validation.'}) → BoundarySchema<Boundary>
Adds a custom validation check that runs after all other validations.
inherited
safeEncode(Boundary? value, {String? debugName}) → SchemaResult<Boundary>
Encodes a runtime value to a boundary value, returning a SchemaResult.
inherited
safeParse(Object? value, {String? debugName}) → SchemaResult<Boundary>
Parses and validates a value, returning a SchemaResult.
inherited
safeParseAs<TOut extends Object>(Object? value, TOut map(Boundary? validated), {String? debugName}) → SchemaResult<TOut>
Parses and validates a value, then maps the validated value to TOut.
inherited
toJsonSchema() → Map<String, Object?>
Converts this schema to a JSON Schema Draft-7 representation.
inherited
toMap() → Map<String, Object?>
inherited
toSchemaModel() → AckSchemaModel

Available on AckSchema<Boundary, Runtime>, provided by the AckSchemaModelExtension extension

toString() → String
A string representation of this object.
inherited
transform<R extends Object>(R transformer(Runtime value)) → CodecSchema<Boundary, R>

Available on AckSchema<Boundary, Runtime>, provided by the AckSchemaExtensions extension

Maps the validated runtime value to a new runtime type R in a parse-only direction.
validateRuntimeWithContext(Object? value, SchemaContext context) → SchemaResult<Boundary>
Validates that value is a valid runtime value for this schema.
override
withConstraint(Constraint<Boundary> constraint) → BoundarySchema<Boundary>
Adds a validation constraint to the schema.
inherited
withConstraints(List<Constraint<Boundary>> newConstraints) → BoundarySchema<Boundary>
Adds a list of validation constraints to the schema.
inherited
withDefault(Boundary defaultValue) → DefaultSchema<Boundary, Boundary>
Wraps this schema in a DefaultSchema that supplies defaultValue when the parse input is null. Object encode also injects encoded defaults for missing default-wrapped fields.
inherited
withRuntimeConfig({bool? isNullable, bool? isOptional, String? description, List<Constraint<Boundary>>? constraints, List<Refinement<Boundary>>? refinements}) → BoundarySchema<Boundary>
Returns a copy of this schema with runtime-side configuration replaced.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
override