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

fix(GRAPHQL): Undo the breaking change and tag it as deprecated. #7602

Merged
merged 5 commits into from
Mar 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions graphql/schema/gqlschema.go
Original file line number Diff line number Diff line change
Expand Up @@ -1904,7 +1904,7 @@ func addGetQuery(schema *ast.Schema, defn *ast.Definition, providesTypeMap map[s
hasIDField := hasID(defn)
hasXIDField := hasXID(defn)
xidCount := xidsCount(defn.Fields)
if !hasIDField && (defn.Kind == "INTERFACE" || !hasXIDField) {
if !hasIDField && !hasXIDField {
return
}
qry := &ast.FieldDefinition{
Expand All @@ -1926,7 +1926,16 @@ func addGetQuery(schema *ast.Schema, defn *ast.Definition, providesTypeMap map[s
},
})
}
if hasXIDField && defn.Kind != "INTERFACE" {
if hasXIDField {
if defn.Kind == "INTERFACE" {
qry.Directives = append(
qry.Directives, &ast.Directive{Name: deprecatedDirective,
Arguments: ast.ArgumentList{&ast.Argument{Name: "reason",
Value: &ast.Value{Raw: "@id argument for get query on interface is being deprecated, " +
"it will be removed in v21.11.0, " +
"please update your query to not use that argument",
Kind: ast.StringValue}}}})
}
for _, fld := range defn.Fields {
if hasIDDirective(fld) {
qry.Arguments = append(qry.Arguments, &ast.ArgumentDefinition{
Expand Down

This file was deleted.

This file was deleted.

Loading