AEB-labs/graphql-weaver

Misbehavior for scalar type , maybe an edge case ?

Closed this issue · 5 comments

Is the parse function meant to filter null or undefined value ? If that's the case, when the value is number 0, the returned value will be false.

function parseValue(value: any) {
return value || false;
}

And also maybe we need to deal with empty string too since empty string also is false.

Yogu commented

You're right, it seems like we forgot those cases there. I'll try to look into it in the next few days. Of course, you're also welcome to submit a PR with a failing test or a fix.

Is it okay change to this ?

function parseValue(value: any) {
    return value;
}
Yogu commented

@henkesn Do you remember why you added the || false? In any case, we should add some regression tests.

Yogu commented

@gengjiawen Thanks again for the bug report. We just released 0.11.4, please let us know if this does not fix your problem.