The new syntax to input permission queries has some known limitations and also uncovered some bugs in the former implementation. These are going to be fixed soon.
I'm documenting them here until they are fixed:
Just one thing, regarding:
if query name not unique in yaml definition (t.graphql:same, t.graphql:same)
Why would that be an issue?
Agreed with @kbrandwijk, that should be supported.
That was probably not worded precisely enough. If you have typename.graphql with two queries in it with the same name and you use the typename.graphql:queryName adressing in the yaml we will use the first one for both since we can't discern which one is which.
permissions:
- operation: User.create
query: ./User.graphql:create
- operation: User.create
query: ./User.graphql:create
query create {
SomeUserExists
}
query create {
SomeOtherQuery
}
We will throw an error on deployment of this constellation at some point.
@do4gr That's a different case. I (and I think @marktani too) were thinking about referencing the same query in multiple places in the project file. That should be supported. Naming two different queries the same would not be right of course.
Ah ok, yes the use case you mention will be supported.
Also see https://github.com/graphcool/graphcool/issues/794 for another very valid validation use case from @FredyC.
I added missing relations to my top comment of the known limitations. I'll update the top comment once the first fixes are rolled out.
We rolled out several fixes that address permissions issues:
I'll remove the fixed issues from the top comment.
So I have just noticed it indeed reports an error when there is a permission for non-existing relation. Good job on that. However, it also spills out unformatted JSON with whole response payload. A quite scary sight for an untrained eye :)
@FredyC Thanks for mentioning the formatting issue. That was unintentional. I'll adjust it to have the same formatting as other deploy errors.
This issue has been moved to graphcool/graphcool-framework.