Hi Guys,
I'm getting a parsing problem when retrieving a collection of objects /objects, it's supposed to be a simple get request but looks like the open API runtime is trying to parse the data against the structs were generated by the specs which is a cool thing, however the error does not show any useful information and I tried to dig inside and found out that the problem is related to the readResponse method inside the file list_objects_responses.go the code causing the issue is below:
// response payload
if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
return err
}
Most probably the problem is due to different response from the server side, it's like the server is returning null for a key while it should be an empty string ''
Can you shed some lights on how this can be debugged?
You should not have a body with a GET method.
@fredbi Where did you see a body?
If you are talking about response.Body() param to the Consume then that's clear from it's name.
Anyhow, I have resolved the issue by adding x-nullable to all fields.
I'm not sure if this is already available, but there should be an option to disable the automatic response body decoding/unmarshalling to allow for handling cases in which they are not mentioned in the specs, such as API errors, etc.
I am just guessing since you are not providing much context. Difficult to provide useful advice with such scarce information. Glad you did solve you issue anyway.
I had got the same error. And I found the breakpoint is json null value should match pointer type. It might help you.
Most helpful comment
I had got the same error. And I found the breakpoint is json null value should match pointer type. It might help you.