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

Add control to forbid unknown params #72

Closed vearutop closed 2 years ago

vearutop commented 2 years ago

Resolves #68.

Unknown request parameters (not only in body) can be now forbidden with struct tags

    type helloInput struct {
        Locale string `query:"locale" default:"en-US" pattern:"^[a-z]{2}-[A-Z]{2}$" enum:"ru-RU,en-US"`
        Name   string `path:"name" minLength:"3"` // Field tags define parameter location and JSON schema constraints.

        // Field tags of unnamed fields are applied to parent schema.
        // they are optional and can be used to disallow unknown parameters.
        // For non-body params, name tag must be provided explicitly.
        // E.g. here no unknown `query` and `cookie` parameters allowed,
        // unknown `header` params are ok.
        _ struct{} `query:"_" cookie:"_" additionalProperties:"false"`
    }

or with an global interceptor

    // An example of global schema override to disable additionalProperties for all object schemas.
    s.OpenAPICollector.Reflector().DefaultOptions = append(s.OpenAPICollector.Reflector().DefaultOptions, func(rc *jsonschema.ReflectContext) {
        it := rc.InterceptType
        rc.InterceptType = func(value reflect.Value, schema *jsonschema.Schema) (bool, error) {
            stop, err := it(value, schema)
            if err != nil {
                return stop, err
            }

            // Allow unknown request headers and skip response.
            if oc, ok := openapi3.OperationCtx(rc); !ok ||
                oc.ProcessingResponse || oc.ProcessingIn == string(rest.ParamInHeader) {
                return stop, nil
            }

            if schema.HasType(jsonschema.Object) && len(schema.Properties) > 0 && schema.AdditionalProperties == nil {
                schema.AdditionalProperties = (&jsonschema.SchemaOrBool{}).WithTypeBoolean(false)
            }

            return stop, nil
        }
    })
github-actions[bot] commented 2 years ago

Lines Of Code

Language Files Lines Code Comments Blanks Complexity Bytes
Go 98 6542 (+80) 4750 (+60) 437 (+8) 1355 (+12) 750 (+20) 158.2K (+2K)
Go (test) 43 4417 (+49) 3392 (+37) 125 900 (+12) 118 123K (+1.5K)
JSON 3 1259 (-8) 1259 (-8) 0 0 0 51.7K (-38B)
Markdown 3 412 (+6) 318 (+5) 0 94 (+1) 0 14.3K (+290B)
YAML 10 675 592 46 37 0 20.9K (+3B)
github-actions[bot] commented 2 years ago

Go API Changes

# github.com/swaggest/rest/jsonschema
## compatible changes
(*Validator).ForbidUnknownParams: added

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

Unit Test Coverage

total: (statements) 82.8%

Coverage diff with base branch ```diff 39c39,40 < github.com/swaggest/rest/jsonschema/validator.go AddSchema 85.7% --- > github.com/swaggest/rest/jsonschema/validator.go ForbidUnknownParams 100.0% > github.com/swaggest/rest/jsonschema/validator.go AddSchema 90.9% 43c44 < github.com/swaggest/rest/jsonschema/validator.go ValidateData 92.0% --- > github.com/swaggest/rest/jsonschema/validator.go ValidateData 93.5% 85c86 < github.com/swaggest/rest/openapi/collector.go provideParametersJSONSchemas 83.3% --- > github.com/swaggest/rest/openapi/collector.go provideParametersJSONSchemas 72.7% 93c94 < github.com/swaggest/rest/request/decoder.go decodeValidate 80.0% --- > github.com/swaggest/rest/request/decoder.go decodeValidate 76.9% ```
codecov[bot] commented 2 years ago

Codecov Report

Merging #72 (7814063) into master (53f20ea) will increase coverage by 0.02%. The diff coverage is 69.56%.

@@            Coverage Diff             @@
##           master      #72      +/-   ##
==========================================
+ Coverage   76.81%   76.83%   +0.02%     
==========================================
  Files          27       27              
  Lines        1324     1347      +23     
==========================================
+ Hits         1017     1035      +18     
- Misses        194      199       +5     
  Partials      113      113              
Flag Coverage Δ
unittests 76.83% <69.56%> (+0.02%) :arrow_up:

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

Impacted Files Coverage Δ
openapi/collector.go 58.59% <0.00%> (-0.79%) :arrow_down:
request/decoder.go 70.21% <60.00%> (-2.77%) :arrow_down:
jsonschema/validator.go 79.79% <100.00%> (+4.51%) :arrow_up:

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

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.30µs ± 3% 1.31µs ± 3% ~ (p=0.310 n=5+5) pkg:github.com/swaggest/rest/request goos:linux goarch:amd64 Decoder_Decode-2 686ns ± 0% 698ns ± 2% +1.79% (p=0.016 n=4+5) DecoderFunc_Decode-2 1.99µs ± 2% 1.99µs ± 1% ~ (p=0.817 n=5+5) Decoder_Decode_json-2 22.2µs ± 3% 22.4µs ± 2% ~ (p=0.151 n=5+5) Decoder_Decode_queryObject-2 4.78µs ± 1% 4.83µs ± 1% ~ (p=0.222 n=5+5) Decoder_Decode_jsonParam-2 1.80µs ± 1% 1.82µs ± 1% +1.29% (p=0.016 n=5+5) DecoderFactory_SetDecoderFunc-2 1.64µs ± 0% 1.64µs ± 0% ~ (p=0.460 n=5+5) pkg:github.com/swaggest/rest/response/gzip goos:linux goarch:amd64 Middleware-2 11.1µs ± 1% 11.2µs ± 1% ~ (p=0.421 n=5+5) Middleware_control-2 3.22µs ± 2% 3.24µs ± 3% ~ (p=0.841 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.15kB ± 1% 1.17kB ± 4% ~ (p=0.460 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.31µs ± 3% pkg:github.com/swaggest/rest/request goos:linux goarch:amd64 Decoder_Decode-2 698ns ± 2% DecoderFunc_Decode-2 1.99µs ± 1% Decoder_Decode_json-2 22.4µs ± 2% Decoder_Decode_queryObject-2 4.83µs ± 1% Decoder_Decode_jsonParam-2 1.82µs ± 1% DecoderFactory_SetDecoderFunc-2 1.64µs ± 0% pkg:github.com/swaggest/rest/response/gzip goos:linux goarch:amd64 Middleware-2 11.2µs ± 1% Middleware_control-2 3.24µ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.17kB ± 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 43.4µs ± 3% 44.6µs ± 1% ~ (p=0.056 n=5+5) _directGzipHead-2 42.7µs ± 2% 44.2µs ± 1% +3.52% (p=0.008 n=5+5) _noDirectGzip-2 694µs ± 2% 189µs ± 1% -72.78% (p=0.008 n=5+5) _directGzip_decode-2 592µs ± 3% 598µs ± 1% ~ (p=0.421 n=5+5) _noDirectGzip_decode-2 701µs ± 1% 187µs ± 1% -73.34% (p=0.008 n=5+5) _jsonBody-2 73.0µs ± 2% 77.8µs ± 2% +6.54% (p=0.008 n=5+5) _jsonBodyValidation-2 81.9µs ± 1% 85.3µs ± 4% +4.13% (p=0.008 n=5+5) _outputHeaders-2 49.6µs ± 2% 43.0µs ± 2% -13.35% (p=0.008 n=5+5) _requestResponseMapping-2 71.3µs ± 2% 73.9µs ± 6% +3.67% (p=0.032 n=5+5) _validation-2 77.7µs ± 3% 80.2µs ± 1% +3.10% (p=0.032 n=5+5) _noValidation-2 64.3µs ± 1% 62.2µs ± 2% -3.26% (p=0.008 n=5+5) pkg:github.com/swaggest/rest/_examples/advanced-generic goos:linux goarch:amd64 _directGzip-2 42.8µs ± 1% 43.8µs ± 1% +2.37% (p=0.008 n=5+5) _directGzipHead-2 42.7µs ± 1% 43.4µs ± 1% +1.72% (p=0.016 n=5+5) _noDirectGzip-2 698µs ± 2% 188µs ± 0% -73.12% (p=0.008 n=5+5) _directGzip_decode-2 612µs ± 2% 603µs ± 2% ~ (p=0.222 n=5+5) _noDirectGzip_decode-2 698µs ± 1% 187µs ± 1% -73.20% (p=0.008 n=5+5) _jsonBody-2 79.0µs ±11% 76.6µs ± 1% ~ (p=0.151 n=5+5) _jsonBodyValidation-2 83.5µs ± 3% 85.4µs ± 2% ~ (p=0.095 n=5+5) _outputHeaders-2 48.8µs ± 1% 43.3µs ± 2% -11.15% (p=0.008 n=5+5) _requestResponseMapping-2 73.0µs ± 4% 73.6µs ± 1% ~ (p=1.000 n=5+5) _validation-2 78.5µs ± 3% 80.2µs ± 3% ~ (p=0.095 n=5+5) _noValidation-2 65.5µs ± 5% 61.0µs ± 2% -6.94% (p=0.008 n=5+5) pkg:github.com/swaggest/rest/_examples/task-api/internal/infra/nethttp goos:linux goarch:amd64 _notFoundSrv-2 47.1µs ± 2% 48.6µs ± 0% +3.11% (p=0.008 n=5+5) _ok-2 48.5µs ± 2% 49.4µs ± 1% +2.01% (p=0.032 n=5+5) _invalidBody-2 66.3µs ± 0% 67.8µs ± 1% +2.22% (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) _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 23.0k ± 2% 22.4k ± 1% ~ (p=0.056 n=5+5) _directGzipHead-2 23.4k ± 2% 22.6k ± 1% -3.41% (p=0.008 n=5+5) _noDirectGzip-2 1.44k ± 2% 5.30k ± 1% +267.33% (p=0.008 n=5+5) _directGzip_decode-2 1.69k ± 3% 1.67k ± 1% ~ (p=0.421 n=5+5) _noDirectGzip_decode-2 1.43k ± 1% 5.35k ± 1% +275.11% (p=0.008 n=5+5) _jsonBody-2 13.7k ± 2% 12.9k ± 2% -6.13% (p=0.008 n=5+5) _jsonBodyValidation-2 12.2k ± 1% 11.7k ± 4% -3.95% (p=0.008 n=5+5) _outputHeaders-2 20.1k ± 2% 23.3k ± 2% +15.39% (p=0.008 n=5+5) _requestResponseMapping-2 14.0k ± 2% 13.5k ± 5% -3.47% (p=0.032 n=5+5) _validation-2 12.9k ± 3% 12.5k ± 1% -3.03% (p=0.032 n=5+5) _noValidation-2 15.6k ± 1% 16.1k ± 2% +3.37% (p=0.008 n=5+5) pkg:github.com/swaggest/rest/_examples/advanced-generic goos:linux goarch:amd64 _directGzip-2 23.4k ± 1% 22.8k ± 1% -2.31% (p=0.008 n=5+5) _directGzipHead-2 23.4k ± 1% 23.0k ± 1% -1.69% (p=0.016 n=5+5) _noDirectGzip-2 1.43k ± 2% 5.33k ± 0% +272.48% (p=0.008 n=5+5) _directGzip_decode-2 1.63k ± 2% 1.66k ± 2% ~ (p=0.222 n=5+5) _noDirectGzip_decode-2 1.43k ± 1% 5.35k ± 1% +273.14% (p=0.008 n=5+5) _jsonBody-2 12.7k ±10% 13.0k ± 1% ~ (p=0.151 n=5+5) _jsonBodyValidation-2 12.0k ± 3% 11.7k ± 2% ~ (p=0.095 n=5+5) _outputHeaders-2 20.5k ± 1% 23.1k ± 2% +12.55% (p=0.008 n=5+5) _requestResponseMapping-2 13.7k ± 4% 13.6k ± 1% ~ (p=1.000 n=5+5) _validation-2 12.7k ± 2% 12.5k ± 3% ~ (p=0.095 n=5+5) _noValidation-2 15.3k ± 4% 16.4k ± 2% +7.40% (p=0.008 n=5+5) pkg:github.com/swaggest/rest/_examples/task-api/internal/infra/nethttp goos:linux goarch:amd64 _notFoundSrv-2 21.2k ± 2% 20.6k ± 0% -3.03% (p=0.008 n=5+5) _ok-2 20.6k ± 2% 20.2k ± 1% -1.98% (p=0.032 n=5+5) _invalidBody-2 15.1k ± 0% 14.8k ± 1% -2.17% (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.94kB ± 0% 3.94kB ± 0% ~ (p=0.222 n=5+5) _directGzipHead-2 3.94kB ± 0% 3.94kB ± 0% ~ (p=0.190 n=5+5) _noDirectGzip-2 387kB ± 1% 8kB ±17% -98.05% (p=0.008 n=5+5) _directGzip_decode-2 403kB ± 0% 403kB ± 0% ~ (p=0.841 n=5+5) _noDirectGzip_decode-2 384kB ± 1% 6kB ± 9% -98.57% (p=0.008 n=5+5) _jsonBody-2 13.2kB ± 0% 13.3kB ± 0% +0.39% (p=0.008 n=5+5) _jsonBodyValidation-2 19.0kB ± 0% 19.0kB ± 0% +0.26% (p=0.008 n=5+5) _outputHeaders-2 6.55kB ± 0% 3.72kB ± 0% -43.18% (p=0.008 n=5+5) _requestResponseMapping-2 16.7kB ± 0% 16.7kB ± 0% +0.30% (p=0.008 n=5+5) _validation-2 16.6kB ± 0% 16.6kB ± 0% +0.29% (p=0.008 n=5+5) _noValidation-2 11.0kB ± 0% 7.9kB ± 0% -28.47% (p=0.008 n=5+5) pkg:github.com/swaggest/rest/_examples/advanced-generic goos:linux goarch:amd64 _directGzip-2 3.95kB ± 0% 3.96kB ± 0% ~ (p=0.119 n=5+5) _directGzipHead-2 3.95kB ± 0% 3.95kB ± 0% ~ (p=0.317 n=5+5) _noDirectGzip-2 389kB ± 1% 7kB ±18% -98.15% (p=0.008 n=5+5) _directGzip_decode-2 403kB ± 0% 403kB ± 0% ~ (p=0.222 n=5+5) _noDirectGzip_decode-2 386kB ± 0% 6kB ± 7% -98.45% (p=0.008 n=5+5) _jsonBody-2 13.3kB ± 0% 13.4kB ± 0% +0.34% (p=0.008 n=5+5) _jsonBodyValidation-2 19.1kB ± 0% 19.1kB ± 0% +0.25% (p=0.008 n=5+5) _outputHeaders-2 6.55kB ± 0% 3.72kB ± 0% -43.16% (p=0.008 n=5+5) _requestResponseMapping-2 16.7kB ± 0% 16.7kB ± 0% +0.28% (p=0.008 n=5+5) _validation-2 16.6kB ± 0% 16.7kB ± 0% +0.27% (p=0.008 n=5+5) _noValidation-2 11.1kB ± 0% 7.9kB ± 0% -28.41% (p=0.008 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.556 n=5+5) _ok-2 4.79kB ± 0% 4.78kB ± 0% ~ (p=0.400 n=4+4) _invalidBody-2 8.78kB ± 4% 8.78kB ± 3% ~ (p=0.373 n=5+5) 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 894 ± 0% 51 ± 0% -94.30% (p=0.000 n=5+4) _directGzip_decode-2 501 ± 0% 501 ± 0% ~ (p=1.000 n=5+5) _noDirectGzip_decode-2 893 ± 0% 50 ± 0% -94.40% (p=0.008 n=5+5) _jsonBody-2 127 ± 0% 130 ± 0% +2.36% (p=0.008 n=5+5) _jsonBodyValidation-2 183 ± 0% 186 ± 0% +1.64% (p=0.008 n=5+5) _outputHeaders-2 49.0 ± 0% 37.0 ± 0% -24.49% (p=0.008 n=5+5) _requestResponseMapping-2 123 ± 0% 126 ± 0% +2.44% (p=0.008 n=5+5) _validation-2 152 ± 0% 155 ± 0% +1.97% (p=0.008 n=5+5) _noValidation-2 106 ± 0% 92 ± 0% -13.21% (p=0.008 n=5+5) 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 895 ± 0% 52 ± 0% -94.19% (p=0.029 n=4+4) _directGzip_decode-2 503 ± 0% 502 ± 0% ~ (p=0.095 n=5+4) _noDirectGzip_decode-2 897 ± 0% 51 ± 0% -94.31% (p=0.008 n=5+5) _jsonBody-2 128 ± 0% 131 ± 0% +2.34% (p=0.008 n=5+5) _jsonBodyValidation-2 184 ± 0% 187 ± 0% +1.63% (p=0.008 n=5+5) _outputHeaders-2 49.0 ± 0% 37.0 ± 0% -24.49% (p=0.008 n=5+5) _requestResponseMapping-2 124 ± 0% 127 ± 0% +2.42% (p=0.008 n=5+5) _validation-2 153 ± 0% 156 ± 0% +1.96% (p=0.008 n=5+5) _noValidation-2 107 ± 0% 93 ± 0% -13.08% (p=0.008 n=5+5) 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 101 ± 2% 101 ± 2% ~ (p=1.000 n=5+5) ```