{"action":"created","issue":{"url":"https://api.github.com/repos/rmosolgo/graphql-ruby/issues/1346","repository_url":"https://api.github.com/repos/rmosolgo/graphql-ruby","labels_url":"https://api.github.com/repos/rmosolgo/graphql-ruby/issues/1346/labels{/name}","comments_url":"https://api.github.com/repos/rmosolgo/graphql-ruby/issues/1346/comments","events_url":"https://api.github.com/repos/rmosolgo/graphql-ruby/issues/1346/events","html_url":"https://github.com/rmosolgo/graphql-ruby/pull/1346","id":304878599,"number":1346,"title":"[1.8] Add GraphQL::Schema::Interface.orphan_types configuration","user":{"login":"jturkel","id":2598096,"avatar_url":"https://avatars0.githubusercontent.com/u/2598096?v=4","gravatar_id":"","url":"https://api.github.com/users/jturkel","html_url":"https://github.com/jturkel","followers_url":"https://api.github.com/users/jturkel/followers","following_url":"https://api.github.com/users/jturkel/following{/other_user}","gists_url":"https://api.github.com/users/jturkel/gists{/gist_id}","starred_url":"https://api.github.com/users/jturkel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jturkel/subscriptions","organizations_url":"https://api.github.com/users/jturkel/orgs","repos_url":"https://api.github.com/users/jturkel/repos","events_url":"https://api.github.com/users/jturkel/events{/privacy}","received_events_url":"https://api.github.com/users/jturkel/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-03-13T18:12:44Z","updated_at":"2018-03-14T19:06:33Z","closed_at":null,"author_association":"NONE","pull_request":{"url":"https://api.github.com/repos/rmosolgo/graphql-ruby/pulls/1346","html_url":"https://github.com/rmosolgo/graphql-ruby/pull/1346","diff_url":"https://github.com/rmosolgo/graphql-ruby/pull/1346.diff","patch_url":"https://github.com/rmosolgo/graphql-ruby/pull/1346.patch"},"body":"As discussed in #1335 this PR implements a method for registering \"orphaned\" interface implementations which leads to better encapsulation than registering this information with the schema:\r\n\r\n```ruby\r\n# Old way (but still supported)\r\nclass MySchema < GraphQL::Schema\r\n  mutation Types::MutationType\r\n  query Types::QueryType\r\n\r\n  orphan_types Types::CircleType, Types::SquareType\r\nend\r\n\r\n# New way\r\nclass Types::Shape < GraphQL::Schema::Interface\r\n  orphan_types Types::CircleType, Types::SquareType\r\nend\r\n```\r\n\r\nI went with the terminology \"orphan types\" vs. \"implementations\" to be consistent with the existing orphan types API on `GraphQL::Schema` and to avoid confusion about being required to register all implementations vs. just ones that are unreachable from the schema roots. This does introduce a cyclic dependency between the types and the interfaces they implement but Rails auto-loading or the appropriate require statements should handle this.\r\n\r\nThe implementation is a mix of code inspired (i.e. copied) from `GraphQL::Schema::Union.possible_types` and `GraphQL::Schema.orphan_types`. For consistency between `GraphQL::Schema::Union.possible_types`, `GraphQL::Schema::Interface.orphan_types` and `GraphQL::Schema.orphan_types` I modified `GraphQL::Schema.orphan_types` to accept either an array or splatted array.\r\n"},"comment":{"url":"https://api.github.com/repos/rmosolgo/graphql-ruby/issues/comments/373139963","html_url":"https://github.com/rmosolgo/graphql-ruby/pull/1346#issuecomment-373139963","issue_url":"https://api.github.com/repos/rmosolgo/graphql-ruby/issues/1346","id":373139963,"user":{"login":"eapache","id":1706826,"avatar_url":"https://avatars1.githubusercontent.com/u/1706826?v=4","gravatar_id":"","url":"https://api.github.com/users/eapache","html_url":"https://github.com/eapache","followers_url":"https://api.github.com/users/eapache/followers","following_url":"https://api.github.com/users/eapache/following{/other_user}","gists_url":"https://api.github.com/users/eapache/gists{/gist_id}","starred_url":"https://api.github.com/users/eapache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eapache/subscriptions","organizations_url":"https://api.github.com/users/eapache/orgs","repos_url":"https://api.github.com/users/eapache/repos","events_url":"https://api.github.com/users/eapache/events{/privacy}","received_events_url":"https://api.github.com/users/eapache/received_events","type":"User","site_admin":false},"created_at":"2018-03-14T19:06:33Z","updated_at":"2018-03-14T19:06:33Z","author_association":"CONTRIBUTOR","body":"`orphan_implementations`?"}}
{"actor":{"display_login":"eapache"}}