Open italojs opened 3 years ago
I can work on this issue!!! Jose Eduardo will help me on this PR. :-)
We've been working on this issue, but we noticed it is a little more complicated than what is described here… Now we`re gonna work on more unit testing. Maybe this PR should be worth some extra points 😃😃😃
@sanderiw are you still working on this issue?
Problem
I'm trying to use
usecase2mutation
with an usecase that don't needs a response, but theusecase2mutation
requires itmy usecase:
when I transform it using
usecase2mutation(usecase, defaultResolver(usecase)
I got this error:it says that my usecase needs an response type,I tried use null but I got the same error.
Solution
I believe we can create an
scalar Void
type by default into the default schema, so we can use it when a usecase return nothing.Inside useCaseValidator we can remove the line 16
const responseValidation = validate(useCase.responseSchema, defaultValidator)
. So when we get a usecase without response type into usecaseResponse2gql we can returnVoid
the final result will be somethinkg like
here we have an clear explanation about the solution https://stackoverflow.com/a/61714123