Input arguments being marked as `deprecated` in introspection when only the mutation is `deprecated`
- Vorherrschende Sprache
- Go
- Sterne
- 10.8k
- Forks
- 1.3k
- Ø Merge
- 2 T. 36 Min.
- Gemergte PRs (30 T.)
- 26
Beschreibung
I have a mutation that has been deprecated using the `@deprecated` directive. The input arguments are *not* marked as deprecated.
However, when I do introspection on this schema I get told that the input argument itself is deprecated. And it is deprecated for the same reason as the mutation itself. This causes GraphQL validation errors as a required argument cannot be marked as duplicated.
I'd expect this to not be marked as deprecated unless I explicitly added the `@deprecated` directive on the input.
Validation:
https://github.com/graphql/graphql-js/blob/9032db1e4e55052bead6936359ecc5592c817f64/src/type/validate.ts#L198
From what I can tell, this is the issue - we are using the deprecation directive of the Field (mutation) instead of the argument.
https://github.com/99designs/gqlgen/commit/6cb6e32c342b3997d287f9ecab6e14d22b9dcceb#diff-f8b9e33d3446f4aed9c9b9ff0a3ed476301f213bb86f66d74885d22b890331ecR84
I'm using github.com/99designs/gqlgen v0.17.76
Schema:
```graphql
type Mutation {
createBankToken(input: CreateBankTokenInput!): CreateBankTokenOutput! @authz(external: "write:*") @deprecated(reason: "Use createBankTokenV2 instead")
}
input CreateBankTokenInput {
verificationToken: String!
verificationCode: String!
}
type CreateBankTokenOutput {
token: BankToken
}
type BankToken {
token: String!
expiresIn: Int!
}
````
Introspection Result:
```json
{
"name": "createBankToken",
"description": null,
"isDeprecated": true,
"deprecationReason": "Use createBankTokenV2 instead",
"args": [
{
"name": "input",
"description": null,
"defaultValue": null,
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "INPUT_OBJECT",
"name": "CreateBankTokenInput",
"ofType": null
}
},
"isDeprecated": true,
"deprecationReason": "Use createBankTokenV2 instead"
}
],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "OBJECT",
"name": "CreateBankTokenOutput",
"ofType": null
}
}
},
```
Beitragsleitfaden
Bewertung
Dieses Issue wurde noch nicht bewertet.