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

generator-go-sdk: fix unmarshalling fields that reference a model interface #4427

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

manicminer
Copy link
Member

When a model fields references an interface (i.e. a parent model), this currently fails to unmarshal. This PR fixes that by generating a temporary struct minus those such fields, unmarshalling into it, and then calling the explicit Unmarshal{Foo}Implementation function for that model.

Additionally, make the Unmarshal{Foo}Implementation functions more forgiving, so if the discriminated value field is missing, it continues to unmarshal into, and return, a Raw{Foo}Impl struct instead of just returning nil.

@manicminer manicminer added bug Something isn't working tool/generator-go-sdk Issues with the Go SDK Generator labels Sep 19, 2024
@manicminer manicminer requested a review from a team September 19, 2024 21:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working tool/generator-go-sdk Issues with the Go SDK Generator
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant