swaggest / rest

Web services with OpenAPI and JSON Schema done quick in Go
https://pkg.go.dev/github.com/swaggest/rest
MIT License
335 stars 17 forks source link

Implement support for multiple HTTP success statuses #155

Closed haimgel closed 1 year ago

haimgel commented 1 year ago

When OutputWithHTTPStatus is implemented on the output port, HTTPStatus() defines the successful HTTP status of a given operation, and ExpectedHTTPStatuses() defines all expected HTTP statuses for API documentation purposes.

See #153 for the discussion about this feature.

haimgel commented 1 year ago

@vearutop, any feedback is very welcome! In particular, I wasn't quite sure about the naming of this new interface and its methods, and which package exactly it should be.

codecov[bot] commented 1 year ago

Codecov Report

Merging #155 (794fde0) into master (0e69b49) will decrease coverage by 0.02%. The diff coverage is 56.25%.

@@            Coverage Diff             @@
##           master     #155      +/-   ##
==========================================
- Coverage   77.68%   77.67%   -0.02%     
==========================================
  Files          28       28              
  Lines        1600     1608       +8     
==========================================
+ Hits         1243     1249       +6     
- Misses        235      236       +1     
- Partials      122      123       +1     
Flag Coverage Δ
unittests 77.67% <56.25%> (-0.02%) :arrow_down:

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
response/encoder.go 66.94% <50.00%> (+0.42%) :arrow_up:
openapi/collector.go 64.13% <60.00%> (-0.08%) :arrow_down:

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more

vearutop commented 1 year ago

Thank you, looks good! 👍