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: rebind a typed node #25

Merged
merged 2 commits into from
Oct 18, 2024
Merged

fix: rebind a typed node #25

merged 2 commits into from
Oct 18, 2024

Conversation

alanshaw
Copy link
Member

@alanshaw alanshaw commented Oct 18, 2024

This PR allows Rebind to work on schema.TypedNode. This was a hidden error because oftentimes the representation form is compatible with the typed form. However when you start to use custom representations e.g. tuple, then Rebind will not work, since the datamodel.Node will have a map, when represented type expects a list.

The solution is to simply convert a TypedNode to it's representation form prior to binding to the type.

This is likely not used very often - if you have a typed node then you have/had it in it's native Go type at some point, so you shouldn't need to rebind. This is however seen it tests, when a server is invoked by a client without serializing/deserializing capability caveats - and the validator has to parse already parsed caveats.

Copy link
Member

@hannahhoward hannahhoward left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That'll do it. :(

LGTM

@alanshaw alanshaw merged commit 175193f into main Oct 18, 2024
1 check passed
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