The new version 1.x is no longer dealing with different success responses.
I had one response type corresponding to 202 and one to 200, however after migrating to openapi 1.x it fails when the type of the 202 is returned.
It searches for a success response, and finds the wrong one for 200, and then fails with a schema validation failed response, which makes sense as it compared the wrong schemas.
How is one supposed to return the different return types if not directly via return? is there a way to give the status 202 together with the return type?
Similarly, I also have the case where I would like to return a ClientError response in the 400 realm. When I look at the code in _server_response, also this probably will fail, looking for a 200 schema without actually checking the type, which clearly corresponds to 400 type.
EDIT: A suggestion
instead of the _success_response function, I expected rather something like the following:
function _response_by_type(responses, result)
# first try to find type
for response in responses
for media in response.media
if media.type == typeof(result)
return response
end
end
end
# fall back to default selector
for response in responses
selector = uppercase(response.selector)
if selector == "DEFAULT"
return response
end
end
# fall back to nothing
return nothing
end
The new version 1.x is no longer dealing with different success responses.
I had one response type corresponding to 202 and one to 200, however after migrating to openapi 1.x it fails when the type of the 202 is returned.
It searches for a success response, and finds the wrong one for 200, and then fails with a schema validation failed response, which makes sense as it compared the wrong schemas.
How is one supposed to return the different return types if not directly via return? is there a way to give the status 202 together with the return type?
Similarly, I also have the case where I would like to return a ClientError response in the 400 realm. When I look at the code in
_server_response, also this probably will fail, looking for a 200 schema without actually checking the type, which clearly corresponds to 400 type.EDIT: A suggestion
instead of the _success_response function, I expected rather something like the following: