crossplane / function-sdk-go

The Go SDK for composition functions
https://crossplane.io
Apache License 2.0
19 stars 13 forks source link

Expose an option to reject unknown JSON members #123

Closed negz closed 6 months ago

negz commented 6 months ago

Description of your changes

Closes https://github.com/crossplane/function-sdk-go/pull/121

@phisco This is how I would wrap JSON options in our own, to avoid coupling ourselves to the upstream (and not yet stable) json-experiment implementation too strongly.

I'm opening as a draft though because after writing this it occurred to me that I'd prefer to make RejectUnknownMembers the default behavior for AsObject. My rationale:

I have:

How has this code been tested

phisco commented 6 months ago

Makes sense to me making it the default behavior, should we add options to all functions ending up in a AsObject being called?

negz commented 6 months ago

Makes sense to me making it the default behavior, should we add options to all functions ending up in a AsObject being called?

I think if we're okay making this the default behavior we can defer adding options at all for the time being.