BridgeValidation class

Namespace Runic.Application.Views.Generated in Runic.Application.Views 0.23.0

public static class BridgeValidation

Writes the validation projection for generated bridge snapshots.

Methods

EnumerateDictionary

public static IEnumerable<BridgeValidationChild> EnumerateDictionary<T>(IEnumerable<KeyValuePair<string, T>> values)

Produces keyed entries for generated string dictionary metadata.

EnumerateIndexed

public static IEnumerable<BridgeValidationChild> EnumerateIndexed(IEnumerable values)

Produces indexed entries for generated array/list metadata.

Observe

public static IDisposable? Observe<T>(IObservable<T> source, Action changed)

Calls changed for every value source produces after the subscription, until the result is disposed. A value replayed while subscribing is not a change. Errors and completion end the observation; a source that was disposed returns null. Generated code observes a ReactiveUI.Validation ValidationContext.ValidationStatusChange with it.

Write

public static void Write(Utf8JsonWriter writer, object root, IReadOnlyList<BridgeDataSubscriptionMember> members)

Writes { hasErrors, truncated, errors } for root.

Write

public static void Write(Utf8JsonWriter writer, object root, IReadOnlyList<BridgeDataSubscriptionMember> members, Func<object, IEnumerable?> readObjectErrors)

Writes { hasErrors, truncated, errors } for root, reading each object's object-level errors with readObjectErrors.

Parameters

writer

The snapshot writer.

root

The ViewModel.

members

The ViewModel's generated member metadata.

readObjectErrors

Returns an object's errors in place of INotifyDataErrorInfo.GetErrors with null, or null to use that call. An entry is read as an entry of GetErrors(null): a ValidationResult reports at the paths of its ValidationResult.MemberNames and any other entry at the object's path. Generated code passes a reader for ViewModels that keep their validations in a ReactiveUI.Validation ValidationContext.

WriteMessages

public static void WriteMessages(Utf8JsonWriter writer, IEnumerable? errors)

Writes a member's errors, the entries of INotifyDataErrorInfo.GetErrors, as the JSON array of their messages (the {name}Errors state member). An empty message is Invalid value.