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

Keep original use case when creating failing instance #45

Closed vearutop closed 3 years ago

github-actions[bot] commented 3 years ago

Lines Of Code

Language Files Lines Code Comments Blanks Complexity Bytes
Go 77 6022 (+2) 4370 (+2) 407 1245 832 142.4K (+108B)
YAML 9 537 (+12) 473 (+10) 40 24 (+2) 0 16.6K (+349B)
github-actions[bot] commented 3 years ago

API Changes

# summary
Inferred base version: v0.2.11
Suggested version: v0.3.0
github-actions[bot] commented 3 years ago

Unit Test Coverage

total: (statements) 82.0%

Coverage diff with base branch ```diff 73c73 < github.com/swaggest/rest/nethttp/usecase.go UseCaseMiddlewares 90.0% --- > github.com/swaggest/rest/nethttp/usecase.go UseCaseMiddlewares 90.9% ```
codecov[bot] commented 3 years ago

Codecov Report

Merging #45 (a0f41f9) into master (993f6be) will decrease coverage by 0.03%. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #45      +/-   ##
==========================================
- Coverage   74.28%   74.25%   -0.04%     
==========================================
  Files          26       26              
  Lines        1571     1569       -2     
==========================================
- Hits         1167     1165       -2     
  Misses        254      254              
  Partials      150      150              
Flag Coverage Δ
unittests 74.25% <100.00%> (-0.04%) :arrow_down:

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

Impacted Files Coverage Δ
nethttp/usecase.go 75.00% <100.00%> (-5.00%) :arrow_down:

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 993f6be...a0f41f9. 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.31µs ± 6% 1.25µs ± 2% -5.22% (p=0.032 n=5+5) pkg:github.com/swaggest/rest/request goos:linux goarch:amd64 Decoder_Decode-2 648ns ±10% 668ns ±20% ~ (p=0.841 n=5+5) DecoderFunc_Decode-2 1.87µs ± 2% 1.85µs ± 3% ~ (p=0.222 n=5+5) Decoder_Decode_json-2 21.1µs ± 2% 21.2µs ± 2% ~ (p=0.595 n=5+5) Decoder_Decode_queryObject-2 4.60µs ± 4% 4.42µs ± 3% ~ (p=0.056 n=5+5) Decoder_Decode_jsonParam-2 1.65µs ± 2% 1.61µs ± 2% -2.38% (p=0.032 n=5+5) DecoderFactory_SetDecoderFunc-2 1.51µs ± 1% 1.56µs ± 5% ~ (p=0.056 n=5+5) pkg:github.com/swaggest/rest/response/gzip goos:linux goarch:amd64 Middleware-2 10.9µs ± 2% 11.4µs ± 3% +4.09% (p=0.032 n=5+5) Middleware_control-2 3.28µs ±14% 3.07µs ± 3% ~ (p=0.095 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.3kB ± 0% 12.3kB ± 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.16kB ± 3% 1.15kB ± 3% ~ (p=0.690 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 172 ± 0% 172 ± 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.25µs ± 2% pkg:github.com/swaggest/rest/request goos:linux goarch:amd64 Decoder_Decode-2 668ns ±20% DecoderFunc_Decode-2 1.85µs ± 3% Decoder_Decode_json-2 21.2µs ± 2% Decoder_Decode_queryObject-2 4.42µs ± 3% Decoder_Decode_jsonParam-2 1.61µs ± 2% DecoderFactory_SetDecoderFunc-2 1.56µs ± 5% pkg:github.com/swaggest/rest/response/gzip goos:linux goarch:amd64 Middleware-2 11.4µs ± 3% Middleware_control-2 3.07µs ± 3% 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.3kB ± 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.15kB ± 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 172 ± 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 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 44.5µs ±40% 44.9µs ±34% ~ (p=0.841 n=5+5) _directGzipHead-2 37.6µs ± 5% 36.8µs ± 1% ~ (p=0.310 n=5+5) _noDirectGzip-2 166µs ± 1% 169µs ± 3% ~ (p=0.222 n=5+5) _directGzip_decode-2 604µs ± 2% 621µs ± 4% ~ (p=0.111 n=4+5) _noDirectGzip_decode-2 169µs ± 2% 167µs ± 2% ~ (p=0.222 n=5+5) _jsonBody-2 70.2µs ± 3% 69.6µs ± 2% ~ (p=0.548 n=5+5) _jsonBodyValidation-2 75.0µs ± 6% 75.5µs ± 2% ~ (p=0.310 n=5+5) _outputHeaders-2 36.6µs ± 1% 36.8µs ± 2% ~ (p=0.690 n=5+5) _validation-2 69.2µs ± 2% 71.3µs ± 3% +3.07% (p=0.032 n=5+5) pkg:github.com/swaggest/rest/_examples/task-api/internal/infra/nethttp goos:linux goarch:amd64 _notFoundSrv-2 41.1µs ± 3% 48.1µs ±47% ~ (p=0.413 n=4+5) _ok-2 44.0µs ± 3% 43.8µs ± 3% ~ (p=0.841 n=5+5) _invalidBody-2 63.7µs ± 4% 64.3µs ± 0% ~ (p=0.556 n=5+4) 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 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) _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 23.4k ±31% 23.3k ±29% ~ (p=0.841 n=5+5) _directGzipHead-2 26.6k ± 5% 27.2k ± 1% ~ (p=0.310 n=5+5) _noDirectGzip-2 6.01k ± 1% 5.92k ± 3% ~ (p=0.222 n=5+5) _directGzip_decode-2 1.66k ± 2% 1.61k ± 4% ~ (p=0.111 n=4+5) _noDirectGzip_decode-2 5.91k ± 2% 5.97k ± 2% ~ (p=0.222 n=5+5) _jsonBody-2 14.3k ± 3% 14.4k ± 2% ~ (p=0.548 n=5+5) _jsonBodyValidation-2 13.3k ± 6% 13.2k ± 2% ~ (p=0.310 n=5+5) _outputHeaders-2 27.3k ± 1% 27.2k ± 3% ~ (p=0.738 n=5+5) _validation-2 14.5k ± 2% 14.0k ± 3% -2.94% (p=0.032 n=5+5) pkg:github.com/swaggest/rest/_examples/task-api/internal/infra/nethttp goos:linux goarch:amd64 _notFoundSrv-2 24.3k ± 3% 21.7k ±35% ~ (p=0.413 n=4+5) _ok-2 22.7k ± 3% 22.8k ± 3% ~ (p=0.841 n=5+5) _invalidBody-2 15.7k ± 4% 15.5k ± 0% ~ (p=0.556 n=5+4) name old alloc/op new alloc/op delta pkg:github.com/swaggest/rest/_examples/advanced goos:linux goarch:amd64 _directGzip-2 3.88kB ± 0% 3.87kB ± 0% ~ (p=0.651 n=5+5) _directGzipHead-2 3.87kB ± 0% 3.87kB ± 0% ~ (p=0.738 n=5+5) _noDirectGzip-2 6.46kB ±14% 6.50kB ±19% ~ (p=0.548 n=5+5) _directGzip_decode-2 403kB ± 0% 403kB ± 0% ~ (p=0.548 n=5+5) _noDirectGzip_decode-2 5.07kB ± 2% 5.24kB ± 4% +3.50% (p=0.032 n=4+5) _jsonBody-2 13.2kB ± 0% 13.2kB ± 0% ~ (p=0.516 n=5+5) _jsonBodyValidation-2 18.2kB ± 0% 18.2kB ± 0% ~ (p=0.595 n=5+5) _outputHeaders-2 3.64kB ± 0% 3.64kB ± 0% ~ (p=0.397 n=4+5) _validation-2 16.2kB ± 0% 16.2kB ± 0% ~ (p=0.651 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.278 n=5+5) _ok-2 4.73kB ± 0% 4.73kB ± 0% ~ (p=1.000 n=4+4) _invalidBody-2 8.73kB ± 4% 8.73kB ± 4% ~ (p=0.571 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 47.8 ± 4% 47.8 ± 4% ~ (p=1.000 n=5+5) _directGzip_decode-2 498 ± 0% 498 ± 0% ~ (p=0.643 n=5+5) _noDirectGzip_decode-2 48.0 ± 0% 48.0 ± 0% ~ (all equal) _jsonBody-2 124 ± 0% 124 ± 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 99.0 ± 0% 99.0 ± 0% ~ (all equal) ```