Skip to content

Enum values are now checked in json.Unmarshal #3718

@ianling

Description

@ianling

Checking enum values and returning an error if they are not valid during json.Unmarshal is a breaking change. Specifically, json.Unmarshal was not previously calling e.UnmarshalGQL(s), which contains the additional check for valid enum values.

The commit: eed4a10 (plugin/modelgen/models.gotpl)

I understand the GraphQL spec requires enums to always contain valid values, and gqlgen is technically released under a 0.x.x semantic version, so breaking changes may be released at any time. We were unfortunately relying on the non-spec-compliant behavior in our application.

Could I add a config option to gqlgen that optionally disables the enum value checks?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions