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

Fix gotip tests and benchmarks #54

Closed vearutop closed 2 years ago

github-actions[bot] commented 2 years ago

Lines Of Code

Language Files Lines Code Comments Blanks Complexity Bytes
Go 95 (+2) 7068 (+112) 5130 (+85) 472 (+2) 1466 (+25) 900 (+13) 170K (+3K)
Go (test) 41 (+2) 4050 (+181) 3105 (+140) 126 (+2) 819 (+39) 111 (+4) 113.2K (+5K)
JSON 2 1023 (+75) 1023 (+75) 0 0 0 43.7K (+3.7K)
Makefile 3 127 (+2) 91 (-1) 12 (+2) 24 (+1) 11 (-1) 4K (+97B)
YAML 10 (+1) 639 (+54) 570 (+49) 41 (+1) 28 (+4) 0 19.9K (+926B)
github-actions[bot] commented 2 years ago

Unit Test Coverage

total: (statements) 81.8%

Coverage diff with base branch ```diff 85c85,86 < github.com/swaggest/rest/openapi/collector.go ProvideRequestJSONSchemas 50.0% --- > github.com/swaggest/rest/openapi/collector.go ProvideRequestJSONSchemas 53.8% > github.com/swaggest/rest/openapi/collector.go provideFormDataSchemas 0.0% 112c113 < github.com/swaggest/rest/request/middleware.go ValidatorMiddleware 83.3% --- > github.com/swaggest/rest/request/middleware.go ValidatorMiddleware 85.7% 184c185 < total: (statements) 82.4% --- > total: (statements) 81.8% ```
github-actions[bot] commented 2 years ago

Go API Changes

# summary
Inferred base version: v0.2.17
Suggested version: v0.2.18
codecov[bot] commented 2 years ago

Codecov Report

Merging #54 (1eab099) into master (cdbab60) will decrease coverage by 0.60%. The diff coverage is 20.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #54      +/-   ##
==========================================
- Coverage   74.65%   74.05%   -0.61%     
==========================================
  Files          26       26              
  Lines        1602     1611       +9     
==========================================
- Hits         1196     1193       -3     
- Misses        253      261       +8     
- Partials      153      157       +4     
Flag Coverage Δ
unittests 74.05% <20.00%> (-0.61%) :arrow_down:

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

Impacted Files Coverage Δ
openapi/collector.go 60.45% <9.09%> (-4.17%) :arrow_down:
request/middleware.go 87.17% <100.00%> (+0.33%) :arrow_up:

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 cdbab60...1eab099. Read the comment docs.

github-actions[bot] commented 2 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.59µs ± 2% 1.57µs ± 2% ~ (p=0.310 n=5+5) pkg:github.com/swaggest/rest/request goos:linux goarch:amd64 Decoder_Decode-2 869ns ± 8% 843ns ± 4% ~ (p=0.310 n=5+5) DecoderFunc_Decode-2 2.46µs ± 3% 2.47µs ± 4% ~ (p=1.000 n=5+5) Decoder_Decode_json-2 27.3µs ± 3% 26.7µs ± 2% ~ (p=0.222 n=5+5) Decoder_Decode_queryObject-2 5.65µs ± 4% 5.69µs ± 6% ~ (p=1.000 n=5+5) Decoder_Decode_jsonParam-2 2.27µs ± 5% 2.15µs ± 1% -5.31% (p=0.008 n=5+5) DecoderFactory_SetDecoderFunc-2 2.00µs ± 6% 2.03µs ± 3% ~ (p=0.548 n=5+5) pkg:github.com/swaggest/rest/response/gzip goos:linux goarch:amd64 Middleware-2 13.5µs ± 3% 13.5µs ± 5% ~ (p=1.000 n=5+5) Middleware_control-2 4.10µs ± 3% 4.03µs ± 5% ~ (p=0.421 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.17kB ± 2% 1.14kB ± 5% ~ (p=0.167 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.57µs ± 2% pkg:github.com/swaggest/rest/request goos:linux goarch:amd64 Decoder_Decode-2 843ns ± 4% DecoderFunc_Decode-2 2.47µs ± 4% Decoder_Decode_json-2 26.7µs ± 2% Decoder_Decode_queryObject-2 5.69µs ± 6% Decoder_Decode_jsonParam-2 2.15µs ± 1% DecoderFactory_SetDecoderFunc-2 2.03µs ± 3% pkg:github.com/swaggest/rest/response/gzip goos:linux goarch:amd64 Middleware-2 13.5µs ± 5% Middleware_control-2 4.03µs ± 5% 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.14kB ± 5% 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 2 years ago

Examples Benchmark Result

Benchmark diff with base branch ``` name time/op pkg:github.com/swaggest/rest/_examples/advanced goos:linux goarch:amd64 _directGzip-2 24.4µs ± 9% _directGzipHead-2 23.9µs ± 5% _noDirectGzip-2 133µs ± 1% _directGzip_decode-2 431µs ± 1% _noDirectGzip_decode-2 133µs ± 0% _jsonBody-2 42.1µs ± 1% _jsonBodyValidation-2 48.2µs ± 1% _outputHeaders-2 23.2µs ± 3% _requestResponseMapping-2 41.1µs ± 1% _validation-2 44.5µs ± 1% _noValidation-2 29.5µs ± 3% pkg:github.com/swaggest/rest/_examples/task-api/internal/infra/nethttp goos:linux goarch:amd64 _notFoundSrv-2 26.6µs ± 1% _ok-2 27.5µs ± 1% _invalidBody-2 39.0µs ± 2% name B:rcvd/op pkg:github.com/swaggest/rest/_examples/advanced goos:linux goarch:amd64 _directGzip-2 639 ± 0% _directGzipHead-2 183 ± 0% _noDirectGzip-2 1.04k ± 0% _directGzip_decode-2 639 ± 0% _noDirectGzip_decode-2 1.04k ± 0% _jsonBody-2 208 ± 0% _jsonBodyValidation-2 194 ± 0% _outputHeaders-2 155 ± 0% _requestResponseMapping-2 94.0 ± 0% _validation-2 177 ± 0% _noValidation-2 177 ± 0% pkg:github.com/swaggest/rest/_examples/task-api/internal/infra/nethttp goos:linux goarch:amd64 _notFoundSrv-2 337 ± 0% _ok-2 359 ± 0% _invalidBody-2 435 ± 0% name B:sent/op pkg:github.com/swaggest/rest/_examples/advanced goos:linux goarch:amd64 _directGzip-2 103 ± 0% _directGzipHead-2 104 ± 0% _noDirectGzip-2 117 ± 0% _directGzip_decode-2 116 ± 0% _noDirectGzip_decode-2 130 ± 0% _jsonBody-2 188 ± 0% _jsonBodyValidation-2 192 ± 0% _outputHeaders-2 77.0 ± 0% _requestResponseMapping-2 169 ± 0% _validation-2 170 ± 0% _noValidation-2 173 ± 0% pkg:github.com/swaggest/rest/_examples/task-api/internal/infra/nethttp goos:linux goarch:amd64 _notFoundSrv-2 74.0 ± 0% _ok-2 74.0 ± 0% _invalidBody-2 137 ± 0% name rps pkg:github.com/swaggest/rest/_examples/advanced goos:linux goarch:amd64 _directGzip-2 41.1k ± 9% _directGzipHead-2 41.8k ± 5% _noDirectGzip-2 7.52k ± 1% _directGzip_decode-2 2.32k ± 1% _noDirectGzip_decode-2 7.54k ± 0% _jsonBody-2 23.8k ± 1% _jsonBodyValidation-2 20.8k ± 1% _outputHeaders-2 43.1k ± 3% _requestResponseMapping-2 24.3k ± 1% _validation-2 22.5k ± 1% _noValidation-2 33.9k ± 3% pkg:github.com/swaggest/rest/_examples/task-api/internal/infra/nethttp goos:linux goarch:amd64 _notFoundSrv-2 37.6k ± 1% _ok-2 36.4k ± 1% _invalidBody-2 25.7k ± 2% name alloc/op pkg:github.com/swaggest/rest/_examples/advanced goos:linux goarch:amd64 _directGzip-2 3.91kB ± 0% _directGzipHead-2 3.90kB ± 0% _noDirectGzip-2 6.10kB ±16% _directGzip_decode-2 402kB ± 0% _noDirectGzip_decode-2 5.33kB ± 3% _jsonBody-2 13.1kB ± 0% _jsonBodyValidation-2 18.9kB ± 0% _outputHeaders-2 3.68kB ± 0% _requestResponseMapping-2 16.6kB ± 0% _validation-2 16.5kB ± 0% _noValidation-2 6.08kB ± 0% pkg:github.com/swaggest/rest/_examples/task-api/internal/infra/nethttp goos:linux goarch:amd64 _notFoundSrv-2 4.86kB ± 0% _ok-2 4.76kB ± 0% _invalidBody-2 8.65kB ± 0% name allocs/op pkg:github.com/swaggest/rest/_examples/advanced goos:linux goarch:amd64 _directGzip-2 42.0 ± 0% _directGzipHead-2 42.0 ± 0% _noDirectGzip-2 49.4 ± 3% _directGzip_decode-2 500 ± 0% _noDirectGzip_decode-2 50.0 ± 0% _jsonBody-2 127 ± 0% _jsonBodyValidation-2 183 ± 0% _outputHeaders-2 37.0 ± 0% _requestResponseMapping-2 122 ± 0% _validation-2 152 ± 0% _noValidation-2 72.0 ± 0% pkg:github.com/swaggest/rest/_examples/task-api/internal/infra/nethttp goos:linux goarch:amd64 _notFoundSrv-2 54.0 ± 0% _ok-2 50.0 ± 0% _invalidBody-2 101 ± 0% ```