integreat-io / integreat

Node.js integration layer
Other
13 stars 3 forks source link

Default value "" in schema will cast to undefined #267

Open GoodGuyGoose opened 10 months ago

GoodGuyGoose commented 10 months ago

When setting a property's value to an empty string in a schema, the schema will cast the value to undefined rather than retain the empty string. E.g:

"composition": {"\\$type": "string", "default": ""} // will return undefined

kjellmorten commented 8 months ago

I tried to replicate this, @GoodGuyGoose, but was not able to find the cause for it within the Integreat package. Here's the tests I wrote to verify: https://github.com/integreat-io/integreat/commit/a51dce10b05d91f0ba043e0e7a81d19e43e3c510

Perhaps this is something that happens in the integreat-server package or due to some other gotcha in the mutations.