cjoudrey / graphql-schema-linter

Validate GraphQL schema definitions against a set of rules
MIT License
694 stars 62 forks source link

allow non-nullable first and last arguments in relay-connection-arguments-spec #203

Closed swac closed 4 years ago

swac commented 4 years ago

This addresses https://github.com/cjoudrey/graphql-schema-linter/issues/148.

The first argument type in a Relay connection can now be non-nullable if backward pagination is disabled (likewise for last when forward pagination is disabled). So the following types are now permitted:

type Query {
  users(last: Int!, before: String): UserConnection
}
type Query {
  users(first: Int!, after: String): UserConnection
}

The following, however, are not permitted:

type Query {
  users(first: Int!, after: String, last: Int, before: String): UserConnection
}
type Query {
  users(first: Int, after: String, last: Int!, before: String): UserConnection
}
swac commented 4 years ago

Thanks for the review @cjoudrey! I've updated accordingly 😄