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

EnumValues for a type doesn't respect includeDeprecated arg #1026

Closed
abhimanyusinghgaur opened this issue Feb 13, 2020 · 0 comments · Fixed by #1028
Closed

EnumValues for a type doesn't respect includeDeprecated arg #1026

abhimanyusinghgaur opened this issue Feb 13, 2020 · 0 comments · Fixed by #1028

Comments

@abhimanyusinghgaur
Copy link
Contributor

What happened?

Fields(includeDeprecated bool) for a type respects the includeDeprecated arg:

if !includeDeprecated && f.Directives.ForName("deprecated") != nil {
continue
}

but EnumValues does not:
func (t *Type) EnumValues(includeDeprecated bool) []EnumValue {

What did you expect?

EnumValues is also expected to respect the includeDeprecated arg

Minimal graphql.schema and models to reproduce

Schema:

schema {
	query: QueryRoot
}

type QueryRoot {
	onlyField: String
}

enum TestDeprecatedEnum {
	dep @deprecated
	notDep
}

Query:

{
    __type(name: "TestDeprecatedEnum") {
        name
        enumValues(includeDeprecated: false) {
            name
        }
    }
}

Expected Output:

{
    "__type": {
        "name": "TestDeprecatedEnum",
        "enumValues": [
            {
                "name": "notDep"
            }
        ]
    }
}

Current Output:

{
    "__type": {
        "name": "TestDeprecatedEnum",
        "enumValues": [
            {
                "name": "dep"
            },
            {
                "name": "notDep"
            }
        ]
    }
}

versions

  • gqlgen version? - latest
  • go version? - latest
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant