decapi icon indicating copy to clipboard operation
decapi copied to clipboard

defaultValue missing from @Arg()

Open tzarger opened this issue 5 years ago • 2 comments

In your documentation of Arg https://decapi.netlify.com/docs-docs-explore-arg it shows having a defaultValue such as @Arg({ nullable: true, defaultValue: 2 }) exponent: number. Yet the API and the TS Types don't include defaultValue as a valid known property.

tzarger avatar Mar 23 '20 21:03 tzarger

nicely spotted. I think I removed it because this feature is not really needed-you should be able to use default parameters as they work in JS/TS. Making it look like: @Arg({ nullable: true}) exponent = 2

but I will definitely check if this works as expected. Maybe add a spec for this too.

capaj avatar Apr 03 '20 09:04 capaj

@capaj Thanks for your response. I tried that, but when you do that the schema thinks it is not nullable since the variable is not nullable.

Overall, { isNullable: true} is broken complete in both @Arg() and @ArgNullable()

tzarger avatar Apr 03 '20 22:04 tzarger