Skip to content

graphql-ruby allows scalar types in the Union #4243

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ojab opened this issue Nov 11, 2022 · 1 comment
Closed

graphql-ruby allows scalar types in the Union #4243

ojab opened this issue Nov 11, 2022 · 1 comment

Comments

@ojab
Copy link
Contributor

ojab commented Nov 11, 2022

Describe the bug

I found kinda related issue #3092 and it was proposed to use wrapper types, but

module Types
  class XxUnionType < GraphQL::Schema::Union
    possible_types GraphQL::Types::Float, GraphQL::Types::String
  end
end

works and generates

union XxUnion = Float | String

It probably shouldn't, because scalar types are not allowed in the unions by the spec (graphql/graphql-spec#215)

Versions

graphql version: 2.0.15

@rmosolgo
Copy link
Owner

Oops! Agreed this should not be possible.

rmosolgo added a commit that referenced this issue Dec 14, 2022
Only allow object types to be union types, fixes #4243
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants