graph/encoding/graphql: note requirement of dst parameter

The spanning tree walk sets nodes' IDs using the SetIDFromString method
so note that nodes returned by the destination's NewNode method must
satisfy StringIDSetter.
This commit is contained in:
Dan Kortschak
2023-01-03 18:37:32 +10:30
parent d6b9d45e9e
commit b7bed9533b

View File

@@ -17,7 +17,8 @@ import (
// Unmarshal parses the JSON-encoded data and stores the result in dst.
// Node IDs are obtained from the JSON fields identified by the uid parameter.
// UIDs obtained from the JSON encoding must map to unique node ID values
// consistently across the JSON-encoded spanning tree.
// consistently across the JSON-encoded spanning tree. graph.Node values
// returned by dst.NewNode must satisfy StringIDSetter.
func Unmarshal(data []byte, uid string, dst encoding.Builder) error {
if uid == "" {
return errors.New("graphql: invalid UID field name")