Unchase.OpenAPI.Connectedservice icon indicating copy to clipboard operation
Unchase.OpenAPI.Connectedservice copied to clipboard

The generator returns an error if the endpoint has more than one valid status

Open Lucjan540 opened this issue 3 years ago • 1 comments

swagger.zip

if (status_ == 201)
{
    var objectResponse_ = await ReadObjectResponseAsync<ProductsCreateResponse>(response_, headers_, cancellationToken).ConfigureAwait(false);
    if (objectResponse_.Object == null)
    {
        throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
    }
//the line below is invalid
    throw new ApiException<ProductsCreateResponse>("Create products correctly", status_, objectResponse_.Text, headers_, objectResponse_.Object, null);
}
else
if (status_ == 200)
{
    var objectResponse_ = await ReadObjectResponseAsync<ProductsNotCreateResponse>(response_, headers_, cancellationToken).ConfigureAwait(false);
    if (objectResponse_.Object == null)
    {
        throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
    }
    return objectResponse_.Object;
}

Lucjan540 avatar Jul 12 '22 07:07 Lucjan540

Hi, @Lucjan540 The Connected Service based on NSwag.

Should create the same issue in this place.

unchase avatar Jul 22 '22 11:07 unchase