Use zod schemas from sbvr-types to perform early validation before passing to hooks#1017
Open
Page- wants to merge 1 commit into
Open
Use zod schemas from sbvr-types to perform early validation before passing to hooks#1017Page- wants to merge 1 commit into
Page- wants to merge 1 commit into
Conversation
9c49739 to
86cc5e5
Compare
| const body = { | ||
| session_id: sid, | ||
| data, | ||
| data: { ...data }, |
Contributor
There was a problem hiding this comment.
Why is this now necessary?
Contributor
Author
There was a problem hiding this comment.
Because it's an instance of the Session class which is not a valid "record", ie it's not just an object, but can be converted to one for as far as we care, and this is the easiest way to convert it now that we actually validate it before coercing it
86cc5e5 to
cbe40ea
Compare
d444a02 to
5efc64b
Compare
5efc64b to
0ba78c6
Compare
…ssing to hooks Update @balena/sbvr-types from 11.1.4 to 11.3.0 This means hooks will receive validated data that they can trust to be of the expected type and improve the developer experience along with safety https://balena.fibery.io/Work/Project/1002 Change-type: minor
0ba78c6 to
5c2f438
Compare
joshbwlng
reviewed
Jul 9, 2026
| prop !== 'validator' && | ||
| Object.hasOwn(obj, prop) && | ||
| obj[prop] !== null && | ||
| !['object', 'function'].includes(typeof obj[prop]) |
Contributor
There was a problem hiding this comment.
So we're not freezing nested objects? Also, could !Object.isFrozen() help here?
joshbwlng
reviewed
Jul 9, 2026
| } | ||
| }; | ||
|
|
||
| export const stringifyIgnoreValidator = (key: string, value: any) => { |
Contributor
There was a problem hiding this comment.
I wouldn't mind a quick comment about the point of this function, it took me a minute to realize what it was doing.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This means hooks will receive validated data that they can trust to be of the expected type and improve the developer experience along with safety
https://balena.fibery.io/Work/Project/1002
Change-type: minor