mercurius-js / validation

Adds configurable validation support to Mercurius.
MIT License
29 stars 6 forks source link

feat: support nullable input type arguments #31

Closed simoneb closed 2 years ago

simoneb commented 2 years ago

Closes #30

Note that this is the fastest solution to the issue I came up with but I'm not 100% sure that this covers all scenarios or that it doesn't break anything.

The change is minimal but has cascading consequences on many assertions in tests because most types and fields are nullable, therefore will see their json-schema type change from 'whatever' to ['whatever', 'null'].

The scenario raised by the OP is covered and works fine.

mcollina commented 2 years ago

@jonnydgreen wdyt? what semversiness this should be?

I'm tempted for a patch and a backport to previous lines too, but it's also a big change.

jonnydgreen commented 2 years ago

I'm tempted for a patch and a backport to previous lines too, but it's also a big change.

Yeah, I agree with the patch and backport approach - especially as it's fixing spec compliance. Thinking the following?

mcollina commented 2 years ago

That's the idea.

jonnydgreen commented 2 years ago

Apologies, I missed this message as I was afk all weekend with the intention of doing this first thing Monday - thank you for releasing these fixes earlier! :)

mcollina commented 2 years ago

no worries, we needed these out asap

paolochiodi commented 2 years ago

Just tested this in my code and works as expected. Thanks @simoneb and rest of the team.