GraphQLSwift / GraphQL

The Swift GraphQL implementation for macOS and Linux
MIT License
938 stars 72 forks source link

Allows numeric values to be parsed as GraphQLBools #156

Closed NeedleInAJayStack closed 1 week ago

NeedleInAJayStack commented 1 week ago

This is because MapCoder round-trips of Bools result in Number types. This is hard to avoid since it gets put into an NSObject container and there is no NSBool type.

Note that query validation will still disallow directly passing numeric values into boolean arguments as tested here: https://github.com/GraphQLSwift/GraphQL/blob/0dfa0d9b0ed3abb922632908e269186398bba8d3/Tests/GraphQLTests/ValidationTests/ValuesOfCorrectTypeRuleTests.swift#L412 Instead this simply allows numeric Swift map objects to be interpreted as GraphQLBool types.

Fixes https://github.com/GraphQLSwift/GraphQL/issues/155