Skip to content

feature: Have a way to collect untyped remaining fields. #624

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

Open
burdiyan opened this issue Feb 18, 2025 · 1 comment
Open

feature: Have a way to collect untyped remaining fields. #624

burdiyan opened this issue Feb 18, 2025 · 1 comment
Labels
enhancement New feature or request

Comments

@burdiyan
Copy link

Is your feature request related to a problem? Please describe.
Sometimes it's useful to have partially defined types for the data, but still being able to collect the remaining fields in more of a dynamic way as a map[string]any or map[any]any.

Describe the solution you'd like
Introduce a new struct field tag, similar to the remain tag in the popular mapstructure library. The type of a field with such a tag should be a map, into which those values that are not defined on the concrete type could be collected for later access.

Describe alternatives you've considered
Having a named type for a map, like type UnknownFields map[string]any which when embedded into a struct would collect the remainder fields.

@fxamacker fxamacker added the enhancement New feature or request label Mar 2, 2025
@fxamacker
Copy link
Owner

Thanks for opening this issue! This sounds useful and I will need to look into it.

@burdiyan burdiyan changed the title feature: Have a way to collect untypes remaining fields. feature: Have a way to collect untyped remaining fields. Mar 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants