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

Maps for dynamic key dicts #6

Open
ufukty opened this issue Jun 22, 2024 · 0 comments
Open

Maps for dynamic key dicts #6

ufukty opened this issue Jun 22, 2024 · 0 comments
Labels
discussions features Feature requests

Comments

@ufukty
Copy link
Owner

ufukty commented Jun 22, 2024

Current behavior

Gonfique produces a struct type for dicts, it also implements .Range methods on dicts when values share same schema/type. While current behavior still preserves the convenience of using maps on iteration/looping over the dict, it still has a problem of leading to unnecessary commit history for usecases where schemas/keys frequently change.

Proposed behavior

Providing a way for user to let specify the dict which its type is desired to be defined based on map[string]any rather than structs. This, way the produced type will be iterable and more importantly its type will stay up-to-date longer, as map types don't contain name of the keys.

Interface

Without suggesting as the final interface, this might give an idea of user interaction on specifying dicts desired to be defined based on maps.

a:
  struct: dynamic
a:
  b: ...
  c: ...
  d: ...

Complication concern

While the implementation of such features is trivial, the complications that may emerge from using this option with combination to other existing features should be investigated before making the call.

Related links

A feature request to json2go solution regarding to dynamic keys

@ufukty ufukty changed the title Optional handling of dicts with dynamic keys Optional method of handling for dicts with dynamic keys Jun 22, 2024
@ufukty ufukty added features Feature requests discussions labels Jun 22, 2024
@ufukty ufukty changed the title Optional method of handling for dicts with dynamic keys Maps for dynamic key dicts Jun 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussions features Feature requests
Projects
None yet
Development

No branches or pull requests

1 participant