OK, sorry I wasn’t clear. The title of this issue should have been:
“Authorization configuration not recognized when schema is updated using admin REST endpoint”
Steps to reproduce:
- Add a
# Dgraph.Authorization line to a schema
- Add an @auth directive to any type
- Update the schema via the admin REST API
curl -v -X POST --header 'content-type: application/octet-stream' localhost:8080/admin/schema -d '@./schema.graphql'
- Restart dgraph
- Make a graphql request with a valid JWT that should pass the @auth directive.
The query/mutation will not return/alter (silently which is by design apparently)
Obviously with a valid JTW the expected outcome is that the query/mutation should succeed.
In order to diagnose the problem, I forked dgraph and inspected how the
# Dgraph.Authorization... was getting parsed. I discovered that the schema was being sent to graphql/schema/schemagen.go::parseSecrets() with no newlines (which that function expects).
In order to test my theory, I made a simple string replacement in that method which appends a newline just before the schema is parsed.
Check out this diff:
When the schema is altered by the oneline change in that diff, the query/mutation works.