Closed thenick775 closed 7 months ago
Hi @thenick775 can you please show a complete reproducible example? This example seems to indicate otherwise:
defmodule Bug do
use Absinthe.Schema
query do
field :hello, :string do
resolve fn _, _, _ ->
{:ok, " "}
end
end
end
end
Absinthe.run("{ hello }", Bug)
#=> {:ok, %{data: %{"hello" => " "}}}
Thank you, tracked this back down to ecto with empty_values through schemata, the last stop before we send to Absinthe.
My apologies for the confusion, and thank you for the example!
Glad I could help!
If submitting a bug, please provide the following:
Environment
Elixir 1.14.5 (compiled with Erlang/OTP 25)
Expected behavior
Returning any string scalar field with only white space trimms the string to an empty string.
Ex. returning any of the following from a resolver:
" "
" "
"\s"
Should return " " when fetching the query.
This is in alignment with the graphql string scalar spec, such that whitespace is significant: https://spec.graphql.org/October2021/#sec-String-Value
Actual behavior
Strings with only whitespace return as
""
Relevant Schema/Middleware Code
Note: I can try to provide an example, but take any sample phoenix app, add absinthe, and return a string from the resolver of the form shown above