Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

graphql: remove custom directive from internal schema #5354

Merged
merged 4 commits into from
May 6, 2020
Merged
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
9 changes: 3 additions & 6 deletions graphql/schema/gqlschema.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,11 @@ enum HTTPMethod {
input CustomHTTP {
url: String!
method: HTTPMethod!
body: String!
body: String
graphql: String
forwardHeaders: [String!]
}

input CustomGraphQL {
query: String!
}

directive @hasInverse(field: String!) on FIELD_DEFINITION
directive @search(by: [DgraphIndex!]) on FIELD_DEFINITION
directive @dgraph(type: String, pred: String) on OBJECT | INTERFACE | FIELD_DEFINITION
Expand All @@ -106,7 +103,7 @@ directive @auth(
add: AuthRule,
update: AuthRule,
delete:AuthRule) on OBJECT | FIELD_DEFINITION
directive @custom(http: CustomHTTP, graphql: CustomGraphQL) on FIELD_DEFINITION
directive @custom(http: CustomHTTP) on FIELD_DEFINITION
directive @remote on OBJECT | INTERFACE

input IntFilter {
Expand Down
2 changes: 1 addition & 1 deletion graphql/schema/rules.go
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ func nameCheck(defn *ast.Definition) *gqlerror.Error {
for _, fld := range defn.Fields {
// If we find any query or mutation field defined without a @custom directive, that
// is an error for us.
custom := fld.Directives.ForName("custom")
custom := fld.Directives.ForName(customDirective)
if custom == nil {
errMesg = "GraphQL Query and Mutation types are only allowed to have fields " +
"with @custom directive. Other fields are built automatically for you. " +
Expand Down
4 changes: 2 additions & 2 deletions graphql/schema/schemagen.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,10 +200,10 @@ func getAllowedHeaders(sch *ast.Schema, definitions []string) string {

for _, defn := range definitions {
typ := sch.Types[defn]
custom := typ.Directives.ForName("custom")
custom := typ.Directives.ForName(customDirective)
setHeaders(custom)
for _, field := range typ.Fields {
custom := field.Directives.ForName("custom")
custom := field.Directives.ForName(customDirective)
setHeaders(custom)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,11 @@ enum HTTPMethod {
input CustomHTTP {
url: String!
method: HTTPMethod!
body: String!
body: String
graphql: String
forwardHeaders: [String!]
}

input CustomGraphQL {
query: String!
}

directive @hasInverse(field: String!) on FIELD_DEFINITION
directive @search(by: [DgraphIndex!]) on FIELD_DEFINITION
directive @dgraph(type: String, pred: String) on OBJECT | INTERFACE | FIELD_DEFINITION
Expand All @@ -76,7 +73,7 @@ directive @auth(
add: AuthRule,
update: AuthRule,
delete:AuthRule) on OBJECT | FIELD_DEFINITION
directive @custom(http: CustomHTTP, graphql: CustomGraphQL) on FIELD_DEFINITION
directive @custom(http: CustomHTTP) on FIELD_DEFINITION
directive @remote on OBJECT | INTERFACE

input IntFilter {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,11 @@ enum HTTPMethod {
input CustomHTTP {
url: String!
method: HTTPMethod!
body: String!
body: String
graphql: String
forwardHeaders: [String!]
}

input CustomGraphQL {
query: String!
}

directive @hasInverse(field: String!) on FIELD_DEFINITION
directive @search(by: [DgraphIndex!]) on FIELD_DEFINITION
directive @dgraph(type: String, pred: String) on OBJECT | INTERFACE | FIELD_DEFINITION
Expand All @@ -81,7 +78,7 @@ directive @auth(
add: AuthRule,
update: AuthRule,
delete:AuthRule) on OBJECT | FIELD_DEFINITION
directive @custom(http: CustomHTTP, graphql: CustomGraphQL) on FIELD_DEFINITION
directive @custom(http: CustomHTTP) on FIELD_DEFINITION
directive @remote on OBJECT | INTERFACE

input IntFilter {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,11 @@ enum HTTPMethod {
input CustomHTTP {
url: String!
method: HTTPMethod!
body: String!
body: String
graphql: String
forwardHeaders: [String!]
}

input CustomGraphQL {
query: String!
}

directive @hasInverse(field: String!) on FIELD_DEFINITION
directive @search(by: [DgraphIndex!]) on FIELD_DEFINITION
directive @dgraph(type: String, pred: String) on OBJECT | INTERFACE | FIELD_DEFINITION
Expand All @@ -69,7 +66,7 @@ directive @auth(
add: AuthRule,
update: AuthRule,
delete:AuthRule) on OBJECT | FIELD_DEFINITION
directive @custom(http: CustomHTTP, graphql: CustomGraphQL) on FIELD_DEFINITION
directive @custom(http: CustomHTTP) on FIELD_DEFINITION
directive @remote on OBJECT | INTERFACE

input IntFilter {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,11 @@ enum HTTPMethod {
input CustomHTTP {
url: String!
method: HTTPMethod!
body: String!
body: String
graphql: String
forwardHeaders: [String!]
}

input CustomGraphQL {
query: String!
}

directive @hasInverse(field: String!) on FIELD_DEFINITION
directive @search(by: [DgraphIndex!]) on FIELD_DEFINITION
directive @dgraph(type: String, pred: String) on OBJECT | INTERFACE | FIELD_DEFINITION
Expand All @@ -86,7 +83,7 @@ directive @auth(
add: AuthRule,
update: AuthRule,
delete:AuthRule) on OBJECT | FIELD_DEFINITION
directive @custom(http: CustomHTTP, graphql: CustomGraphQL) on FIELD_DEFINITION
directive @custom(http: CustomHTTP) on FIELD_DEFINITION
directive @remote on OBJECT | INTERFACE

input IntFilter {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,11 @@ enum HTTPMethod {
input CustomHTTP {
url: String!
method: HTTPMethod!
body: String!
body: String
graphql: String
forwardHeaders: [String!]
}

input CustomGraphQL {
query: String!
}

directive @hasInverse(field: String!) on FIELD_DEFINITION
directive @search(by: [DgraphIndex!]) on FIELD_DEFINITION
directive @dgraph(type: String, pred: String) on OBJECT | INTERFACE | FIELD_DEFINITION
Expand All @@ -70,7 +67,7 @@ directive @auth(
add: AuthRule,
update: AuthRule,
delete:AuthRule) on OBJECT | FIELD_DEFINITION
directive @custom(http: CustomHTTP, graphql: CustomGraphQL) on FIELD_DEFINITION
directive @custom(http: CustomHTTP) on FIELD_DEFINITION
directive @remote on OBJECT | INTERFACE

input IntFilter {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,11 @@ enum HTTPMethod {
input CustomHTTP {
url: String!
method: HTTPMethod!
body: String!
body: String
graphql: String
forwardHeaders: [String!]
}

input CustomGraphQL {
query: String!
}

directive @hasInverse(field: String!) on FIELD_DEFINITION
directive @search(by: [DgraphIndex!]) on FIELD_DEFINITION
directive @dgraph(type: String, pred: String) on OBJECT | INTERFACE | FIELD_DEFINITION
Expand All @@ -69,7 +66,7 @@ directive @auth(
add: AuthRule,
update: AuthRule,
delete:AuthRule) on OBJECT | FIELD_DEFINITION
directive @custom(http: CustomHTTP, graphql: CustomGraphQL) on FIELD_DEFINITION
directive @custom(http: CustomHTTP) on FIELD_DEFINITION
directive @remote on OBJECT | INTERFACE

input IntFilter {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,11 @@ enum HTTPMethod {
input CustomHTTP {
url: String!
method: HTTPMethod!
body: String!
body: String
graphql: String
forwardHeaders: [String!]
}

input CustomGraphQL {
query: String!
}

directive @hasInverse(field: String!) on FIELD_DEFINITION
directive @search(by: [DgraphIndex!]) on FIELD_DEFINITION
directive @dgraph(type: String, pred: String) on OBJECT | INTERFACE | FIELD_DEFINITION
Expand All @@ -65,7 +62,7 @@ directive @auth(
add: AuthRule,
update: AuthRule,
delete:AuthRule) on OBJECT | FIELD_DEFINITION
directive @custom(http: CustomHTTP, graphql: CustomGraphQL) on FIELD_DEFINITION
directive @custom(http: CustomHTTP) on FIELD_DEFINITION
directive @remote on OBJECT | INTERFACE

input IntFilter {
Expand Down
9 changes: 3 additions & 6 deletions graphql/schema/testdata/schemagen/output/deprecated.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,11 @@ enum HTTPMethod {
input CustomHTTP {
url: String!
method: HTTPMethod!
body: String!
body: String
graphql: String
forwardHeaders: [String!]
}

input CustomGraphQL {
query: String!
}

directive @hasInverse(field: String!) on FIELD_DEFINITION
directive @search(by: [DgraphIndex!]) on FIELD_DEFINITION
directive @dgraph(type: String, pred: String) on OBJECT | INTERFACE | FIELD_DEFINITION
Expand All @@ -65,7 +62,7 @@ directive @auth(
add: AuthRule,
update: AuthRule,
delete:AuthRule) on OBJECT | FIELD_DEFINITION
directive @custom(http: CustomHTTP, graphql: CustomGraphQL) on FIELD_DEFINITION
directive @custom(http: CustomHTTP) on FIELD_DEFINITION
directive @remote on OBJECT | INTERFACE

input IntFilter {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,11 @@ enum HTTPMethod {
input CustomHTTP {
url: String!
method: HTTPMethod!
body: String!
body: String
graphql: String
forwardHeaders: [String!]
}

input CustomGraphQL {
query: String!
}

directive @hasInverse(field: String!) on FIELD_DEFINITION
directive @search(by: [DgraphIndex!]) on FIELD_DEFINITION
directive @dgraph(type: String, pred: String) on OBJECT | INTERFACE | FIELD_DEFINITION
Expand All @@ -79,7 +76,7 @@ directive @auth(
add: AuthRule,
update: AuthRule,
delete:AuthRule) on OBJECT | FIELD_DEFINITION
directive @custom(http: CustomHTTP, graphql: CustomGraphQL) on FIELD_DEFINITION
directive @custom(http: CustomHTTP) on FIELD_DEFINITION
directive @remote on OBJECT | INTERFACE

input IntFilter {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,11 @@ enum HTTPMethod {
input CustomHTTP {
url: String!
method: HTTPMethod!
body: String!
body: String
graphql: String
forwardHeaders: [String!]
}

input CustomGraphQL {
query: String!
}

directive @hasInverse(field: String!) on FIELD_DEFINITION
directive @search(by: [DgraphIndex!]) on FIELD_DEFINITION
directive @dgraph(type: String, pred: String) on OBJECT | INTERFACE | FIELD_DEFINITION
Expand All @@ -79,7 +76,7 @@ directive @auth(
add: AuthRule,
update: AuthRule,
delete:AuthRule) on OBJECT | FIELD_DEFINITION
directive @custom(http: CustomHTTP, graphql: CustomGraphQL) on FIELD_DEFINITION
directive @custom(http: CustomHTTP) on FIELD_DEFINITION
directive @remote on OBJECT | INTERFACE

input IntFilter {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,11 @@ enum HTTPMethod {
input CustomHTTP {
url: String!
method: HTTPMethod!
body: String!
body: String
graphql: String
forwardHeaders: [String!]
}

input CustomGraphQL {
query: String!
}

directive @hasInverse(field: String!) on FIELD_DEFINITION
directive @search(by: [DgraphIndex!]) on FIELD_DEFINITION
directive @dgraph(type: String, pred: String) on OBJECT | INTERFACE | FIELD_DEFINITION
Expand All @@ -78,7 +75,7 @@ directive @auth(
add: AuthRule,
update: AuthRule,
delete:AuthRule) on OBJECT | FIELD_DEFINITION
directive @custom(http: CustomHTTP, graphql: CustomGraphQL) on FIELD_DEFINITION
directive @custom(http: CustomHTTP) on FIELD_DEFINITION
directive @remote on OBJECT | INTERFACE

input IntFilter {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,11 @@ enum HTTPMethod {
input CustomHTTP {
url: String!
method: HTTPMethod!
body: String!
body: String
graphql: String
forwardHeaders: [String!]
}

input CustomGraphQL {
query: String!
}

directive @hasInverse(field: String!) on FIELD_DEFINITION
directive @search(by: [DgraphIndex!]) on FIELD_DEFINITION
directive @dgraph(type: String, pred: String) on OBJECT | INTERFACE | FIELD_DEFINITION
Expand All @@ -72,7 +69,7 @@ directive @auth(
add: AuthRule,
update: AuthRule,
delete:AuthRule) on OBJECT | FIELD_DEFINITION
directive @custom(http: CustomHTTP, graphql: CustomGraphQL) on FIELD_DEFINITION
directive @custom(http: CustomHTTP) on FIELD_DEFINITION
directive @remote on OBJECT | INTERFACE

input IntFilter {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,11 @@ enum HTTPMethod {
input CustomHTTP {
url: String!
method: HTTPMethod!
body: String!
body: String
graphql: String
forwardHeaders: [String!]
}

input CustomGraphQL {
query: String!
}

directive @hasInverse(field: String!) on FIELD_DEFINITION
directive @search(by: [DgraphIndex!]) on FIELD_DEFINITION
directive @dgraph(type: String, pred: String) on OBJECT | INTERFACE | FIELD_DEFINITION
Expand All @@ -89,7 +86,7 @@ directive @auth(
add: AuthRule,
update: AuthRule,
delete:AuthRule) on OBJECT | FIELD_DEFINITION
directive @custom(http: CustomHTTP, graphql: CustomGraphQL) on FIELD_DEFINITION
directive @custom(http: CustomHTTP) on FIELD_DEFINITION
directive @remote on OBJECT | INTERFACE

input IntFilter {
Expand Down
Loading