Skip to content

Commit

Permalink
Fix: issue where all primary key queries were mandatory in default gr…
Browse files Browse the repository at this point in the history
…aphjin queries (dosco#468)

* Updated the  basic documentation example

* Updated addTable function to create a new variable that would create the type that has not_null for id in the scenario where we query by ID

* Update intro.go

* Update intro.go

* Update intro.go

---------

Co-authored-by: Spacy <[email protected]>
  • Loading branch information
rkrishnasanka and dosco committed Apr 15, 2024
1 parent 46326df commit 2e3443a
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions core/intro.go
Original file line number Diff line number Diff line change
Expand Up @@ -295,10 +295,19 @@ func (in *Introspection) addTable(table sdata.DBTable, alias string) (err error)
}
in.addTypeTo("Mutation", ftM)

ftQS.addOrReplaceArg("id", newTypeRef(KIND_NONNULL, "", newTypeRef("", "ID", nil)))
in.addType(ftQS)
in.addTypeTo("Query", ftQS)
in.addTypeTo("Subscription", ftQS)
// add tableByID type to query and subscription
var ftQSByID FullType

if ftQSByID, err = in.addTableType(table, alias); err != nil {
return
}

ftQSByID.Name += "ByID"
ftQSByID.addOrReplaceArg("id", newTypeRef(KIND_NONNULL, "", newTypeRef("", "ID", nil)))
in.addType(ftQSByID)
in.addTypeTo("Query", ftQSByID)
in.addTypeTo("Subscription", ftQSByID)

return
}

Expand Down

0 comments on commit 2e3443a

Please sign in to comment.