Skip to content

Commit 49b0a83

Browse files
author
Rob Myers
committed
Revert "Update v1/topdown/graphql.go"
v1/topdown/graphql.go:582:17: cannot use schemaAST (variable of interface type "github.com/open-policy-agent/opa/v1/ast".Value) as *"github.com/open-policy-agent/opa/internal/gqlparser/ast".SchemaDocument value in return statement This reverts commit 0f34a78.
1 parent 0f34a78 commit 49b0a83

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

Diff for: v1/topdown/graphql.go

+10-5
Original file line numberDiff line numberDiff line change
@@ -576,15 +576,20 @@ func cacheGetSchema(bctx BuiltinContext, operands []*ast.Term) (string, *gqlast.
576576
// Returns the cache key and a SchemaDocument if this key already exists in the cache
577577
// Note: the SchemaDocument is not a validated Schema
578578
func cacheGetSchemaDoc(bctx BuiltinContext, operands []*ast.Term) (string, *gqlast.SchemaDocument) {
579-
if key, keyOk := cacheKeyWithPrefix(bctx, operands, "gql_schema_ast"); keyOk {
579+
var key string
580+
var schemaDoc *gqlast.SchemaDocument
581+
582+
if k, keyOk := cacheKeyWithPrefix(bctx, operands, "gql_schema_doc"); keyOk {
583+
key = k
580584
if val, ok := bctx.InterQueryBuiltinValueCache.Get(ast.StringTerm(key).Value); ok {
581-
if schemaAST, isAstValue := val.(ast.Value); isAstValue {
582-
return key, schemaAST
585+
var isSchema bool
586+
schemaDoc, isSchema = val.(*gqlast.SchemaDocument)
587+
if !isSchema {
588+
return key, nil
583589
}
584590
}
585-
return key, nil
586591
}
587-
return "", nil
592+
return key, schemaDoc
588593
}
589594

590595
// Returns the cache key and a SchemaDocument if this key already exists in the cache

0 commit comments

Comments
 (0)