Feature description:
Right now, the validation id defined in proto doesn't get passed into standard schema. We have some per-id specific UI to show, but all we get now is the error message. That's understandable since the Issue type doesn't have an additional field to store that meta.
/** The issue interface of the failure output. */
export interface Issue {
/** The error message of the issue. */
readonly message: string;
/** The path of the issue, if any. */
readonly path?: ReadonlyArray<PropertyKey | PathSegment> | undefined;
}
Problem it solves or use case:
There are certain multi-field validations where we'd like to highlight the specific fields involved, vs just a generic parent message that contains the fields
Proposed implementation or solution:
Today, we manually copy the id to the front of the error message. Our pattern looks like:
We can split in our form code and use the id as an immutable id, while retaining the ability to make user friendly error messages.
The primary issue with this is that we now have the id repeated twice and have to make sure they stay in sync. If we could have protovalidate export standard schema by templating the Issue message, that would solve this problem.
Maybe there's a better approach, open to suggestions.
Contribution:
We could contribute it if the direction is agreeable
Additional context:
cc @SeanCassiere
Feature description:
Right now, the validation id defined in proto doesn't get passed into standard schema. We have some per-id specific UI to show, but all we get now is the error message. That's understandable since the Issue type doesn't have an additional field to store that meta.
Problem it solves or use case:
There are certain multi-field validations where we'd like to highlight the specific fields involved, vs just a generic parent message that contains the fields
Proposed implementation or solution:
Today, we manually copy the id to the front of the error message. Our pattern looks like:
We can split in our form code and use the id as an immutable id, while retaining the ability to make user friendly error messages.
The primary issue with this is that we now have the id repeated twice and have to make sure they stay in sync. If we could have protovalidate export standard schema by templating the Issue message, that would solve this problem.
Maybe there's a better approach, open to suggestions.
Contribution:
We could contribute it if the direction is agreeable
Additional context:
cc @SeanCassiere