JsonHandlerRegistry class abstract

Base registry owning the state building pipeline and validation context creation. Subclasses define only the handler selection policy via stateBuilderFor, stateBuilderForValue and handlersForSchema.

Implementers

Constructors

JsonHandlerRegistry({required SchemaMerger schemaMerger, SchemaValidationMode validationMode = SchemaValidationMode.strict})
Creates the pipeline part of a registry; subclasses supply the dispatch tables.

Properties

hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
schemaMerger → SchemaMerger
Merges schema fragments (allOf branches, $ref targets with their local siblings) during resolution.
final
unknownFieldHandler → JsonFieldHandler<JsonFieldState<Schema>>
Fallback handler for values and states no registered handler accepts (e.g. a free-form JSON text editor). Part of this class (not the abstract FieldHandlerRegistry contract): the state-building pipeline needs it to keep buildStateOrUndefined and schema-less editing total.
no setter
validationMode → SchemaValidationMode
How values are validated while edited and whether a schema the validator cannot process blocks submission (see SchemaValidationMode). Consulted by validateValue and by the dialogs' submission gates.
final

Methods

buildState(FieldBuildRequest request) → Future<JsonFieldState<Schema>?>
The entry point of state building: enriches request (schema resolution, annotations, seeding, variants), selects a state builder by schema or value, and builds the state. Null when there is neither a schema nor a value to build from. A repeated $ref without a value is collapsed into a CycleFieldState instead of recursing.
buildStateForNewField({required FieldBuildRequest request, JsonFieldStateBuilder<JsonFieldState<Schema>>? stateBuilder}) → Future<JsonFieldState<Schema>>
Builds the initial state for a field that extends the JSON document on user interaction: a new object property or a new array item.
buildStateOrUndefined(FieldBuildRequest request) → Future<JsonFieldState<Schema>>
buildState, but total: falls back to the unknown-field handler instead of returning null.
handlerForField(JsonFieldState<Schema> field) → JsonFieldHandler<JsonFieldState<Schema>>
The handler that renders field.
inherited
handlersForSchema({required Schema schema, required FieldResolveContext resolveContext}) → List<JsonFieldHandler<JsonFieldState<Schema>>>
Enumerates all handlers admitted by schema, based solely on the schema. Used by the entry edit dialog to offer the "Value type" choice and to attribute schemas to handlers for validation.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
pickableHandlers({required FieldResolveContext resolveContext, Schema? schema}) → List<JsonFieldHandler<JsonFieldState<Schema>>>
Selection policy: the handlers offered in a "value type" picker (the entry edit dialog, the array item add dialog) for a field described by schema. When schema is null or does not constrain the type, the user may create a value of any type this registry can edit, so the implementation returns every pickable handler; the list order defines the picker order.
stateBuilderFor({required Schema schema, required PresenceValue? value, required FieldResolveContext resolveContext}) → JsonFieldStateBuilder<JsonFieldState<Schema>>
Selection policy: the single handler for a field described by schema (already resolved) with the current value.
stateBuilderForValue({required PresenceValue value, required FieldResolveContext resolveContext}) → JsonFieldStateBuilder<JsonFieldState<Schema>>?
Selection policy: the handler for a value edited without a schema. Returns null when no handler can edit the value. Domain interface for the same reason as stateBuilderFor.
toString() → String
A string representation of this object.
inherited
validateValue({required Schema? itemSchema, required Schema? rootSchema, required dynamic value}) → Future<List<ValidationError>>
Validates value against itemSchema with a ValidationContext whose registry holds rootSchema, so $refs pointing into the root document (e.g. #/definitions/...) resolve. A plain schema.validate(value) registers only the item schema itself and cannot resolve such refs.
withValidationContext<T>({required Schema? itemSchema, required Schema? rootSchema, required Future<T> body(ValidationContext? validationContext)}) → Future<T>
Runs body with a ValidationContext for itemSchema and disposes the backing SchemaRegistry afterwards, even when body throws.

Operators

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