{"action":"closed","issue":{"url":"https://api.github.com/repos/facebook/relay/issues/677","repository_url":"https://api.github.com/repos/facebook/relay","labels_url":"https://api.github.com/repos/facebook/relay/issues/677/labels{/name}","comments_url":"https://api.github.com/repos/facebook/relay/issues/677/comments","events_url":"https://api.github.com/repos/facebook/relay/issues/677/events","html_url":"https://github.com/facebook/relay/issues/677","id":121629791,"number":677,"title":"Validate connection calls after excluding null values at runtime","user":{"login":"BerndWessels","id":1776695,"avatar_url":"https://avatars.githubusercontent.com/u/1776695?v=3","gravatar_id":"","url":"https://api.github.com/users/BerndWessels","html_url":"https://github.com/BerndWessels","followers_url":"https://api.github.com/users/BerndWessels/followers","following_url":"https://api.github.com/users/BerndWessels/following{/other_user}","gists_url":"https://api.github.com/users/BerndWessels/gists{/gist_id}","starred_url":"https://api.github.com/users/BerndWessels/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BerndWessels/subscriptions","organizations_url":"https://api.github.com/users/BerndWessels/orgs","repos_url":"https://api.github.com/users/BerndWessels/repos","events_url":"https://api.github.com/users/BerndWessels/events{/privacy}","received_events_url":"https://api.github.com/users/BerndWessels/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/facebook/relay/labels/enhancement","name":"enhancement","color":"84b6eb"},{"url":"https://api.github.com/repos/facebook/relay/labels/help%20wanted","name":"help wanted","color":"159818"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-12-11T03:33:57Z","updated_at":"2016-05-10T16:18:23Z","closed_at":"2016-05-10T16:18:23Z","body":"Hello\r\nUsing the following query:\r\n\r\n      fragment on Person {\r\n        firstName\r\n        email\r\n        posts(first: $first, after: $after, last: $last, before: $before) {\r\n          edges {\r\n            cursor\r\n            node {\r\n              id\r\n              title\r\n            }\r\n          }\r\n          totalCount\r\n          pageInfo {\r\n            hasNextPage\r\n            hasPreviousPage\r\n            startCursor\r\n            endCursor\r\n          }\r\n        }\r\n      }\r\n\r\ncauses the following error:\r\n\r\n    Uncaught Error: GraphQL validation/transform error ``Connection arguments `posts(before: <cursor>, first: <count>)` are not supported. Use `(first: <count>)`, `(after: <cursor>, first: <count>)`, or `(before: <cursor>, last: <count>)`.``\r\n\r\nSo obviously some combinations of parameters are not valid - and that is fair enough.\r\n\r\nBut I was expecting that the validation only happens after it excluded variables with value `null`. Unfortunately that doesn't seem to be the case, otherwise we could use the previous query with these variables:\r\n\r\n    export default Relay.createContainer(Home, {\r\n      initialVariables: {\r\n        first: 2,\r\n        after: \"YXJyYXljb25uZWN0aW9uOjQ=\",\r\n        last: null,\r\n        before: null,\r\n      },\r\n      fragments: {\r\n        viewer: () => Relay.QL`\r\n          fragment on Person {\r\n\r\nAnd it should succeed since only the `first` variable is non-null and all the other variables should be ignored / not included.\r\n\r\n\r\nSo for now we have to use terrible workarounds like this:\r\n\r\n    export default Relay.createContainer(Home, {\r\n      initialVariables: {\r\n        forward: true,\r\n        first: 2,\r\n        after: \"YXJyYXljb25uZWN0aW9uOjQ=\",\r\n        last: null,\r\n        before: null,\r\n      },\r\n      fragments: {\r\n        viewer: () => Relay.QL`\r\n          fragment on Person {\r\n            firstName\r\n            email\r\n            posts(first: $first, after: $after) @include(if: $forward) {\r\n              edges {\r\n                cursor\r\n                node {\r\n                  id\r\n                  title\r\n                }\r\n              }\r\n              totalCount\r\n              pageInfo {\r\n                hasNextPage\r\n                hasPreviousPage\r\n                startCursor\r\n                endCursor\r\n              }\r\n            },\r\n            posts(last: $last, before: $before) @skip(if: $forward) {\r\n              edges {\r\n                cursor\r\n                node {\r\n                  id\r\n                  title\r\n                }\r\n              }\r\n              totalCount\r\n              pageInfo {\r\n                hasNextPage\r\n                hasPreviousPage\r\n                startCursor\r\n                endCursor\r\n              }\r\n            },\r\n            ${UpdatePersonMutation.getFragment('person')}\r\n          }\r\n        `\r\n      }\r\n    });\r\n\r\n\r\nSo basically my feature request is that variables with `null` value will be ignored and excluded before query validation and submitting."}}