This is how my swagger looks like
paths:
'/Products/{id}':
get:
tags:
- Products
operationId: getProductById
parameters:
- name: id
in: path
required: true
schema:
type: string
responses:
'200':
description: Success
content:
application/json:
schema:
$ref: '#/components/schemas/ProductResponseDto'
'404':
description: Entity not found
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorDto'
The generated interface looks like
/// Success
System.Threading.Tasks.Task GetProductByIdAsync(string id);
and it does not allow to return the ErrorDto in case of error.
I know it is possible to throw an exception and add a middleware to handle it, but I want to find a solution that does not involve throwing exceptions.
This is how the target is defined in the csproj
0 comments:
Post a Comment
Thanks