Skip to content

fix: rebind a typed node#25

Merged
alanshaw merged 2 commits intomainfrom
fix/rebind-typed-node
Oct 18, 2024
Merged

fix: rebind a typed node#25
alanshaw merged 2 commits intomainfrom
fix/rebind-typed-node

Conversation

@alanshaw
Copy link
Copy Markdown
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
Copy Markdown
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
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