Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Combine error responses with anyOf/oneOf #73

Merged
merged 3 commits into from
Apr 20, 2022
Merged

Conversation

vearutop
Copy link
Member

@vearutop vearutop commented Apr 20, 2022

Resolves #71.

This PR adds an option to enable alternative responses combinations under same HTTP status code. It is not enabled by default to avoid surprising complications of anyOf (such logical constraints may have limited support in tools).

	s.OpenAPICollector.CombineErrors = "anyOf"

Once this option is enabled, it is possible to set multiple expected errors in usecase.

	u.SetExpectedErrors(status.InvalidArgument, anotherErr{}, status.FailedPrecondition, status.AlreadyExists)

And then you would still need to update MakeErrResp to manage error responses (see #67 (comment) for details).

	h.MakeErrResp = func(ctx context.Context, err error) (int, interface{}) {
		code, er := rest.Err(err)

		var ae anotherErr

		if errors.As(err, &ae) {
			return http.StatusBadRequest, ae
		}

		return code, er
	}

@github-actions
Copy link

github-actions bot commented Apr 20, 2022

Lines Of Code

Language Files Lines Code Comments Blanks Complexity Bytes
Go 98 6626 (+84) 4809 (+59) 442 (+5) 1375 (+20) 763 (+13) 160K (+1.9K)
Go (test) 43 4505 (+88) 3468 (+76) 126 (+1) 911 (+11) 119 (+1) 125.1K (+2.1K)
JSON 3 1281 (+22) 1281 (+22) 0 0 0 52.4K (+754B)

@github-actions
Copy link

Go API Changes

# github.com/swaggest/rest/openapi
## compatible changes
Collector.CombineErrors: added

# summary
Inferred base version: v0.2.26
Suggested version: v0.3.0

@github-actions
Copy link

github-actions bot commented Apr 20, 2022

Unit Test Coverage

total: (statements) 82.9%

Coverage diff with base branch
85c85,86
< github.com/swaggest/rest/openapi/collector.go	processUseCase	90.5%
---
> github.com/swaggest/rest/openapi/collector.go	processUseCase	100.0%
> github.com/swaggest/rest/openapi/collector.go	processExpectedErrors	84.0%
162c163
< total:	(statements)	82.8%
---
> total:	(statements)	82.9%

@codecov
Copy link

codecov bot commented Apr 20, 2022

Codecov Report

Merging #73 (28d49b0) into master (8a3766c) will increase coverage by 0.14%.
The diff coverage is 79.54%.

@@            Coverage Diff             @@
##           master      #73      +/-   ##
==========================================
+ Coverage   76.83%   76.98%   +0.14%     
==========================================
  Files          27       27              
  Lines        1347     1373      +26     
==========================================
+ Hits         1035     1057      +22     
- Misses        199      204       +5     
+ Partials      113      112       -1     
Flag Coverage Δ
unittests 76.98% <79.54%> (+0.14%) ⬆️

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

Impacted Files Coverage Δ
openapi/collector.go 61.26% <79.54%> (+2.67%) ⬆️

📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more

@github-actions
Copy link

github-actions bot commented Apr 20, 2022

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.36µs ± 1%    1.33µs ± 1%  -1.77%  (p=0.008 n=5+5)
pkg:github.com/swaggest/rest/request goos:linux goarch:amd64
Decoder_Decode-2                           725ns ± 5%     712ns ± 4%    ~     (p=0.095 n=5+5)
DecoderFunc_Decode-2                      2.08µs ± 1%    2.05µs ± 0%    ~     (p=0.071 n=5+5)
Decoder_Decode_json-2                     23.6µs ± 1%    23.2µs ± 0%  -1.68%  (p=0.008 n=5+5)
Decoder_Decode_queryObject-2              5.27µs ± 0%    5.25µs ± 1%    ~     (p=0.841 n=5+5)
Decoder_Decode_jsonParam-2                1.97µs ± 0%    1.97µs ± 0%    ~     (p=0.143 n=5+5)
DecoderFactory_SetDecoderFunc-2           1.72µs ± 0%    1.70µs ± 1%  -1.30%  (p=0.008 n=5+5)
pkg:github.com/swaggest/rest/response/gzip goos:linux goarch:amd64
Middleware-2                              12.0µs ± 2%    11.9µs ± 2%    ~     (p=0.421 n=5+5)
Middleware_control-2                      3.01µs ± 1%    3.02µs ± 2%    ~     (p=0.595 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 ± 3%    1.14kB ± 6%    ~     (p=0.278 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.33µs ± 1%
pkg:github.com/swaggest/rest/request goos:linux goarch:amd64
Decoder_Decode-2                         712ns ± 4%
DecoderFunc_Decode-2                    2.05µs ± 0%
Decoder_Decode_json-2                   23.2µs ± 0%
Decoder_Decode_queryObject-2            5.25µs ± 1%
Decoder_Decode_jsonParam-2              1.97µs ± 0%
DecoderFactory_SetDecoderFunc-2         1.70µs ± 1%
pkg:github.com/swaggest/rest/response/gzip goos:linux goarch:amd64
Middleware-2                            11.9µs ± 2%
Middleware_control-2                    3.02µs ± 2%

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 ± 6%
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
Copy link

github-actions bot commented Apr 20, 2022

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                24.7µs ± 1%    24.4µs ± 1%    ~     (p=0.056 n=5+5)
_directGzipHead-2            25.0µs ± 0%    25.2µs ±11%    ~     (p=0.190 n=4+5)
_noDirectGzip-2               129µs ± 1%     129µs ± 1%    ~     (p=0.730 n=5+5)
_directGzip_decode-2          461µs ± 3%     442µs ± 2%  -3.98%  (p=0.008 n=5+5)
_noDirectGzip_decode-2        132µs ± 1%     129µs ± 1%  -2.14%  (p=0.008 n=5+5)
_jsonBody-2                  47.9µs ± 2%    45.1µs ± 3%  -5.72%  (p=0.008 n=5+5)
_jsonBodyValidation-2        54.0µs ± 2%    52.1µs ± 0%  -3.43%  (p=0.008 n=5+5)
_outputHeaders-2             24.7µs ± 1%    24.1µs ± 1%  -2.49%  (p=0.008 n=5+5)
_requestResponseMapping-2    46.3µs ± 4%    44.2µs ± 1%  -4.51%  (p=0.008 n=5+5)
_validation-2                50.3µs ± 3%    47.4µs ± 2%  -5.77%  (p=0.016 n=5+4)
_noValidation-2              36.7µs ± 2%    34.9µs ± 2%  -4.85%  (p=0.008 n=5+5)
pkg:github.com/swaggest/rest/_examples/advanced-generic goos:linux goarch:amd64
_directGzip-2                25.7µs ± 0%    24.8µs ± 1%  -3.16%  (p=0.029 n=4+4)
_directGzipHead-2            25.8µs ± 1%    24.7µs ± 2%  -4.33%  (p=0.008 n=5+5)
_noDirectGzip-2               130µs ± 1%     130µs ± 0%    ~     (p=0.310 n=5+5)
_directGzip_decode-2          468µs ± 1%     447µs ± 2%  -4.38%  (p=0.008 n=5+5)
_noDirectGzip_decode-2        129µs ± 1%     129µs ± 1%    ~     (p=0.421 n=5+5)
_jsonBody-2                  45.0µs ± 2%    44.6µs ± 2%    ~     (p=0.548 n=5+5)
_jsonBodyValidation-2        52.5µs ± 4%    52.3µs ± 1%    ~     (p=0.841 n=5+5)
_outputHeaders-2             25.4µs ± 3%    24.3µs ± 1%  -4.06%  (p=0.016 n=4+5)
_requestResponseMapping-2    47.0µs ± 4%    44.8µs ± 7%    ~     (p=0.056 n=5+5)
_validation-2                49.0µs ± 3%    49.1µs ± 3%    ~     (p=0.841 n=5+5)
_noValidation-2              36.1µs ± 3%    35.7µs ± 2%    ~     (p=0.690 n=5+5)
pkg:github.com/swaggest/rest/_examples/task-api/internal/infra/nethttp goos:linux goarch:amd64
_notFoundSrv-2               27.9µs ± 1%    27.5µs ± 1%    ~     (p=0.063 n=4+5)
_ok-2                        28.1µs ± 1%    28.5µs ± 2%    ~     (p=0.310 n=5+5)
_invalidBody-2               39.3µs ± 1%    39.5µs ± 2%    ~     (p=0.548 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                   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/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)
_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                 40.5k ± 1%     41.0k ± 1%    ~     (p=0.056 n=5+5)
_directGzipHead-2             40.0k ± 0%     39.7k ±10%    ~     (p=0.190 n=4+5)
_noDirectGzip-2               7.74k ± 1%     7.73k ± 1%    ~     (p=0.841 n=5+5)
_directGzip_decode-2          2.17k ± 3%     2.26k ± 2%  +4.13%  (p=0.008 n=5+5)
_noDirectGzip_decode-2        7.58k ± 1%     7.74k ± 1%  +2.18%  (p=0.008 n=5+5)
_jsonBody-2                   20.9k ± 2%     22.2k ± 3%  +6.11%  (p=0.008 n=5+5)
_jsonBodyValidation-2         18.5k ± 2%     19.2k ± 0%  +3.53%  (p=0.008 n=5+5)
_outputHeaders-2              40.4k ± 1%     41.4k ± 1%  +2.55%  (p=0.008 n=5+5)
_requestResponseMapping-2     21.6k ± 4%     22.6k ± 1%  +4.67%  (p=0.008 n=5+5)
_validation-2                 19.9k ± 3%     20.3k ±16%    ~     (p=0.151 n=5+5)
_noValidation-2               27.2k ± 2%     28.6k ± 2%  +5.09%  (p=0.008 n=5+5)
pkg:github.com/swaggest/rest/_examples/advanced-generic goos:linux goarch:amd64
_directGzip-2                 39.0k ± 0%     39.1k ±12%    ~     (p=0.190 n=4+5)
_directGzipHead-2             38.8k ± 1%     40.6k ± 2%  +4.54%  (p=0.008 n=5+5)
_noDirectGzip-2               7.67k ± 1%     7.71k ± 0%    ~     (p=0.310 n=5+5)
_directGzip_decode-2          2.14k ± 1%     2.23k ± 2%  +4.52%  (p=0.008 n=5+5)
_noDirectGzip_decode-2        7.77k ± 1%     7.74k ± 1%    ~     (p=0.421 n=5+5)
_jsonBody-2                   22.2k ± 2%     22.4k ± 2%    ~     (p=0.548 n=5+5)
_jsonBodyValidation-2         19.1k ± 4%     19.1k ± 1%    ~     (p=0.841 n=5+5)
_outputHeaders-2              39.4k ± 3%     41.1k ± 1%  +4.20%  (p=0.016 n=4+5)
_requestResponseMapping-2     21.3k ± 4%     22.4k ± 7%    ~     (p=0.056 n=5+5)
_validation-2                 20.4k ± 3%     20.4k ± 3%    ~     (p=0.841 n=5+5)
_noValidation-2               27.7k ± 3%     28.0k ± 2%    ~     (p=0.690 n=5+5)
pkg:github.com/swaggest/rest/_examples/task-api/internal/infra/nethttp goos:linux goarch:amd64
_notFoundSrv-2                35.8k ± 1%     36.3k ± 1%    ~     (p=0.063 n=4+5)
_ok-2                         35.5k ± 1%     35.0k ± 2%    ~     (p=0.310 n=5+5)
_invalidBody-2                25.5k ± 1%     25.3k ± 2%    ~     (p=0.571 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.92kB ± 0%    3.92kB ± 0%    ~     (p=1.000 n=5+5)
_directGzipHead-2            3.92kB ± 0%    3.92kB ± 0%    ~     (p=0.143 n=5+5)
_noDirectGzip-2              6.21kB ±19%    6.46kB ±16%    ~     (p=0.548 n=5+5)
_directGzip_decode-2          403kB ± 0%     403kB ± 0%    ~     (p=0.421 n=5+5)
_noDirectGzip_decode-2       5.77kB ±19%    5.75kB ± 6%    ~     (p=0.421 n=5+5)
_jsonBody-2                  13.2kB ± 0%    13.2kB ± 0%    ~     (p=0.111 n=5+5)
_jsonBodyValidation-2        19.0kB ± 0%    19.0kB ± 0%    ~     (p=0.437 n=5+5)
_outputHeaders-2             3.71kB ± 0%    3.71kB ± 0%    ~     (p=0.722 n=5+5)
_requestResponseMapping-2    16.7kB ± 0%    16.7kB ± 0%    ~     (p=0.056 n=5+5)
_validation-2                16.6kB ± 0%    16.6kB ± 0%    ~     (p=0.397 n=4+5)
_noValidation-2              7.88kB ± 0%    7.88kB ± 0%    ~     (p=0.079 n=5+5)
pkg:github.com/swaggest/rest/_examples/advanced-generic goos:linux goarch:amd64
_directGzip-2                3.94kB ± 0%    3.94kB ± 0%    ~     (p=0.984 n=5+5)
_directGzipHead-2            3.94kB ± 0%    3.94kB ± 0%  -0.05%  (p=0.048 n=5+5)
_noDirectGzip-2              6.67kB ±16%    6.84kB ±16%    ~     (p=1.000 n=5+5)
_directGzip_decode-2          403kB ± 0%     403kB ± 0%    ~     (p=0.151 n=5+5)
_noDirectGzip_decode-2       5.55kB ± 8%    5.40kB ± 7%    ~     (p=0.690 n=5+5)
_jsonBody-2                  13.3kB ± 0%    13.3kB ± 0%    ~     (p=0.881 n=5+5)
_jsonBodyValidation-2        19.1kB ± 0%    19.1kB ± 0%    ~     (p=0.460 n=5+5)
_outputHeaders-2             3.71kB ± 0%    3.71kB ± 0%  -0.11%  (p=0.048 n=5+5)
_requestResponseMapping-2    16.7kB ± 0%    16.7kB ± 0%    ~     (p=0.381 n=5+5)
_validation-2                16.6kB ± 0%    16.6kB ± 0%    ~     (p=0.810 n=5+5)
_noValidation-2              7.91kB ± 0%    7.91kB ± 0%    ~     (p=0.206 n=5+5)
pkg:github.com/swaggest/rest/_examples/task-api/internal/infra/nethttp goos:linux goarch:amd64
_notFoundSrv-2               4.88kB ± 0%    4.88kB ± 0%    ~     (p=0.603 n=5+5)
_ok-2                        4.78kB ± 0%    4.78kB ± 0%    ~     (p=0.143 n=4+4)
_invalidBody-2               8.67kB ± 0%    8.67kB ± 0%    ~     (p=0.971 n=4+4)

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                49.4 ± 3%      49.6 ± 3%    ~     (p=1.000 n=5+5)
_directGzip_decode-2            500 ± 0%       501 ± 0%  +0.20%  (p=0.029 n=4+4)
_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                  43.0 ± 0%      43.0 ± 0%    ~     (all equal)
_directGzipHead-2              43.0 ± 0%      43.0 ± 0%    ~     (all equal)
_noDirectGzip-2                50.6 ± 3%      50.6 ± 3%    ~     (p=1.000 n=5+5)
_directGzip_decode-2            502 ± 0%       502 ± 0%    ~     (p=0.444 n=5+5)
_noDirectGzip_decode-2         51.0 ± 0%      51.0 ± 0%    ~     (all equal)
_jsonBody-2                     131 ± 0%       131 ± 0%    ~     (all equal)
_jsonBodyValidation-2           187 ± 0%       187 ± 0%    ~     (all equal)
_outputHeaders-2               37.0 ± 0%      37.0 ± 0%    ~     (all equal)
_requestResponseMapping-2       127 ± 0%       127 ± 0%    ~     (all equal)
_validation-2                   156 ± 0%       156 ± 0%    ~     (all equal)
_noValidation-2                93.0 ± 0%      93.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 ± 0%       100 ± 0%    ~     (all equal)

@vearutop vearutop merged commit 35eaff5 into master Apr 20, 2022
@vearutop vearutop deleted the combine-err-resp branch April 20, 2022 08:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SetExpectedErrors allows only one error per status code
1 participant