Skip to content
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

Coerce non-null values into lists of size one #1376

Merged
merged 2 commits into from
Jun 4, 2022

Conversation

guymers
Copy link
Contributor

@guymers guymers commented Jun 2, 2022

As per the specification, if a value passed as an input to a list type is
not a list and is not null then it should be coerced into a list of size
one.

As per the specification, if a value passed as an input to a list type
is not a list and is not null then it should be coerced into a list of
size one.
@ghostdogpr ghostdogpr requested a review from frekw June 2, 2022 01:52
Copy link
Collaborator

@frekw frekw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thanks! 🙏

@guymers
Copy link
Contributor Author

guymers commented Jun 2, 2022

I can't get listListInt: ListListIntArg => Option[List[Option[List[Option[Int]]]]] to compile on Scala 3 so I have made the tests that need it only run on Scala 2.

@frekw
Copy link
Collaborator

frekw commented Jun 2, 2022

@guymers what compilation error are you seeing on Scala 3? I saw that you replaced genMacro since it's not available for Scala 3, but can't see what failed for you after doing so :)

@ghostdogpr
Copy link
Owner

Maybe ran into this? scala/scala3#13044

@guymers
Copy link
Contributor Author

guymers commented Jun 2, 2022

Yeah its that. Defining a schema and arg builder for Option[List[Option[Int]]] allowed listInt to compile, but defining them doesn't help for Option[List[Option[List[Option[Int]]]]].

@ghostdogpr
Copy link
Owner

Thanks for the fix and adding all the test cases!

@ghostdogpr ghostdogpr merged commit c6deb1b into ghostdogpr:master Jun 4, 2022
@guymers guymers deleted the list-input-coercion branch June 4, 2022 09:04
ghostdogpr pushed a commit that referenced this pull request Jun 20, 2022
* upgrade zio-config to 2.0.0 (#1367)

* Update http4s-blaze-server to 0.23.12 (#1368)

* Properly validate floating point numbers on input (#1370)

* Escape quotes in description strings (#1372)

Escape " with \" in normally quoted strings and """ with \""" in
triple-quoted strings.
https://spec.graphql.org/October2021/#sec-String-Value

* Improve persisted query performance by caching the document (#1371)

* improve persisted query performance by caching the document instead of the unparsed string.

* address comments

* Escape special characters in normally quoted strings (#1373)

* Correct field types for interface fields on union (#1375)

Ensure that when an interface fragment is used on a union that the
fields its selected have the correct type instead of always being
`String`.

* Coerce non-null values into lists of size one (#1376)

* Coerce non-null values into lists of size one

As per the specification, if a value passed as an input to a list type
is not a list and is not null then it should be coerced into a list of
size one.

* Make work on Scala 3

* Client auto-gen Option conflict (#1377)

* have ClientWriter print scala.Option instead of Option

* Fix replace case where Option may appear multiple times

* Add test for various returns of GQL Option and scala.Option

* run fmt

* update ClientWriterViewSpec

* SchemaWrite should also print scala.Option instead of Option

* add a scripted test with a schema containing type Option

* flatten scripted compile tests

* make helper method for safe Option string replacement

* add support for graphql-transport-ws (#1354)

* add support for graphql-transport-ws

* Set api mappings for ZIO (#1381)

Co-authored-by: Lordie <levimanga@gmail.com>
Co-authored-by: Scala Steward <43047562+scala-steward@users.noreply.github.com>
Co-authored-by: Kevin Mooney <moonkev@users.noreply.github.com>
Co-authored-by: Johannes Eriksson <johannes@stepzen.com>
Co-authored-by: Paul Daniels <paulpdaniels@gmail.com>
Co-authored-by: Mark Rudolph <mark@k8ty.app>
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

Successfully merging this pull request may close these issues.

None yet

3 participants