Skip to content

gocty: Too inflexible about map vs. object distinction #17

@apparentlymart

Description

@apparentlymart

gocty was written quite early on when maps and objects were thought of as very distinct ideas with different operations.

In the meantime, we've blurred that a little by allowing some of the collection operations to also work for object types, since that tends to be more convenient for calling applications that can therefore share code between the two.

Currently the gocty logic is quite picky about the distinction between these, requiring that objects be decoded into structs and maps be decoded into maps. It would be helpful to callers, and more consistent with how the main cty has evolved, to allow decoding objects into Go maps (as long as the attributes all conform to the Go element type) and to allow decoding maps into Go structs, where compatible.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementgoctyConversions to and from native Go types

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions