Skip to content

Commit

Permalink
fix(GRAPHQL): Undo the breaking change and tag it as deprecated. #7607
Browse files Browse the repository at this point in the history
(cherry picked from commit ebab7d6)
  • Loading branch information
JatinDev543 authored Mar 18, 2021
1 parent c868e0f commit 87820a5
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 363 deletions.
13 changes: 11 additions & 2 deletions graphql/schema/gqlschema.go
Original file line number Diff line number Diff line change
Expand Up @@ -1737,7 +1737,7 @@ func addAggregationResultType(schema *ast.Schema, defn *ast.Definition) {
func addGetQuery(schema *ast.Schema, defn *ast.Definition, generateSubscription bool) {
hasIDField := hasID(defn)
hasXIDField := hasXID(defn)
if !hasIDField && (defn.Kind == "INTERFACE" || !hasXIDField) {
if !hasIDField && !hasXIDField {
return
}

Expand All @@ -1760,7 +1760,16 @@ func addGetQuery(schema *ast.Schema, defn *ast.Definition, generateSubscription
},
})
}
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}}}})
}
name, dtype := xidTypeFor(defn)
qry.Arguments = append(qry.Arguments, &ast.ArgumentDefinition{
Name: name,
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,7 @@ input UpdateLibraryInput {
#######################

type Query {
getLibraryItem(refID: String!): LibraryItem @deprecated(reason: "@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")
queryLibraryItem(filter: LibraryItemFilter, order: LibraryItemOrder, first: Int, offset: Int): [LibraryItem]
aggregateLibraryItem(filter: LibraryItemFilter): LibraryItemAggregateResult
getBook(refID: String!): Book
Expand Down

0 comments on commit 87820a5

Please sign in to comment.