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 santhosh-tekuri/jsonschema #52

Closed vearutop closed 2 years ago

vearutop commented 2 years ago

This PR continues https://github.com/swaggest/rest/pull/50.

github-actions[bot] commented 2 years ago

Lines Of Code

Language Files Lines Code Comments Blanks Complexity Bytes
Go (test) 39 3869 (+13) 2965 (+10) 124 780 (+3) 107 108.3K (+363B)
github-actions[bot] commented 2 years ago

API Changes

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

Unit Test Coverage

total: (statements) 82.4%

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

Codecov Report

Merging #52 (549c811) into master (a64ff96) will not change coverage. The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master      #52   +/-   ##
=======================================
  Coverage   74.65%   74.65%           
=======================================
  Files          26       26           
  Lines        1602     1602           
=======================================
  Hits         1196     1196           
  Misses        253      253           
  Partials      153      153           
Flag Coverage Δ
unittests 74.65% <ø> (ø)

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

Impacted Files Coverage Δ
jsonschema/validator.go 75.28% <ø> (ø)

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 a64ff96...549c811. 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.58µs ± 3% 1.55µs ± 3% ~ (p=0.151 n=5+5) pkg:github.com/swaggest/rest/request goos:linux goarch:amd64 Decoder_Decode-2 792ns ± 0% 785ns ± 1% ~ (p=0.111 n=4+5) DecoderFunc_Decode-2 2.35µs ± 4% 2.30µs ± 3% ~ (p=0.333 n=5+5) Decoder_Decode_json-2 27.1µs ± 2% 26.9µs ± 4% ~ (p=0.690 n=5+5) Decoder_Decode_queryObject-2 5.55µs ± 3% 5.56µs ± 3% ~ (p=0.802 n=5+5) Decoder_Decode_jsonParam-2 2.05µs ± 2% 2.07µs ± 4% ~ (p=0.548 n=5+5) DecoderFactory_SetDecoderFunc-2 1.94µs ± 4% 1.89µs ± 1% ~ (p=0.167 n=5+5) pkg:github.com/swaggest/rest/response/gzip goos:linux goarch:amd64 Middleware-2 13.8µs ± 4% 13.7µs ± 5% ~ (p=0.690 n=5+5) Middleware_control-2 3.99µs ± 3% 4.06µs ± 3% ~ (p=0.310 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.2kB ± 0% -0.65% (p=0.008 n=5+5) 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.13kB ± 3% 1.13kB ± 4% ~ (p=1.000 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% 177 ± 0% +2.91% (p=0.008 n=5+5) 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.55µs ± 3% pkg:github.com/swaggest/rest/request goos:linux goarch:amd64 Decoder_Decode-2 785ns ± 1% DecoderFunc_Decode-2 2.30µs ± 3% Decoder_Decode_json-2 26.9µs ± 4% Decoder_Decode_queryObject-2 5.56µs ± 3% Decoder_Decode_jsonParam-2 2.07µs ± 4% DecoderFactory_SetDecoderFunc-2 1.89µs ± 1% pkg:github.com/swaggest/rest/response/gzip goos:linux goarch:amd64 Middleware-2 13.7µs ± 5% Middleware_control-2 4.06µ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.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.13kB ± 4% 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 old time/op new time/op delta pkg:github.com/swaggest/rest/_examples/advanced goos:linux goarch:amd64 _directGzip-2 36.9µs ±10% 35.4µs ± 3% ~ (p=0.222 n=5+5) _directGzipHead-2 36.5µs ± 9% 35.3µs ± 2% ~ (p=0.222 n=5+5) _noDirectGzip-2 153µs ± 2% 148µs ± 2% ~ (p=0.056 n=5+5) _directGzip_decode-2 550µs ± 7% 548µs ± 4% ~ (p=1.000 n=5+5) _noDirectGzip_decode-2 152µs ± 2% 151µs ± 9% ~ (p=0.222 n=5+5) _jsonBody-2 64.6µs ± 2% 62.5µs ± 2% -3.21% (p=0.016 n=5+5) _jsonBodyValidation-2 70.0µs ± 2% 69.2µs ± 2% ~ (p=0.421 n=5+5) _outputHeaders-2 35.0µs ± 8% 34.2µs ± 2% ~ (p=0.548 n=5+5) _validation-2 64.9µs ± 3% 65.1µs ± 2% ~ (p=1.000 n=5+5) pkg:github.com/swaggest/rest/_examples/task-api/internal/infra/nethttp goos:linux goarch:amd64 _notFoundSrv-2 41.5µs ±10% 41.4µs ±10% ~ (p=0.841 n=5+5) _ok-2 41.7µs ± 2% 42.0µs ± 1% ~ (p=0.548 n=5+5) _invalidBody-2 56.6µs ± 2% 60.8µs ± 7% +7.36% (p=0.008 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 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 27.2k ± 9% 28.3k ± 3% ~ (p=0.222 n=5+5) _directGzipHead-2 27.5k ± 8% 28.4k ± 2% ~ (p=0.222 n=5+5) _noDirectGzip-2 6.56k ± 2% 6.75k ± 2% ~ (p=0.056 n=5+5) _directGzip_decode-2 1.82k ± 7% 1.83k ± 4% ~ (p=1.000 n=5+5) _noDirectGzip_decode-2 6.57k ± 2% 6.64k ± 9% ~ (p=0.222 n=5+5) _jsonBody-2 15.5k ± 3% 16.0k ± 2% +3.30% (p=0.016 n=5+5) _jsonBodyValidation-2 14.3k ± 2% 14.4k ± 2% ~ (p=0.389 n=5+5) _outputHeaders-2 28.6k ± 8% 29.2k ± 2% ~ (p=0.548 n=5+5) _validation-2 15.4k ± 3% 15.4k ± 2% ~ (p=1.000 n=5+5) pkg:github.com/swaggest/rest/_examples/task-api/internal/infra/nethttp goos:linux goarch:amd64 _notFoundSrv-2 24.1k ± 9% 24.2k ± 9% ~ (p=0.841 n=5+5) _ok-2 24.0k ± 2% 23.8k ± 1% ~ (p=0.595 n=5+5) _invalidBody-2 17.7k ± 2% 16.5k ± 6% -6.73% (p=0.008 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.794 n=5+5) _directGzipHead-2 3.87kB ± 0% 3.87kB ± 0% ~ (p=0.992 n=5+5) _noDirectGzip-2 6.12kB ±20% 6.15kB ±20% ~ (p=1.000 n=5+5) _directGzip_decode-2 402kB ± 0% 402kB ± 0% ~ (p=1.000 n=5+5) _noDirectGzip_decode-2 5.11kB ± 6% 4.94kB ± 3% ~ (p=0.421 n=5+5) _jsonBody-2 13.2kB ± 0% 13.2kB ± 0% -0.35% (p=0.008 n=5+5) _jsonBodyValidation-2 18.2kB ± 0% 19.0kB ± 0% +4.57% (p=0.008 n=5+5) _outputHeaders-2 3.64kB ± 0% 3.64kB ± 0% ~ (p=0.683 n=5+5) _validation-2 16.2kB ± 0% 16.6kB ± 0% +2.57% (p=0.008 n=5+5) pkg:github.com/swaggest/rest/_examples/task-api/internal/infra/nethttp goos:linux goarch:amd64 _notFoundSrv-2 4.81kB ± 0% 4.81kB ± 0% ~ (p=0.357 n=5+5) _ok-2 4.72kB ± 0% 4.72kB ± 0% ~ (p=0.657 n=4+4) _invalidBody-2 8.60kB ± 0% 8.60kB ± 0% ~ (p=1.000 n=4+4) 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 497 ± 0% 497 ± 0% ~ (p=0.333 n=5+4) _noDirectGzip_decode-2 48.0 ± 0% 48.0 ± 0% ~ (all equal) _jsonBody-2 124 ± 0% 124 ± 0% ~ (all equal) _jsonBodyValidation-2 144 ± 0% 180 ± 0% +25.00% (p=0.008 n=5+5) _outputHeaders-2 35.0 ± 0% 35.0 ± 0% ~ (all equal) _validation-2 131 ± 0% 149 ± 0% +13.74% (p=0.008 n=5+5) 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.0 ± 0% 98.0 ± 0% ~ (all equal) ```