Skip to content
This repository was archived by the owner on Feb 13, 2026. It is now read-only.
This repository was archived by the owner on Feb 13, 2026. It is now read-only.

Maps for dynamic key dicts #6

@ufukty

Description

@ufukty

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions