Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions graphql/schema/gqlschema_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1991,6 +1991,28 @@ invalid_schemas:
"locations":[{"line":1, "column":6}]},
]

- name: "@auth and @withSubscription directive on type"
input: |
type Class @withSubscription @auth(query: { rule: "{ $X_MyApp_Role: { eq: \"ADMIN\" }}"}) {
id: ID!
name: String!
numStudents: Int!
}

type School {
id: ID!
established: String!
name: String! @custom(http: {
url: "http://mock:8888/schoolNames/$id/$established",
method: "POST",
body: "{sid: $id}"
})
}
errlist: [
{"message": "Type Class; cannot have both @withSubscription and @auth directive",
"locations":[{"line":1, "column":6}]},
]

- name: "@withSubscription and @remote directive on type"
input: |
type Class @withSubscription @remote {
Expand Down
4 changes: 4 additions & 0 deletions graphql/schema/rules.go
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,10 @@ func conflictingDirectiveValidation(schema *ast.Schema, typ *ast.Definition) gql
return []*gqlerror.Error{gqlerror.ErrorPosf(typ.Position, `Type %s; cannot have both @%s and @%s directive`,
typ.Name, SubscriptionDirective, remoteDirective)}
}
if hasSubscription && hasAuth {
return []*gqlerror.Error{gqlerror.ErrorPosf(typ.Position, `Type %s; cannot have both @%s and @%s directive`,
typ.Name, SubscriptionDirective, authDirective)}
}
return nil
}

Expand Down