dankinsoid / VaporToOpenAPI

OpenAPI specification generator for Vapor based Swift projects.
MIT License
98 stars 8 forks source link

[Feature Request] Able to define different responses for errors #10

Closed skela closed 1 year ago

skela commented 1 year ago

Used to be able to define errorResponses in previous versions of this library - Seem to now be deprecated, with no obvious replacements in place.

Is there anyway to define different error responses based on status code or some other way to achieve something similar? If not, consider this a feature request ❤️

dankinsoid commented 1 year ago

@skela you can use method .response(statusCode: .badRequest, body: .type(of: example)) on a route or routes. groupedOpenAPIResponse(statusCode: .badRequest, body: .type(of: example)) on a route builder.

skela commented 1 year ago

ugh, sorry, i did not realise u could chain it with .response :'(

thx!