Skip to content

Commit 959174e

Browse files
bbakermanandimarek
authored andcommitted
graphql-java#414 added schema validation in subscriptions
1 parent 5b892a6 commit 959174e

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

src/main/java/graphql/schema/GraphQLSchema.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,10 @@ public boolean isSupportingMutations() {
8181
return mutationType != null;
8282
}
8383

84+
public boolean isSupportingSubscriptions() {
85+
return subscriptionType != null;
86+
}
87+
8488
public static Builder newSchema() {
8589
return new Builder();
8690
}

src/main/java/graphql/schema/validation/SchemaValidator.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ public Set<SchemaValidationError> validateSchema(GraphQLSchema schema) {
3232
if (schema.isSupportingMutations()) {
3333
traverse(schema.getMutationType(), rules, validationErrorCollector);
3434
}
35+
if (schema.isSupportingSubscriptions()) {
36+
traverse(schema.getSubscriptionType(), rules, validationErrorCollector);
37+
}
3538
return validationErrorCollector.getErrors();
3639
}
3740

0 commit comments

Comments
 (0)