Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ValidationError.formatError() clobbering path param #2250

Merged
merged 1 commit into from
Nov 25, 2024

Conversation

shaungrady
Copy link
Contributor

@shaungrady shaungrady commented Sep 30, 2024

Changes

  • ValidationError.formatError() overwrites path with a more friendly label string (if defined) for more friendly error message interpolation; however, this causes the path data to be lost entirely.
    • Rather than undertake refactoring this logic and cause a breaking change, where using alternative values for interpolating ${path} within error strings should arguably be a concern that's left to the message function, I opted to simply create a new params property—originalPath—for recording this value.
  • Update MessageParams type with originalPath: string; property
  • Add MessageParams and AnyMessageParams to library exports
    • I couldn't see a reason why these types are private, and I'd certainly love to make use of them.

And export `AnyMessageParams`, `MessageParams` types.
@shaungrady shaungrady changed the title Fix ValidationError.formatError() clobbering path param Fix ValidationError.formatError() clobbering path param Sep 30, 2024
@jquense jquense merged commit 87be159 into jquense:master Nov 25, 2024
1 check passed
@jquense
Copy link
Owner

jquense commented Nov 25, 2024

thanks!

@shaungrady shaungrady deleted the fix-validation-error-formatting branch December 6, 2024 21:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants