@goField directive is ignored on Query/Mutation arguments
- Vorherrschende Sprache
- Go
- Sterne
- 10.8k
- Forks
- 1.3k
- Ø Merge
- 2 T. 36 Min.
- Gemergte PRs (30 T.)
- 26
Beschreibung
@goField directive is ignored on Query/Mutation
arguments but works on Input type fields
## Description
The `@goField` directive with `type` parameter
behaves inconsistently between direct Query/Mutation
arguments and Input type fields. When applied to
Query/Mutation arguments, the directive is silently
ignored, but it works as expected on Input type
fields.
## Current Behavior
### 1. Direct Query/Mutation arguments - NOT WORKING
❌
```graphql
type Query {
getUser(id: ID! @goField(type:
"domain.UserID")): User
}
Generated resolver:
// Expected:
func (r *queryResolver) GetUser(ctx context.Context, id domain.UserID) (*User, error)
// Actual:
func (r *queryResolver) GetUser(ctx context.Context, id string) (*User, error)
The @goField(type:"...") directive is completely
ignored.
```
### 2. Input type fields - WORKING ✅
```graphql
input GetUserInput {
id: ID! @goField(type: "domain.UserID")
}
type Query {
getUser(input: GetUserInput!): User
}
Generated model:
type GetUserInput struct {
ID domain.UserID `json:"id"` // ✅ Custom type
is correctly applied
}
```
Please let me know if there's a recommended way to map
Query/Mutation arguments to custom Go types.
Beitragsleitfaden
Bewertung
Dieses Issue wurde noch nicht bewertet.