{"action":"created","issue":{"url":"https://api.github.com/repos/graphql-python/graphene/issues/363","repository_url":"https://api.github.com/repos/graphql-python/graphene","labels_url":"https://api.github.com/repos/graphql-python/graphene/issues/363/labels{/name}","comments_url":"https://api.github.com/repos/graphql-python/graphene/issues/363/comments","events_url":"https://api.github.com/repos/graphql-python/graphene/issues/363/events","html_url":"https://github.com/graphql-python/graphene/pull/363","id":188922202,"number":363,"title":"Add OmniScalar type","user":{"login":"jamesboehmer","id":750457,"avatar_url":"https://avatars.githubusercontent.com/u/750457?v=3","gravatar_id":"","url":"https://api.github.com/users/jamesboehmer","html_url":"https://github.com/jamesboehmer","followers_url":"https://api.github.com/users/jamesboehmer/followers","following_url":"https://api.github.com/users/jamesboehmer/following{/other_user}","gists_url":"https://api.github.com/users/jamesboehmer/gists{/gist_id}","starred_url":"https://api.github.com/users/jamesboehmer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jamesboehmer/subscriptions","organizations_url":"https://api.github.com/users/jamesboehmer/orgs","repos_url":"https://api.github.com/users/jamesboehmer/repos","events_url":"https://api.github.com/users/jamesboehmer/events{/privacy}","received_events_url":"https://api.github.com/users/jamesboehmer/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-11-12T17:04:20Z","updated_at":"2016-11-15T03:58:57Z","closed_at":"2016-11-15T03:58:57Z","pull_request":{"url":"https://api.github.com/repos/graphql-python/graphene/pulls/363","html_url":"https://github.com/graphql-python/graphene/pull/363","diff_url":"https://github.com/graphql-python/graphene/pull/363.diff","patch_url":"https://github.com/graphql-python/graphene/pull/363.patch"},"body":"Using the OmniScalar type, you can define a field where the scalar type is nondeterministic.  For example, take this Elasticsearch term aggregation on the `_type` and `year` fields in the index:\r\n\r\n```\r\n{\r\n  \"_type\": {\r\n    \"buckets\": [\r\n      {\r\n        \"key\": \"article\",\r\n        \"doc_count\": 367086\r\n      },\r\n      {\r\n        \"key\": \"video\",\r\n        \"doc_count\": 40046\r\n      }\r\n    ],\r\n    \"sum_other_doc_count\": 0,\r\n    \"doc_count_error_upper_bound\": 0\r\n  },\r\n  \"year\": {\r\n    \"buckets\": [\r\n      {\r\n        \"key\": 2015,\r\n        \"doc_count\": 2963\r\n      },\r\n      {\r\n        \"key\": 2016,\r\n        \"doc_count\": 2059\r\n      }\r\n    ],\r\n    \"sum_other_doc_count\": 357862,\r\n    \"doc_count_error_upper_bound\": 614\r\n  }\r\n}\r\n```\r\n\r\nThe `key` field is either a `String` or an `Int` depending on how it was mapped in Elasticsearch.  We'd like to make the aggregations part of the GraphQL schema, so instead of requiring the developer to define a union of object types with varying scalars for the `key` field, we simplify the schema by declaring only `key = OmniScalar()`.\r\n"},"comment":{"url":"https://api.github.com/repos/graphql-python/graphene/issues/comments/260541320","html_url":"https://github.com/graphql-python/graphene/pull/363#issuecomment-260541320","issue_url":"https://api.github.com/repos/graphql-python/graphene/issues/363","id":260541320,"user":{"login":"syrusakbary","id":188257,"avatar_url":"https://avatars.githubusercontent.com/u/188257?v=3","gravatar_id":"","url":"https://api.github.com/users/syrusakbary","html_url":"https://github.com/syrusakbary","followers_url":"https://api.github.com/users/syrusakbary/followers","following_url":"https://api.github.com/users/syrusakbary/following{/other_user}","gists_url":"https://api.github.com/users/syrusakbary/gists{/gist_id}","starred_url":"https://api.github.com/users/syrusakbary/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/syrusakbary/subscriptions","organizations_url":"https://api.github.com/users/syrusakbary/orgs","repos_url":"https://api.github.com/users/syrusakbary/repos","events_url":"https://api.github.com/users/syrusakbary/events{/privacy}","received_events_url":"https://api.github.com/users/syrusakbary/received_events","type":"User","site_admin":false},"created_at":"2016-11-15T03:58:57Z","updated_at":"2016-11-15T03:58:57Z","body":"Hi @jamesboehmer,\r\n\r\nI think things like a `OmniScalar` could be useful for other developers, but I think is better if is as an independent package as solves a very specific use case and could mislead the developers on which one they should use -`String` or `OmniScalar`- as both would work for \"String\" fields."}}
{"actor":{"display_login":"syrusakbary"}}