mercurius-js / validation

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

fix: allow nullable input objects and arrays #67

Closed peterc1731 closed 1 month ago

peterc1731 commented 1 year ago

Fixes https://github.com/mercurius-js/validation/issues/57

When inferring types from the schema, the library does not consider nullability for objects or arrays. The test that validates nullable input types ("should support nullable input type arguments") was only validating string type inputs, when adding validation for a few more input types as I've done in this PR, that test fails.

I've applied a fix for the issue as well as updating the tests, I'm not sure if the approach is the best one, but it works and its a simple change with low impact on the rest of the behaviour.

jonnydgreen commented 1 year ago

Thanks for submitting - I'll take a look tonight :)

bglgwyng commented 1 year ago

@peterc1731 Thanks for addressing this fix! I've seen the significance of this issue, and I've found that this solution works accurately. Is there any reason to hold back from merging this pull request?

mcollina commented 1 year ago

@peterc1731 are you still interested in addressing @jonnydgreen comment? @bglgwyng maybe would you like to take over?

peterc1731 commented 1 year ago

@peterc1731 are you still interested in addressing @jonnydgreen comment?

Apologies, completely forgot to get back to this one! I will take a look today.

jonnydgreen commented 1 month ago

@mcollina thinking a semver patch release for this one?

mcollina commented 1 month ago

yes