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

Update usage example in documentation #34

Closed vearutop closed 3 years ago

github-actions[bot] commented 3 years ago

Unit Test Coverage

total: (statements) 81.0%

Coverage diff with base branch ```diff ```
codecov[bot] commented 3 years ago

Codecov Report

Merging #34 (c9dfa74) into master (c1e0755) will not change coverage. The diff coverage is n/a.

:exclamation: Current head c9dfa74 differs from pull request most recent head b5ae64c. Consider uploading reports for the commit b5ae64c to get more accurate results Impacted file tree graph

@@           Coverage Diff           @@
##           master      #34   +/-   ##
=======================================
  Coverage   73.01%   73.01%           
=======================================
  Files          26       26           
  Lines        1534     1534           
=======================================
  Hits         1120     1120           
  Misses        263      263           
  Partials      151      151           
Flag Coverage Δ
unittests 73.01% <ø> (ø)

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


Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update c1e0755...b5ae64c. Read the comment docs.

github-actions[bot] commented 3 years 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.79µs ± 2% 1.85µs ± 2% ~ (p=0.086 n=4+4) pkg:github.com/swaggest/rest/request goos:linux goarch:amd64 Decoder_Decode-2 1.03µs ± 4% 1.02µs ± 1% ~ (p=0.222 n=5+5) DecoderFunc_Decode-2 2.77µs ± 2% 2.79µs ± 2% ~ (p=0.460 n=5+5) Decoder_Decode_json-2 32.5µs ± 1% 32.6µs ± 3% ~ (p=0.310 n=5+5) Decoder_Decode_queryObject-2 7.00µs ± 2% 6.98µs ± 2% ~ (p=0.841 n=5+5) Decoder_Decode_jsonParam-2 2.56µs ± 4% 2.50µs ± 2% ~ (p=0.087 n=5+5) DecoderFactory_SetDecoderFunc-2 2.31µs ± 4% 2.35µs ± 2% ~ (p=0.421 n=5+5) pkg:github.com/swaggest/rest/response/gzip goos:linux goarch:amd64 Middleware-2 14.8µs ± 1% 15.1µs ± 1% +2.41% (p=0.008 n=5+5) Middleware_control-2 4.58µs ± 2% 4.50µs ± 2% ~ (p=0.056 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.50kB ± 0% 2.50kB ± 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.3kB ± 0% 12.3kB ± 0% ~ (all equal) Decoder_Decode_queryObject-2 2.00kB ± 0% 2.00kB ± 0% ~ (all equal) Decoder_Decode_jsonParam-2 720B ± 0% 720B ± 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.13kB ± 2% 1.14kB ± 2% ~ (p=0.254 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 169 ± 0% 169 ± 0% ~ (all equal) Decoder_Decode_queryObject-2 36.0 ± 0% 36.0 ± 0% ~ (all equal) Decoder_Decode_jsonParam-2 12.0 ± 0% 12.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) ```
github-actions[bot] commented 3 years 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 41.5µs ± 5% 40.6µs ± 2% ~ (p=0.310 n=5+5) _directGzipHead-2 40.6µs ± 6% 39.9µs ± 5% ~ (p=0.690 n=5+5) _noDirectGzip-2 191µs ± 2% 191µs ± 4% ~ (p=1.000 n=5+5) _directGzip_decode-2 665µs ± 3% 661µs ± 3% ~ (p=0.690 n=5+5) _noDirectGzip_decode-2 189µs ± 2% 190µs ± 5% ~ (p=0.500 n=5+5) _jsonBody-2 71.1µs ± 4% 71.8µs ± 3% ~ (p=0.548 n=5+5) _jsonBodyValidation-2 80.3µs ± 5% 79.1µs ± 3% ~ (p=0.421 n=5+5) _outputHeaders-2 39.2µs ± 3% 37.6µs ± 2% -4.09% (p=0.032 n=5+5) _validation-2 75.7µs ± 3% 75.2µs ± 3% ~ (p=0.421 n=5+5) pkg:github.com/swaggest/rest/_examples/task-api/internal/infra/nethttp goos:linux goarch:amd64 _notFoundSrv-2 45.8µs ± 3% 46.3µs ± 1% ~ (p=0.421 n=5+5) _ok-2 48.4µs ± 4% 48.9µs ± 3% ~ (p=0.222 n=5+5) _invalidBody-2 69.7µs ± 2% 68.7µs ± 3% ~ (p=0.421 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) _validation-2 177 ± 0% 177 ± 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 358 ± 0% 359 ± 0% ~ (p=0.444 n=5+5) _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) _validation-2 170 ± 0% 170 ± 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 24.1k ± 5% 24.6k ± 2% ~ (p=0.310 n=5+5) _directGzipHead-2 24.7k ± 6% 25.1k ± 5% ~ (p=0.690 n=5+5) _noDirectGzip-2 5.24k ± 2% 5.25k ± 4% ~ (p=1.000 n=5+5) _directGzip_decode-2 1.50k ± 3% 1.51k ± 3% ~ (p=0.690 n=5+5) _noDirectGzip_decode-2 5.29k ± 2% 5.28k ± 5% ~ (p=0.548 n=5+5) _jsonBody-2 14.1k ± 4% 13.9k ± 3% ~ (p=0.595 n=5+5) _jsonBodyValidation-2 12.5k ± 5% 12.6k ± 4% ~ (p=0.421 n=5+5) _outputHeaders-2 25.5k ± 3% 26.6k ± 2% +4.22% (p=0.032 n=5+5) _validation-2 13.2k ± 3% 13.3k ± 3% ~ (p=0.421 n=5+5) pkg:github.com/swaggest/rest/_examples/task-api/internal/infra/nethttp goos:linux goarch:amd64 _notFoundSrv-2 21.9k ± 3% 21.6k ± 1% ~ (p=0.421 n=5+5) _ok-2 20.7k ± 4% 20.4k ± 3% ~ (p=0.222 n=5+5) _invalidBody-2 14.4k ± 2% 14.6k ± 3% ~ (p=0.421 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.87kB ± 0% 3.87kB ± 0% ~ (p=0.405 n=5+5) _directGzipHead-2 3.87kB ± 0% 3.87kB ± 0% ~ (p=0.873 n=5+5) _noDirectGzip-2 6.52kB ±16% 6.70kB ±22% ~ (p=0.690 n=5+5) _directGzip_decode-2 403kB ± 0% 403kB ± 0% ~ (p=0.548 n=5+5) _noDirectGzip_decode-2 5.16kB ± 9% 5.34kB ± 4% ~ (p=0.222 n=5+5) _jsonBody-2 11.8kB ± 0% 11.8kB ± 0% ~ (p=0.952 n=5+5) _jsonBodyValidation-2 18.2kB ± 0% 18.2kB ± 0% ~ (p=0.270 n=5+5) _outputHeaders-2 3.65kB ± 0% 3.65kB ± 0% ~ (p=1.000 n=5+5) _validation-2 16.2kB ± 0% 16.2kB ± 0% ~ (p=1.000 n=5+5) pkg:github.com/swaggest/rest/_examples/task-api/internal/infra/nethttp goos:linux goarch:amd64 _notFoundSrv-2 4.82kB ± 0% 4.82kB ± 0% ~ (p=0.397 n=5+5) _ok-2 4.73kB ± 0% 4.73kB ± 0% ~ (p=0.886 n=4+4) _invalidBody-2 8.70kB ± 4% 8.69kB ± 4% ~ (p=0.802 n=5+5) name old allocs/op new allocs/op delta pkg:github.com/swaggest/rest/_examples/advanced goos:linux goarch:amd64 _directGzip-2 40.0 ± 0% 40.0 ± 0% ~ (all equal) _directGzipHead-2 40.0 ± 0% 40.0 ± 0% ~ (all equal) _noDirectGzip-2 48.2 ± 5% 49.0 ± 0% ~ (p=0.556 n=5+4) _directGzip_decode-2 498 ± 0% 498 ± 0% ~ (p=0.444 n=5+5) _noDirectGzip_decode-2 48.0 ± 0% 48.0 ± 0% ~ (all equal) _jsonBody-2 103 ± 0% 103 ± 0% ~ (all equal) _jsonBodyValidation-2 144 ± 0% 144 ± 0% ~ (all equal) _outputHeaders-2 35.0 ± 0% 35.0 ± 0% ~ (all equal) _validation-2 131 ± 0% 131 ± 0% ~ (all equal) pkg:github.com/swaggest/rest/_examples/task-api/internal/infra/nethttp goos:linux goarch:amd64 _notFoundSrv-2 52.0 ± 0% 52.0 ± 0% ~ (all equal) _ok-2 48.0 ± 0% 48.0 ± 0% ~ (all equal) _invalidBody-2 98.8 ± 2% 98.8 ± 2% ~ (p=1.000 n=5+5) ```