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

Handle unknown json fields in responses more gracefully by preserving unknown fields #859

Open
addisonj opened this issue Oct 17, 2022 · 0 comments

Comments

@addisonj
Copy link

Overview

When the pulsar broker adds new json fields to certain API calls, like that stats API call, those fields must be explicitly added to the respective structs in this code.

This complicates users being able to see fields in the output until we add explicit support and makes the underlying library out of date.

Solution

By using a library like https://github.com/PerimeterX/marshmallow, we can add an additional extraFields: map[string]interface{} to all the structs and then populate that with any remaining fields from json parsing.

While those fields won't be typed, at the very least can display them and have them exposed. However, we should warn against usage of this as it may break once the fields are added to the top level struct.

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

No branches or pull requests

1 participant