swaggest / rest

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

Return wrappers support in Use and With (filtered) to fix sub-routers #97

Closed vearutop closed 1 year ago

vearutop commented 1 year ago

Fixes #96.

Separation of Wrap and Use/With introduced in #76 led to an opposite limitation: wrappers that are configured in sub-routers have no effect as they are passed to the original chi router that does not know how to deal with them.

This PR implements a hacky compromise, that some middlewares in Use/With can be considered handler wrappers, but for that they need to exhibit particular indicative behavior.

Then wrappers would go to wrappers (not going to chi), and middlewares would go to chi (not going to wrappers).

github-actions[bot] commented 1 year ago

Lines Of Code

Language Files Lines Code Comments Blanks Complexity Bytes
Go 104 (+3) 7178 (+174) 5208 (+122) 482 (+16) 1488 (+36) 866 (+19) 173.5K (+4.1K)
Go (test) 47 (+1) 4981 (+122) 3809 (+67) 182 (+32) 990 (+23) 178 (+4) 138.2K (+3.1K)
JSON 3 1440 (+98) 1440 (+98) 0 0 0 58.7K (+3.4K)
github-actions[bot] commented 1 year ago

Go API Changes

# github.com/swaggest/rest/nethttp
## compatible changes
IsWrapperChecker: added
MiddlewareIsWrapper: added

# summary
Inferred base version: v0.2.33
Suggested version: v0.3.0
github-actions[bot] commented 1 year ago

Unit Test Coverage

total: (statements) 83.9% changed lines: (statements) 100.0%

Coverage of changed lines | File | Function | Coverage | |---------------------------|----------------------------|----------| | Total | | 100.0% | | chirouter/wrapper.go | | 100.0% | | chirouter/wrapper.go:55 | Use | 100.0% | | chirouter/wrapper.go:71 | With | 100.0% | | nethttp/handler.go | | 100.0% | | nethttp/handler.go:230 | HandlerWithRouteMiddleware | 100.0% | | nethttp/openapi.go | | 100.0% | | nethttp/openapi.go:12 | OpenAPIMiddleware | 100.0% | | nethttp/openapi.go:108 | AnnotateOpenAPI | 100.0% | | nethttp/usecase.go | | 100.0% | | nethttp/usecase.go:11 | UseCaseMiddlewares | 100.0% | | nethttp/wrapper.go | | 100.0% | | nethttp/wrapper.go:15 | IsWrapperChecker | 100.0% | | nethttp/wrapper.go:27 | MiddlewareIsWrapper | 100.0% | | request/middleware.go | | 100.0% | | request/middleware.go:20 | DecoderMiddleware | 100.0% | | request/middleware.go:62 | ValidatorMiddleware | 100.0% | | response/middleware.go | | 100.0% | | response/middleware.go:16 | EncoderMiddleware | 100.0% | | response/validator.go | | 100.0% | | response/validator.go:16 | ValidatorMiddleware | 100.0% |
Coverage diff with base branch | File | Function | Base Coverage | Current Coverage | |-------------------------------------------------|---------------------|---------------|------------------| | Total | | 83.5% | 83.9% (+0.4%) | | github.com/swaggest/rest/nethttp/openapi.go | OpenAPIMiddleware | 75.0% | 80.0% (+5.0%) | | github.com/swaggest/rest/nethttp/usecase.go | UseCaseMiddlewares | 90.9% | 92.3% (+1.4%) | | github.com/swaggest/rest/nethttp/wrapper.go | IsWrapperChecker | no function | 100.0% | | github.com/swaggest/rest/nethttp/wrapper.go | MiddlewareIsWrapper | no function | 100.0% | | github.com/swaggest/rest/nethttp/wrapper.go | ServeHTTP | no function | 0.0% | | github.com/swaggest/rest/request/middleware.go | DecoderMiddleware | 90.9% | 92.3% (+1.4%) | | github.com/swaggest/rest/request/middleware.go | ValidatorMiddleware | 85.7% | 88.9% (+3.2%) | | github.com/swaggest/rest/response/middleware.go | EncoderMiddleware | 87.5% | 90.0% (+2.5%) | | github.com/swaggest/rest/response/validator.go | ValidatorMiddleware | 83.3% | 85.7% (+2.4%) |
codecov[bot] commented 1 year ago

Codecov Report

Merging #97 (27e995d) into master (18cad16) will increase coverage by 0.45%. The diff coverage is 97.36%.

@@            Coverage Diff             @@
##           master      #97      +/-   ##
==========================================
+ Coverage   77.57%   78.02%   +0.45%     
==========================================
  Files          27       28       +1     
  Lines        1436     1470      +34     
==========================================
+ Hits         1114     1147      +33     
- Misses        207      208       +1     
  Partials      115      115              
Flag Coverage Δ
unittests 78.02% <97.36%> (+0.45%) :arrow_up:

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

Impacted Files Coverage Δ
nethttp/wrapper.go 87.50% <87.50%> (ø)
chirouter/wrapper.go 100.00% <100.00%> (ø)
nethttp/handler.go 85.22% <100.00%> (+0.34%) :arrow_up:
nethttp/openapi.go 94.20% <100.00%> (+0.35%) :arrow_up:
nethttp/usecase.go 84.61% <100.00%> (+2.79%) :arrow_up:
request/middleware.go 88.37% <100.00%> (+1.19%) :arrow_up:
response/middleware.go 87.50% <100.00%> (+1.78%) :arrow_up:
response/validator.go 81.81% <100.00%> (+1.81%) :arrow_up:

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

github-actions[bot] commented 1 year ago

Benchmark Result

Benchmark diff with base branch ``` name old time/op new time/op delta pkg:github.com/swaggest/rest/jsonschema goos:linux goarch:amd64 RequestValidator_ValidateRequestData-2 1.90µs ±27% 1.90µs ± 7% ~ (p=0.222 n=5+5) pkg:github.com/swaggest/rest/request goos:linux goarch:amd64 Decoder_Decode-2 982ns ± 7% 1027ns ± 3% ~ (p=0.095 n=5+5) DecoderFunc_Decode-2 2.76µs ± 5% 2.71µs ± 3% ~ (p=0.738 n=5+5) Decoder_Decode_json-2 31.1µs ± 3% 31.0µs ± 7% ~ (p=1.000 n=5+5) Decoder_Decode_queryObject-2 6.06µs ± 1% 6.18µs ± 7% ~ (p=0.690 n=5+5) Decoder_Decode_jsonParam-2 2.32µs ± 7% 2.39µs ± 3% ~ (p=0.548 n=5+5) DecoderFactory_SetDecoderFunc-2 2.13µs ± 4% 2.19µs ± 2% ~ (p=0.151 n=5+5) pkg:github.com/swaggest/rest/response/gzip goos:linux goarch:amd64 Middleware-2 13.5µs ± 1% 14.1µs ± 4% ~ (p=0.095 n=5+5) Middleware_control-2 4.55µs ± 5% 5.47µs ±10% +20.15% (p=0.008 n=5+5) name old alloc/op new alloc/op delta pkg:github.com/swaggest/rest/jsonschema goos:linux goarch:amd64 RequestValidator_ValidateRequestData-2 2.46kB ± 0% 2.46kB ± 0% ~ (all equal) pkg:github.com/swaggest/rest/request goos:linux goarch:amd64 Decoder_Decode-2 440B ± 0% 440B ± 0% ~ (all equal) DecoderFunc_Decode-2 1.51kB ± 0% 1.51kB ± 0% ~ (all equal) Decoder_Decode_json-2 12.2kB ± 0% 12.2kB ± 0% ~ (all equal) Decoder_Decode_queryObject-2 2.00kB ± 0% 2.00kB ± 0% ~ (all equal) Decoder_Decode_jsonParam-2 736B ± 0% 736B ± 0% ~ (all equal) DecoderFactory_SetDecoderFunc-2 1.02kB ± 0% 1.02kB ± 0% ~ (all equal) pkg:github.com/swaggest/rest/response/gzip goos:linux goarch:amd64 Middleware-2 1.18kB ± 6% 1.16kB ± 3% ~ (p=0.540 n=5+5) Middleware_control-2 11.2kB ± 0% 11.2kB ± 0% ~ (all equal) name old allocs/op new allocs/op delta pkg:github.com/swaggest/rest/jsonschema goos:linux goarch:amd64 RequestValidator_ValidateRequestData-2 8.00 ± 0% 8.00 ± 0% ~ (all equal) pkg:github.com/swaggest/rest/request goos:linux goarch:amd64 Decoder_Decode-2 4.00 ± 0% 4.00 ± 0% ~ (all equal) DecoderFunc_Decode-2 12.0 ± 0% 12.0 ± 0% ~ (all equal) Decoder_Decode_json-2 177 ± 0% 177 ± 0% ~ (all equal) Decoder_Decode_queryObject-2 36.0 ± 0% 36.0 ± 0% ~ (all equal) Decoder_Decode_jsonParam-2 13.0 ± 0% 13.0 ± 0% ~ (all equal) DecoderFactory_SetDecoderFunc-2 16.0 ± 0% 16.0 ± 0% ~ (all equal) pkg:github.com/swaggest/rest/response/gzip goos:linux goarch:amd64 Middleware-2 11.0 ± 0% 11.0 ± 0% ~ (all equal) Middleware_control-2 9.00 ± 0% 9.00 ± 0% ~ (all equal) ```
Benchmark result ``` name time/op pkg:github.com/swaggest/rest/jsonschema goos:linux goarch:amd64 RequestValidator_ValidateRequestData-2 1.90µs ± 7% pkg:github.com/swaggest/rest/request goos:linux goarch:amd64 Decoder_Decode-2 1.03µs ± 3% DecoderFunc_Decode-2 2.71µs ± 3% Decoder_Decode_json-2 31.0µs ± 7% Decoder_Decode_queryObject-2 6.18µs ± 7% Decoder_Decode_jsonParam-2 2.39µs ± 3% DecoderFactory_SetDecoderFunc-2 2.19µs ± 2% pkg:github.com/swaggest/rest/response/gzip goos:linux goarch:amd64 Middleware-2 14.1µs ± 4% Middleware_control-2 5.47µs ±10% name alloc/op pkg:github.com/swaggest/rest/jsonschema goos:linux goarch:amd64 RequestValidator_ValidateRequestData-2 2.46kB ± 0% pkg:github.com/swaggest/rest/request goos:linux goarch:amd64 Decoder_Decode-2 440B ± 0% DecoderFunc_Decode-2 1.51kB ± 0% Decoder_Decode_json-2 12.2kB ± 0% Decoder_Decode_queryObject-2 2.00kB ± 0% Decoder_Decode_jsonParam-2 736B ± 0% DecoderFactory_SetDecoderFunc-2 1.02kB ± 0% pkg:github.com/swaggest/rest/response/gzip goos:linux goarch:amd64 Middleware-2 1.16kB ± 3% Middleware_control-2 11.2kB ± 0% name allocs/op pkg:github.com/swaggest/rest/jsonschema goos:linux goarch:amd64 RequestValidator_ValidateRequestData-2 8.00 ± 0% pkg:github.com/swaggest/rest/request goos:linux goarch:amd64 Decoder_Decode-2 4.00 ± 0% DecoderFunc_Decode-2 12.0 ± 0% Decoder_Decode_json-2 177 ± 0% Decoder_Decode_queryObject-2 36.0 ± 0% Decoder_Decode_jsonParam-2 13.0 ± 0% DecoderFactory_SetDecoderFunc-2 16.0 ± 0% pkg:github.com/swaggest/rest/response/gzip goos:linux goarch:amd64 Middleware-2 11.0 ± 0% Middleware_control-2 9.00 ± 0% ```
github-actions[bot] commented 1 year ago

Examples Benchmark Result

Benchmark diff with base branch ``` name old time/op new time/op delta pkg:github.com/swaggest/rest/_examples/advanced goos:linux goarch:amd64 _directGzip-2 38.2µs ±13% 38.9µs ±18% ~ (p=0.690 n=5+5) _directGzipHead-2 36.0µs ± 3% 39.2µs ± 9% +9.00% (p=0.008 n=5+5) _noDirectGzip-2 169µs ± 5% 170µs ± 1% ~ (p=0.556 n=5+4) _directGzip_decode-2 576µs ± 8% 579µs ± 4% ~ (p=1.000 n=5+5) _noDirectGzip_decode-2 174µs ± 3% 169µs ± 2% -3.20% (p=0.032 n=5+5) _jsonBody-2 67.0µs ± 7% 68.2µs ± 3% ~ (p=0.310 n=5+5) _jsonBodyValidation-2 77.8µs ± 3% 75.9µs ± 1% ~ (p=0.056 n=5+5) _outputHeaders-2 37.7µs ± 2% 35.7µs ± 2% -5.47% (p=0.008 n=5+5) _requestResponseMapping-2 67.2µs ± 7% 65.5µs ± 6% ~ (p=0.310 n=5+5) _validation-2 73.3µs ± 3% 69.7µs ± 2% -4.95% (p=0.008 n=5+5) _noValidation-2 56.5µs ± 4% 53.7µs ± 1% -5.05% (p=0.008 n=5+5) pkg:github.com/swaggest/rest/_examples/advanced-generic goos:linux goarch:amd64 _directGzip-2 39.6µs ± 5% 39.7µs ±17% ~ (p=0.222 n=5+5) _directGzipHead-2 38.8µs ± 2% 37.9µs ± 1% -2.40% (p=0.032 n=5+5) _noDirectGzip-2 178µs ± 2% 172µs ± 4% -3.47% (p=0.032 n=5+5) _directGzip_decode-2 607µs ± 2% 577µs ± 2% -4.93% (p=0.008 n=5+5) _noDirectGzip_decode-2 180µs ± 2% 172µs ± 2% -4.39% (p=0.016 n=4+5) _htmlResponse-2 59.7µs ± 3% 57.5µs ± 3% -3.77% (p=0.032 n=5+5) _jsonBodyManual-2 45.6µs ± 4% 43.6µs ± 2% -4.27% (p=0.016 n=5+5) _jsonBody-2 63.1µs ± 2% 61.5µs ± 4% ~ (p=0.310 n=5+5) _jsonBodyValidation-2 76.3µs ± 1% 73.6µs ± 3% -3.53% (p=0.016 n=5+5) _outputHeaders-2 38.2µs ± 1% 36.3µs ± 6% ~ (p=0.095 n=5+5) _requestResponseMapping-2 67.7µs ± 8% 62.8µs ± 2% -7.13% (p=0.016 n=5+5) _validation-2 68.3µs ± 2% 68.2µs ± 2% ~ (p=0.690 n=5+5) _noValidation-2 51.3µs ± 2% 52.3µs ± 2% ~ (p=0.095 n=5+5) pkg:github.com/swaggest/rest/_examples/task-api/internal/infra/nethttp goos:linux goarch:amd64 _notFoundSrv-2 43.4µs ±15% 44.0µs ±14% ~ (p=0.548 n=5+5) _ok-2 42.7µs ± 2% 42.8µs ± 3% ~ (p=1.000 n=5+5) _invalidBody-2 59.9µs ± 4% 60.8µs ± 3% ~ (p=0.310 n=5+5) name old 50%:ms new 50%:ms delta pkg:github.com/swaggest/rest/_examples/advanced goos:linux goarch:amd64 _directGzip-2 1.80 ± 3% 1.87 ± 7% ~ (p=0.690 n=5+5) _directGzipHead-2 1.73 ± 6% 1.81 ± 6% ~ (p=0.095 n=5+5) _noDirectGzip-2 7.93 ± 2% 8.11 ± 7% ~ (p=0.548 n=5+5) _directGzip_decode-2 23.3 ± 4% 22.6 ± 8% ~ (p=0.548 n=5+5) _noDirectGzip_decode-2 8.14 ± 3% 7.98 ± 6% ~ (p=0.548 n=5+5) _jsonBody-2 3.13 ± 7% 3.20 ± 6% ~ (p=0.548 n=5+5) _jsonBodyValidation-2 3.53 ± 6% 3.51 ± 2% ~ (p=0.524 n=5+5) _outputHeaders-2 1.76 ± 3% 1.70 ± 3% ~ (p=0.056 n=5+5) _requestResponseMapping-2 3.07 ± 7% 2.95 ± 4% ~ (p=0.310 n=5+5) _validation-2 3.41 ± 5% 3.21 ± 5% ~ (p=0.056 n=5+5) _noValidation-2 2.66 ± 4% 2.50 ± 5% ~ (p=0.095 n=5+5) pkg:github.com/swaggest/rest/_examples/advanced-generic goos:linux goarch:amd64 _directGzip-2 1.91 ± 5% 1.95 ± 8% ~ (p=0.690 n=5+5) _directGzipHead-2 1.84 ± 4% 1.79 ± 4% ~ (p=0.095 n=5+5) _noDirectGzip-2 8.36 ± 2% 8.09 ± 8% ~ (p=0.310 n=5+5) _directGzip_decode-2 23.6 ± 6% 23.0 ±11% ~ (p=0.421 n=5+5) _noDirectGzip_decode-2 8.11 ± 3% 8.16 ± 1% ~ (p=0.730 n=4+5) _htmlResponse-2 2.80 ± 5% 2.67 ± 5% ~ (p=0.056 n=5+5) _jsonBodyManual-2 2.11 ± 4% 2.11 ± 5% ~ (p=0.841 n=5+5) _jsonBody-2 2.89 ± 2% 2.81 ± 5% ~ (p=0.151 n=5+5) _jsonBodyValidation-2 3.44 ± 3% 3.33 ± 5% ~ (p=0.421 n=5+5) _outputHeaders-2 1.85 ± 5% 1.71 ± 9% ~ (p=0.056 n=5+5) _requestResponseMapping-2 3.05 ± 5% 2.92 ± 5% ~ (p=0.151 n=5+5) _validation-2 3.08 ± 3% 3.13 ± 4% ~ (p=0.310 n=5+5) _noValidation-2 2.41 ± 3% 2.39 ± 5% ~ (p=0.841 n=5+5) pkg:github.com/swaggest/rest/_examples/task-api/internal/infra/nethttp goos:linux goarch:amd64 _notFoundSrv-2 2.02 ± 6% 2.09 ± 6% ~ (p=0.310 n=5+5) _ok-2 2.06 ± 5% 2.08 ± 7% ~ (p=1.000 n=5+5) _invalidBody-2 2.88 ± 7% 2.81 ± 5% ~ (p=0.310 n=5+5) name old 90%:ms new 90%:ms delta pkg:github.com/swaggest/rest/_examples/advanced goos:linux goarch:amd64 _directGzip-2 3.13 ± 3% 3.18 ±13% ~ (p=0.548 n=5+5) _directGzipHead-2 3.13 ± 4% 3.26 ± 6% ~ (p=0.151 n=5+5) _noDirectGzip-2 14.7 ±10% 15.7 ± 7% ~ (p=0.095 n=5+5) _directGzip_decode-2 48.7 ±11% 47.3 ± 7% ~ (p=0.421 n=5+5) _noDirectGzip_decode-2 15.8 ± 7% 15.3 ± 5% ~ (p=0.421 n=5+5) _jsonBody-2 5.91 ± 3% 6.04 ± 7% ~ (p=0.310 n=5+5) _jsonBodyValidation-2 6.81 ± 6% 6.66 ± 2% ~ (p=0.548 n=5+5) _outputHeaders-2 3.16 ± 8% 2.97 ± 7% ~ (p=0.095 n=5+5) _requestResponseMapping-2 6.01 ± 8% 5.72 ± 4% ~ (p=0.222 n=5+5) _validation-2 6.46 ± 4% 6.01 ± 2% -6.99% (p=0.008 n=5+5) _noValidation-2 4.81 ± 6% 4.66 ± 5% ~ (p=0.389 n=5+5) pkg:github.com/swaggest/rest/_examples/advanced-generic goos:linux goarch:amd64 _directGzip-2 3.30 ± 7% 3.29 ±11% ~ (p=0.841 n=5+5) _directGzipHead-2 3.17 ± 6% 3.20 ± 6% ~ (p=0.841 n=5+5) _noDirectGzip-2 16.5 ± 4% 15.6 ±11% ~ (p=0.151 n=5+5) _directGzip_decode-2 50.8 ± 4% 49.3 ± 5% ~ (p=0.389 n=5+5) _noDirectGzip_decode-2 19.5 ±52% 15.4 ± 5% -21.26% (p=0.008 n=5+5) _htmlResponse-2 5.34 ± 3% 5.02 ± 3% -6.05% (p=0.016 n=5+5) _jsonBodyManual-2 3.93 ± 6% 3.67 ± 3% ~ (p=0.056 n=5+5) _jsonBody-2 5.49 ± 3% 5.52 ± 5% ~ (p=1.000 n=5+5) _jsonBodyValidation-2 6.76 ± 1% 6.68 ± 7% ~ (p=0.690 n=5+5) _outputHeaders-2 3.20 ± 6% 3.05 ± 4% ~ (p=0.151 n=5+5) _requestResponseMapping-2 6.22 ±13% 5.52 ± 4% -11.33% (p=0.008 n=5+5) _validation-2 6.04 ± 5% 6.17 ± 0% ~ (p=0.548 n=5+5) _noValidation-2 4.39 ± 2% 4.51 ± 6% ~ (p=0.421 n=5+5) pkg:github.com/swaggest/rest/_examples/task-api/internal/infra/nethttp goos:linux goarch:amd64 _notFoundSrv-2 3.66 ± 8% 3.76 ±18% ~ (p=1.000 n=5+5) _ok-2 3.58 ± 5% 3.68 ±10% ~ (p=0.690 n=5+5) _invalidBody-2 5.29 ± 7% 5.26 ± 5% ~ (p=0.841 n=5+5) name old 99%:ms new 99%:ms delta pkg:github.com/swaggest/rest/_examples/advanced goos:linux goarch:amd64 _directGzip-2 5.19 ± 7% 4.96 ± 9% ~ (p=0.486 n=4+4) _directGzipHead-2 4.86 ±10% 7.20 ±59% +48.24% (p=0.016 n=5+5) _noDirectGzip-2 21.6 ± 7% 22.0 ±11% ~ (p=0.841 n=5+5) _directGzip_decode-2 81.9 ±15% 79.9 ±11% ~ (p=0.548 n=5+5) _noDirectGzip_decode-2 22.7 ± 7% 21.9 ± 3% ~ (p=0.151 n=5+5) _jsonBody-2 8.84 ± 1% 9.27 ± 8% ~ (p=0.286 n=4+5) _jsonBodyValidation-2 11.2 ±15% 11.2 ±12% ~ (p=1.000 n=5+5) _outputHeaders-2 5.89 ± 5% 5.11 ±11% -13.24% (p=0.016 n=5+5) _requestResponseMapping-2 9.54 ±17% 10.46 ±35% ~ (p=0.690 n=5+5) _validation-2 10.9 ±11% 9.8 ± 9% ~ (p=0.095 n=5+5) _noValidation-2 8.65 ± 6% 7.79 ± 7% -9.86% (p=0.032 n=5+5) pkg:github.com/swaggest/rest/_examples/advanced-generic goos:linux goarch:amd64 _directGzip-2 5.60 ±12% 5.09 ± 4% -9.14% (p=0.032 n=5+4) _directGzipHead-2 5.56 ±11% 5.31 ± 6% ~ (p=0.421 n=5+5) _noDirectGzip-2 22.6 ± 3% 21.8 ± 4% ~ (p=0.095 n=5+5) _directGzip_decode-2 83.5 ±14% 75.8 ±13% ~ (p=0.206 n=5+5) _noDirectGzip_decode-2 22.7 ± 4% 21.9 ± 4% ~ (p=0.063 n=4+5) _htmlResponse-2 8.61 ± 9% 8.29 ±10% ~ (p=0.421 n=5+5) _jsonBodyManual-2 6.58 ± 9% 6.13 ± 8% ~ (p=0.151 n=5+5) _jsonBody-2 9.19 ± 7% 9.28 ± 8% ~ (p=0.841 n=5+5) _jsonBodyValidation-2 10.3 ± 7% 10.5 ±10% ~ (p=0.802 n=5+5) _outputHeaders-2 5.77 ± 7% 5.75 ±15% ~ (p=1.000 n=5+5) _requestResponseMapping-2 9.93 ±21% 8.73 ± 1% -12.11% (p=0.016 n=5+4) _validation-2 10.2 ±18% 9.8 ± 6% ~ (p=1.000 n=5+5) _noValidation-2 8.13 ±11% 8.29 ± 7% ~ (p=0.690 n=5+5) pkg:github.com/swaggest/rest/_examples/task-api/internal/infra/nethttp goos:linux goarch:amd64 _notFoundSrv-2 5.56 ± 2% 5.48 ± 3% ~ (p=0.486 n=4+4) _ok-2 5.71 ± 2% 5.65 ± 8% ~ (p=0.690 n=5+5) _invalidBody-2 8.95 ± 6% 9.24 ± 7% ~ (p=0.222 n=5+5) name old 99.9%:ms new 99.9%:ms delta pkg:github.com/swaggest/rest/_examples/advanced goos:linux goarch:amd64 _directGzip-2 11.0 ±74% 12.2 ±125% ~ (p=0.548 n=5+5) _directGzipHead-2 8.09 ±23% 12.08 ±52% +49.42% (p=0.016 n=5+5) _noDirectGzip-2 25.7 ±12% 26.3 ±16% ~ (p=0.690 n=5+5) _directGzip_decode-2 107 ±20% 104 ±17% ~ (p=1.000 n=5+5) _noDirectGzip_decode-2 26.1 ± 8% 27.2 ±24% ~ (p=0.841 n=5+5) _jsonBody-2 13.8 ±33% 13.1 ±19% ~ (p=1.000 n=5+5) _jsonBodyValidation-2 16.0 ±22% 16.1 ±23% ~ (p=1.000 n=5+5) _outputHeaders-2 10.4 ±21% 9.0 ±34% ~ (p=0.238 n=5+5) _requestResponseMapping-2 15.0 ±36% 17.1 ±46% ~ (p=0.690 n=5+5) _validation-2 15.7 ±22% 13.4 ± 5% -14.87% (p=0.008 n=5+5) _noValidation-2 13.1 ±22% 11.3 ± 8% ~ (p=0.222 n=5+5) pkg:github.com/swaggest/rest/_examples/advanced-generic goos:linux goarch:amd64 _directGzip-2 10.2 ±51% 10.1 ±75% ~ (p=0.690 n=5+5) _directGzipHead-2 8.63 ±22% 8.60 ±21% ~ (p=1.000 n=5+5) _noDirectGzip-2 26.7 ±10% 28.0 ±18% ~ (p=0.690 n=5+5) _directGzip_decode-2 104 ± 9% 101 ± 9% ~ (p=0.548 n=5+5) _noDirectGzip_decode-2 34.6 ±71% 25.8 ± 9% ~ (p=0.222 n=5+5) _htmlResponse-2 11.2 ±11% 13.1 ±20% ~ (p=0.063 n=5+5) _jsonBodyManual-2 10.9 ±29% 9.9 ±42% ~ (p=0.222 n=5+5) _jsonBody-2 13.8 ±10% 14.8 ±28% ~ (p=0.841 n=5+5) _jsonBodyValidation-2 13.7 ±10% 17.8 ±42% ~ (p=0.151 n=5+5) _outputHeaders-2 9.55 ±17% 11.49 ±27% ~ (p=0.286 n=5+5) _requestResponseMapping-2 13.7 ±16% 13.4 ±22% ~ (p=0.548 n=5+5) _validation-2 14.1 ±26% 14.6 ±21% ~ (p=0.937 n=5+5) _noValidation-2 10.9 ±13% 11.9 ±29% ~ (p=0.421 n=5+5) pkg:github.com/swaggest/rest/_examples/task-api/internal/infra/nethttp goos:linux goarch:amd64 _notFoundSrv-2 10.8 ±80% 12.4 ±39% ~ (p=0.310 n=5+5) _ok-2 10.5 ±28% 9.8 ±62% ~ (p=0.421 n=5+5) _invalidBody-2 14.6 ±61% 13.3 ±14% ~ (p=0.841 n=5+5) name old B:rcvd/op new B:rcvd/op delta pkg:github.com/swaggest/rest/_examples/advanced goos:linux goarch:amd64 _directGzip-2 639 ± 0% 639 ± 0% ~ (all equal) _directGzipHead-2 183 ± 0% 183 ± 0% ~ (all equal) _noDirectGzip-2 1.04k ± 0% 1.04k ± 0% ~ (all equal) _directGzip_decode-2 639 ± 0% 639 ± 0% ~ (all equal) _noDirectGzip_decode-2 1.04k ± 0% 1.04k ± 0% ~ (all equal) _jsonBody-2 208 ± 0% 208 ± 0% ~ (all equal) _jsonBodyValidation-2 194 ± 0% 194 ± 0% ~ (all equal) _outputHeaders-2 155 ± 0% 155 ± 0% ~ (all equal) _requestResponseMapping-2 94.0 ± 0% 94.0 ± 0% ~ (all equal) _validation-2 177 ± 0% 177 ± 0% ~ (all equal) _noValidation-2 177 ± 0% 177 ± 0% ~ (all equal) pkg:github.com/swaggest/rest/_examples/advanced-generic goos:linux goarch:amd64 _directGzip-2 653 ± 0% 653 ± 0% ~ (all equal) _directGzipHead-2 197 ± 0% 197 ± 0% ~ (all equal) _noDirectGzip-2 1.06k ± 0% 1.06k ± 0% ~ (all equal) _directGzip_decode-2 653 ± 0% 653 ± 0% ~ (all equal) _noDirectGzip_decode-2 1.06k ± 0% 1.06k ± 0% ~ (all equal) _htmlResponse-2 370 ± 0% 370 ± 0% ~ (all equal) _jsonBodyManual-2 222 ± 0% 222 ± 0% ~ (all equal) _jsonBody-2 222 ± 0% 222 ± 0% ~ (all equal) _jsonBodyValidation-2 208 ± 0% 208 ± 0% ~ (all equal) _outputHeaders-2 169 ± 0% 169 ± 0% ~ (all equal) _requestResponseMapping-2 108 ± 0% 108 ± 0% ~ (all equal) _validation-2 191 ± 0% 191 ± 0% ~ (all equal) _noValidation-2 191 ± 0% 191 ± 0% ~ (all equal) pkg:github.com/swaggest/rest/_examples/task-api/internal/infra/nethttp goos:linux goarch:amd64 _notFoundSrv-2 337 ± 0% 337 ± 0% ~ (all equal) _ok-2 359 ± 0% 359 ± 0% ~ (all equal) _invalidBody-2 435 ± 0% 435 ± 0% ~ (all equal) name old B:sent/op new B:sent/op delta pkg:github.com/swaggest/rest/_examples/advanced goos:linux goarch:amd64 _directGzip-2 103 ± 0% 103 ± 0% ~ (all equal) _directGzipHead-2 104 ± 0% 104 ± 0% ~ (all equal) _noDirectGzip-2 117 ± 0% 117 ± 0% ~ (all equal) _directGzip_decode-2 116 ± 0% 116 ± 0% ~ (all equal) _noDirectGzip_decode-2 130 ± 0% 130 ± 0% ~ (all equal) _jsonBody-2 188 ± 0% 188 ± 0% ~ (all equal) _jsonBodyValidation-2 192 ± 0% 192 ± 0% ~ (all equal) _outputHeaders-2 77.0 ± 0% 77.0 ± 0% ~ (all equal) _requestResponseMapping-2 169 ± 0% 169 ± 0% ~ (all equal) _validation-2 170 ± 0% 170 ± 0% ~ (all equal) _noValidation-2 173 ± 0% 173 ± 0% ~ (all equal) pkg:github.com/swaggest/rest/_examples/advanced-generic goos:linux goarch:amd64 _directGzip-2 103 ± 0% 103 ± 0% ~ (all equal) _directGzipHead-2 104 ± 0% 104 ± 0% ~ (all equal) _noDirectGzip-2 117 ± 0% 117 ± 0% ~ (all equal) _directGzip_decode-2 116 ± 0% 116 ± 0% ~ (all equal) _noDirectGzip_decode-2 130 ± 0% 130 ± 0% ~ (all equal) _htmlResponse-2 108 ± 0% 108 ± 0% ~ (all equal) _jsonBodyManual-2 195 ± 0% 195 ± 0% ~ (all equal) _jsonBody-2 188 ± 0% 188 ± 0% ~ (all equal) _jsonBodyValidation-2 192 ± 0% 192 ± 0% ~ (all equal) _outputHeaders-2 77.0 ± 0% 77.0 ± 0% ~ (all equal) _requestResponseMapping-2 169 ± 0% 169 ± 0% ~ (all equal) _validation-2 170 ± 0% 170 ± 0% ~ (all equal) _noValidation-2 173 ± 0% 173 ± 0% ~ (all equal) pkg:github.com/swaggest/rest/_examples/task-api/internal/infra/nethttp goos:linux goarch:amd64 _notFoundSrv-2 74.0 ± 0% 74.0 ± 0% ~ (all equal) _ok-2 74.0 ± 0% 74.0 ± 0% ~ (all equal) _invalidBody-2 137 ± 0% 137 ± 0% ~ (all equal) name old rps new rps delta pkg:github.com/swaggest/rest/_examples/advanced goos:linux goarch:amd64 _directGzip-2 26.3k ±12% 25.9k ±16% ~ (p=0.690 n=5+5) _directGzipHead-2 27.8k ± 3% 25.5k ± 9% -8.05% (p=0.008 n=5+5) _noDirectGzip-2 5.94k ± 5% 5.81k ± 6% ~ (p=0.310 n=5+5) _directGzip_decode-2 1.74k ± 8% 1.73k ± 4% ~ (p=0.889 n=5+5) _noDirectGzip_decode-2 5.74k ± 3% 5.92k ± 2% +3.28% (p=0.032 n=5+5) _jsonBody-2 15.0k ± 7% 14.7k ± 3% ~ (p=0.310 n=5+5) _jsonBodyValidation-2 12.8k ± 3% 13.2k ± 1% ~ (p=0.095 n=5+5) _outputHeaders-2 26.5k ± 2% 28.0k ± 2% +5.79% (p=0.008 n=5+5) _requestResponseMapping-2 14.9k ± 7% 15.3k ± 6% ~ (p=0.310 n=5+5) _validation-2 13.6k ± 3% 14.4k ± 2% +5.19% (p=0.008 n=5+5) _noValidation-2 17.7k ± 4% 18.6k ± 1% +5.26% (p=0.008 n=5+5) pkg:github.com/swaggest/rest/_examples/advanced-generic goos:linux goarch:amd64 _directGzip-2 25.2k ± 4% 25.3k ±15% ~ (p=0.222 n=5+5) _directGzipHead-2 25.8k ± 2% 26.4k ± 1% +2.45% (p=0.032 n=5+5) _noDirectGzip-2 5.60k ± 2% 5.81k ± 4% +3.63% (p=0.032 n=5+5) _directGzip_decode-2 1.65k ± 2% 1.73k ± 2% +5.17% (p=0.008 n=5+5) _noDirectGzip_decode-2 5.56k ± 2% 5.82k ± 2% +4.60% (p=0.016 n=4+5) _htmlResponse-2 16.7k ± 3% 17.4k ± 3% +3.90% (p=0.032 n=5+5) _jsonBodyManual-2 21.9k ± 4% 22.9k ± 2% +4.42% (p=0.016 n=5+5) _jsonBody-2 15.9k ± 2% 16.3k ± 4% ~ (p=0.310 n=5+5) _jsonBodyValidation-2 13.1k ± 1% 13.6k ± 3% +3.69% (p=0.016 n=5+5) _outputHeaders-2 26.2k ± 1% 27.6k ± 6% ~ (p=0.095 n=5+5) _requestResponseMapping-2 14.8k ± 7% 15.9k ± 2% +7.50% (p=0.016 n=5+5) _validation-2 14.6k ± 2% 14.7k ± 2% ~ (p=0.690 n=5+5) _noValidation-2 19.5k ± 2% 19.1k ± 2% ~ (p=0.095 n=5+5) pkg:github.com/swaggest/rest/_examples/task-api/internal/infra/nethttp goos:linux goarch:amd64 _notFoundSrv-2 23.1k ±14% 22.8k ±12% ~ (p=0.548 n=5+5) _ok-2 23.4k ± 2% 23.4k ± 3% ~ (p=0.968 n=5+5) _invalidBody-2 16.7k ± 4% 16.4k ± 3% ~ (p=0.310 n=5+5) name old alloc/op new alloc/op delta pkg:github.com/swaggest/rest/_examples/advanced goos:linux goarch:amd64 _directGzip-2 3.93kB ± 0% 3.94kB ± 0% ~ (p=0.198 n=5+5) _directGzipHead-2 3.93kB ± 0% 3.93kB ± 0% ~ (p=0.119 n=5+5) _noDirectGzip-2 7.24kB ±12% 7.28kB ±17% ~ (p=1.000 n=5+5) _directGzip_decode-2 403kB ± 0% 403kB ± 0% ~ (p=0.151 n=5+5) _noDirectGzip_decode-2 6.22kB ±12% 6.18kB ± 5% ~ (p=1.000 n=5+5) _jsonBody-2 13.3kB ± 0% 13.3kB ± 0% +0.05% (p=0.048 n=5+5) _jsonBodyValidation-2 19.1kB ± 0% 19.1kB ± 0% ~ (p=0.833 n=5+5) _outputHeaders-2 3.72kB ± 0% 3.72kB ± 0% ~ (p=0.746 n=5+5) _requestResponseMapping-2 16.7kB ± 0% 16.7kB ± 0% ~ (p=0.246 n=5+5) _validation-2 16.6kB ± 0% 16.6kB ± 0% ~ (p=0.286 n=5+5) _noValidation-2 7.91kB ± 0% 7.91kB ± 0% ~ (p=0.127 n=5+5) pkg:github.com/swaggest/rest/_examples/advanced-generic goos:linux goarch:amd64 _directGzip-2 3.99kB ± 0% 3.98kB ± 0% ~ (p=0.476 n=5+5) _directGzipHead-2 3.98kB ± 0% 3.98kB ± 0% ~ (p=0.143 n=5+5) _noDirectGzip-2 7.30kB ±17% 7.31kB ±23% ~ (p=1.000 n=5+5) _directGzip_decode-2 403kB ± 0% 403kB ± 0% ~ (p=0.222 n=5+5) _noDirectGzip_decode-2 6.18kB ± 9% 6.16kB ±10% ~ (p=0.841 n=5+5) _htmlResponse-2 8.27kB ± 0% 8.27kB ± 0% ~ (p=0.214 n=5+5) _jsonBodyManual-2 4.66kB ± 0% 4.66kB ± 0% ~ (p=0.103 n=5+5) _jsonBody-2 10.4kB ± 0% 10.4kB ± 0% ~ (p=0.056 n=5+5) _jsonBodyValidation-2 19.1kB ± 0% 19.1kB ± 0% ~ (p=0.159 n=5+5) _outputHeaders-2 3.76kB ± 0% 3.75kB ± 0% ~ (p=0.071 n=5+5) _requestResponseMapping-2 16.8kB ± 0% 16.8kB ± 0% -0.05% (p=0.008 n=5+5) _validation-2 16.7kB ± 0% 16.7kB ± 0% ~ (p=0.317 n=5+5) _noValidation-2 7.97kB ± 0% 7.97kB ± 0% ~ (p=0.175 n=5+5) pkg:github.com/swaggest/rest/_examples/task-api/internal/infra/nethttp goos:linux goarch:amd64 _notFoundSrv-2 4.89kB ± 0% 4.89kB ± 0% ~ (p=0.317 n=5+5) _ok-2 4.80kB ± 0% 4.80kB ± 0% ~ (p=0.886 n=4+4) _invalidBody-2 8.75kB ± 4% 8.74kB ± 4% ~ (p=0.794 n=5+5) name old allocs/op new allocs/op delta pkg:github.com/swaggest/rest/_examples/advanced goos:linux goarch:amd64 _directGzip-2 42.0 ± 0% 42.0 ± 0% ~ (all equal) _directGzipHead-2 42.0 ± 0% 42.0 ± 0% ~ (all equal) _noDirectGzip-2 50.0 ± 4% 49.8 ± 4% ~ (p=1.000 n=5+5) _directGzip_decode-2 502 ± 0% 503 ± 0% ~ (p=0.238 n=4+5) _noDirectGzip_decode-2 50.0 ± 0% 50.0 ± 0% ~ (all equal) _jsonBody-2 130 ± 0% 130 ± 0% ~ (all equal) _jsonBodyValidation-2 186 ± 0% 186 ± 0% ~ (all equal) _outputHeaders-2 37.0 ± 0% 37.0 ± 0% ~ (all equal) _requestResponseMapping-2 126 ± 0% 126 ± 0% ~ (all equal) _validation-2 155 ± 0% 155 ± 0% ~ (all equal) _noValidation-2 92.0 ± 0% 92.0 ± 0% ~ (all equal) pkg:github.com/swaggest/rest/_examples/advanced-generic goos:linux goarch:amd64 _directGzip-2 44.0 ± 0% 44.0 ± 0% ~ (all equal) _directGzipHead-2 44.0 ± 0% 44.0 ± 0% ~ (all equal) _noDirectGzip-2 52.2 ± 4% 51.8 ± 3% ~ (p=1.000 n=5+5) _directGzip_decode-2 504 ± 0% 504 ± 0% ~ (p=1.000 n=5+5) _noDirectGzip_decode-2 52.0 ± 0% 52.0 ± 0% ~ (all equal) _htmlResponse-2 145 ± 0% 145 ± 0% ~ (all equal) _jsonBodyManual-2 51.0 ± 0% 51.0 ± 0% ~ (all equal) _jsonBody-2 102 ± 0% 102 ± 0% ~ (all equal) _jsonBodyValidation-2 188 ± 0% 188 ± 0% ~ (all equal) _outputHeaders-2 38.0 ± 0% 38.0 ± 0% ~ (all equal) _requestResponseMapping-2 128 ± 0% 128 ± 0% ~ (all equal) _validation-2 157 ± 0% 157 ± 0% ~ (all equal) _noValidation-2 94.0 ± 0% 94.0 ± 0% ~ (all equal) pkg:github.com/swaggest/rest/_examples/task-api/internal/infra/nethttp goos:linux goarch:amd64 _notFoundSrv-2 54.0 ± 0% 54.0 ± 0% ~ (all equal) _ok-2 50.0 ± 0% 50.0 ± 0% ~ (all equal) _invalidBody-2 100 ± 2% 99 ± 0% ~ (p=0.333 n=5+4) ```