Repository: swaggest/rest
Pull request #66 (2022-04-02 20:46:31)

Skip unexported fields in decoder

github-actions[bot]: ### Lines Of Code

| Language  | Files |   Lines   |   Code    | Comments |  Blanks   | Complexity |     Bytes      |
|-----------|-------|-----------|-----------|----------|-----------|------------|----------------|
| Go        | 96    | 6337 (+5) | 4585 (+3) | 439 (+1) | 1313 (+1) | 714 (+2)   | 154.8K (+68B)  |
| Go (test) | 43    | 4353 (+1) | 3337 (+1) | 132      | 884       | 118        | 121.3K (+104B) |
<!-- Sticky Pull Request CommentLOC -->
github-actions[bot]: ### Unit Test Coverage
total:	(statements)	82.8%
<details><summary>Coverage diff with base branch</summary>

```diff
104c104
< github.com/swaggest/rest/request/factory.go	jsonParams	83.3%
---
> github.com/swaggest/rest/request/factory.go	jsonParams	85.7%
```
</details>
<!-- Sticky Pull Request Commentunit-test -->
github-actions[bot]: ### Go API Changes

<pre>
# summary
Inferred base version: v0.2.24
Suggested version: v0.2.25
</pre>
<!-- Sticky Pull Request Commentgorelease -->
codecov[bot]: # [Codecov](https://codecov.io/gh/swaggest/rest/pull/66?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=swaggest) Report
> Merging [#66](https://codecov.io/gh/swaggest/rest/pull/66?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=swaggest) (d79678c) into [master](https://codecov.io/gh/swaggest/rest/commit/6d0e9150240a76ae5358b3b638b6fad0302eac94?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=swaggest) (6d0e915) will **increase** coverage by `0.03%`.
> The diff coverage is `100.00%`.

```diff
@@            Coverage Diff             @@
##           master      #66      +/-   ##
==========================================
+ Coverage   76.76%   76.79%   +0.03%     
==========================================
  Files          27       27              
  Lines        1321     1323       +2     
==========================================
+ Hits         1014     1016       +2     
  Misses        194      194              
  Partials      113      113              
```

| Flag | Coverage Δ | |
|---|---|---|
| unittests | `76.79% <100.00%> (+0.03%)` | :arrow_up: |

Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=swaggest#carryforward-flags-in-the-pull-request-comment) to find out more.

| [Impacted Files](https://codecov.io/gh/swaggest/rest/pull/66?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=swaggest) | Coverage Δ | |
|---|---|---|
| [request/factory.go](https://codecov.io/gh/swaggest/rest/pull/66/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=swaggest#diff-cmVxdWVzdC9mYWN0b3J5Lmdv) | `86.48% <100.00%> (+0.24%)` | :arrow_up: |

:mega: Codecov can now indicate which changes are the most critical in Pull Requests. [Learn more](https://about.codecov.io/product/feature/runtime-insights/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=swaggest)

github-actions[bot]: ### Benchmark Result
<details><summary>Benchmark diff with base branch</summary>

```
name                                    old time/op    new time/op    delta
pkg:github.com/swaggest/rest/jsonschema goos:linux goarch:amd64
RequestValidator_ValidateRequestData-2    1.52µs ± 1%    1.54µs ± 1%  +1.46%  (p=0.032 n=5+5)
pkg:github.com/swaggest/rest/request goos:linux goarch:amd64
Decoder_Decode-2                           827ns ± 1%     849ns ± 7%  +2.63%  (p=0.032 n=5+5)
DecoderFunc_Decode-2                      2.46µs ± 2%    2.43µs ± 2%    ~     (p=0.206 n=5+5)
Decoder_Decode_json-2                     26.9µs ± 2%    26.7µs ± 2%    ~     (p=0.548 n=5+5)
Decoder_Decode_queryObject-2              5.74µs ± 1%    5.80µs ± 1%    ~     (p=0.063 n=5+5)
Decoder_Decode_jsonParam-2                2.10µs ± 1%    2.11µs ± 1%    ~     (p=1.000 n=5+5)
DecoderFactory_SetDecoderFunc-2           1.98µs ± 1%    1.98µs ± 2%    ~     (p=0.841 n=5+5)
pkg:github.com/swaggest/rest/response/gzip goos:linux goarch:amd64
Middleware-2                              13.8µs ± 1%    13.7µs ± 1%    ~     (p=0.222 n=5+5)
Middleware_control-2                      3.77µs ± 1%    3.73µs ± 2%    ~     (p=0.190 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.14kB ± 1%    1.14kB ± 2%    ~     (p=0.841 n=4+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)
```
</details>

<details><summary>Benchmark result</summary>

```
name                                    time/op
pkg:github.com/swaggest/rest/jsonschema goos:linux goarch:amd64
RequestValidator_ValidateRequestData-2  1.54µs ± 1%
pkg:github.com/swaggest/rest/request goos:linux goarch:amd64
Decoder_Decode-2                         849ns ± 7%
DecoderFunc_Decode-2                    2.43µs ± 2%
Decoder_Decode_json-2                   26.7µs ± 2%
Decoder_Decode_queryObject-2            5.80µs ± 1%
Decoder_Decode_jsonParam-2              2.11µs ± 1%
DecoderFactory_SetDecoderFunc-2         1.98µs ± 2%
pkg:github.com/swaggest/rest/response/gzip goos:linux goarch:amd64
Middleware-2                            13.7µs ± 1%
Middleware_control-2                    3.73µ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 ± 2%
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%
```
</details>
<!-- Sticky Pull Request Commentbench -->
github-actions[bot]: ### Examples Benchmark Result
<details><summary>Benchmark diff with base branch</summary>

```
name                       old time/op    new time/op    delta
pkg:github.com/swaggest/rest/_examples/advanced goos:linux goarch:amd64
_directGzip-2                40.1µs ± 1%    36.5µs ± 2%   -8.87%  (p=0.016 n=4+5)
_directGzipHead-2            42.2µs ±10%    38.5µs ±13%     ~     (p=0.095 n=5+5)
_noDirectGzip-2               188µs ± 7%     172µs ± 3%   -8.45%  (p=0.016 n=5+5)
_directGzip_decode-2          534µs ± 5%     541µs ± 8%     ~     (p=0.841 n=5+5)
_noDirectGzip_decode-2        188µs ± 4%     167µs ± 1%  -11.01%  (p=0.008 n=5+5)
_jsonBody-2                  69.5µs ± 4%    63.1µs ± 2%   -9.31%  (p=0.008 n=5+5)
_jsonBodyValidation-2        71.0µs ± 2%    78.2µs ± 6%  +10.14%  (p=0.008 n=5+5)
_outputHeaders-2             37.4µs ± 5%    39.3µs ± 4%     ~     (p=0.222 n=5+5)
_requestResponseMapping-2    64.3µs ± 3%    66.4µs ± 6%     ~     (p=0.310 n=5+5)
_validation-2                69.8µs ± 4%    72.6µs ± 7%     ~     (p=0.222 n=5+5)
_noValidation-2              49.2µs ± 2%    52.7µs ±10%   +6.97%  (p=0.008 n=5+5)
pkg:github.com/swaggest/rest/_examples/advanced-generic goos:linux goarch:amd64
_directGzip-2                39.9µs ±12%    40.4µs ±12%     ~     (p=0.690 n=5+5)
_directGzipHead-2            37.2µs ± 3%    37.9µs ± 3%     ~     (p=0.310 n=5+5)
_noDirectGzip-2               180µs ± 4%     179µs ± 4%     ~     (p=1.000 n=5+5)
_directGzip_decode-2          543µs ± 4%     509µs ± 2%   -6.17%  (p=0.008 n=5+5)
_noDirectGzip_decode-2        181µs ±15%     179µs ± 4%     ~     (p=0.841 n=5+5)
_jsonBody-2                  70.2µs ± 7%    68.5µs ± 6%     ~     (p=0.548 n=5+5)
_jsonBodyValidation-2        70.7µs ± 3%    70.3µs ± 2%     ~     (p=0.841 n=5+5)
_outputHeaders-2             37.7µs ± 3%    36.7µs ± 6%     ~     (p=0.222 n=5+5)
_requestResponseMapping-2    61.0µs ± 3%    63.7µs ± 4%   +4.40%  (p=0.032 n=5+5)
_validation-2                69.9µs ± 3%    66.7µs ± 2%   -4.54%  (p=0.008 n=5+5)
_noValidation-2              68.1µs ± 6%    70.4µs ± 9%     ~     (p=0.548 n=5+5)
pkg:github.com/swaggest/rest/_examples/task-api/internal/infra/nethttp goos:linux goarch:amd64
_notFoundSrv-2               44.8µs ±13%    45.6µs ± 9%     ~     (p=0.841 n=5+5)
_ok-2                        43.8µs ± 2%    44.1µs ± 4%     ~     (p=0.841 n=5+5)
_invalidBody-2               60.2µs ± 1%    63.0µs ± 6%     ~     (p=0.095 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%     ~     (p=1.000 n=5+5)
_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                 24.9k ± 1%     27.4k ± 2%   +9.73%  (p=0.016 n=4+5)
_directGzipHead-2             23.8k ±10%     26.1k ±12%     ~     (p=0.095 n=5+5)
_noDirectGzip-2               5.33k ± 7%     5.82k ± 3%   +9.10%  (p=0.016 n=5+5)
_directGzip_decode-2          1.88k ± 5%     1.85k ± 8%     ~     (p=0.802 n=5+5)
_noDirectGzip_decode-2        5.33k ± 4%     5.99k ± 1%  +12.32%  (p=0.008 n=5+5)
_jsonBody-2                   14.4k ± 4%     15.9k ± 2%  +10.21%  (p=0.008 n=5+5)
_jsonBodyValidation-2         14.1k ± 2%     12.8k ± 6%   -9.07%  (p=0.008 n=5+5)
_outputHeaders-2              26.8k ± 5%     25.5k ± 4%     ~     (p=0.222 n=5+5)
_requestResponseMapping-2     15.6k ± 3%     15.1k ± 6%     ~     (p=0.310 n=5+5)
_validation-2                 14.3k ± 5%     13.8k ± 8%     ~     (p=0.222 n=5+5)
_noValidation-2               20.3k ± 2%     19.0k ± 9%   -6.33%  (p=0.008 n=5+5)
pkg:github.com/swaggest/rest/_examples/advanced-generic goos:linux goarch:amd64
_directGzip-2                 25.1k ±11%     24.9k ±11%     ~     (p=0.690 n=5+5)
_directGzipHead-2             26.9k ± 3%     26.4k ± 3%     ~     (p=0.310 n=5+5)
_noDirectGzip-2               5.58k ± 4%     5.60k ± 4%     ~     (p=1.000 n=5+5)
_directGzip_decode-2          1.84k ± 4%     1.96k ± 2%   +6.53%  (p=0.008 n=5+5)
_noDirectGzip_decode-2        5.56k ±14%     5.59k ± 4%     ~     (p=0.841 n=5+5)
_jsonBody-2                   14.3k ± 7%     14.6k ± 6%     ~     (p=0.548 n=5+5)
_jsonBodyValidation-2         14.1k ± 3%     14.2k ± 2%     ~     (p=0.841 n=5+5)
_outputHeaders-2              26.5k ± 3%     27.3k ± 6%     ~     (p=0.222 n=5+5)
_requestResponseMapping-2     16.4k ± 3%     15.7k ± 4%   -4.21%  (p=0.032 n=5+5)
_validation-2                 14.3k ± 3%     15.0k ± 2%   +4.73%  (p=0.008 n=5+5)
_noValidation-2               14.7k ± 6%     14.2k ± 8%     ~     (p=0.548 n=5+5)
pkg:github.com/swaggest/rest/_examples/task-api/internal/infra/nethttp goos:linux goarch:amd64
_notFoundSrv-2                22.4k ±12%     22.0k ± 9%     ~     (p=0.841 n=5+5)
_ok-2                         22.8k ± 2%     22.7k ± 4%     ~     (p=0.841 n=5+5)
_invalidBody-2                16.6k ± 1%     15.9k ± 6%     ~     (p=0.095 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.93kB ± 0%    3.93kB ± 0%   -0.07%  (p=0.040 n=5+5)
_directGzipHead-2            3.93kB ± 0%    3.93kB ± 0%     ~     (p=0.071 n=5+5)
_noDirectGzip-2              7.21kB ±28%    6.30kB ±19%     ~     (p=0.222 n=5+5)
_directGzip_decode-2          402kB ± 0%     402kB ± 0%     ~     (p=0.421 n=5+5)
_noDirectGzip_decode-2       5.63kB ±15%    5.13kB ± 7%     ~     (p=0.222 n=5+5)
_jsonBody-2                  13.2kB ± 0%    13.2kB ± 0%   -0.06%  (p=0.040 n=5+5)
_jsonBodyValidation-2        19.0kB ± 0%    19.0kB ± 0%     ~     (p=0.730 n=5+5)
_outputHeaders-2             3.72kB ± 0%    3.71kB ± 0%     ~     (p=1.000 n=5+5)
_requestResponseMapping-2    16.7kB ± 0%    16.7kB ± 0%     ~     (p=1.000 n=5+5)
_validation-2                16.6kB ± 0%    16.6kB ± 0%   +0.10%  (p=0.040 n=5+5)
_noValidation-2              6.13kB ± 0%    6.13kB ± 0%     ~     (p=1.000 n=5+5)
pkg:github.com/swaggest/rest/_examples/advanced-generic goos:linux goarch:amd64
_directGzip-2                3.95kB ± 0%    3.95kB ± 0%   +0.06%  (p=0.040 n=5+5)
_directGzipHead-2            3.95kB ± 0%    3.95kB ± 0%     ~     (p=0.857 n=5+5)
_noDirectGzip-2              6.67kB ±24%    6.90kB ±15%     ~     (p=1.000 n=5+5)
_directGzip_decode-2          402kB ± 0%     402kB ± 0%     ~     (p=0.310 n=5+5)
_noDirectGzip_decode-2       5.35kB ± 2%    5.31kB ± 5%     ~     (p=0.690 n=5+5)
_jsonBody-2                  13.3kB ± 0%    13.3kB ± 0%     ~     (p=0.635 n=5+5)
_jsonBodyValidation-2        19.0kB ± 0%    19.0kB ± 0%     ~     (p=0.984 n=5+5)
_outputHeaders-2             3.72kB ± 0%    3.72kB ± 0%     ~     (p=0.103 n=5+5)
_requestResponseMapping-2    16.7kB ± 0%    16.7kB ± 0%     ~     (p=0.651 n=5+5)
_validation-2                16.6kB ± 0%    16.6kB ± 0%     ~     (p=0.175 n=5+5)
_noValidation-2              16.6kB ± 0%    16.6kB ± 0%     ~     (p=0.286 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.825 n=5+5)
_ok-2                        4.79kB ± 0%    4.79kB ± 0%     ~     (p=0.829 n=4+4)
_invalidBody-2               8.77kB ± 4%    8.79kB ± 3%     ~     (p=0.548 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                51.0 ± 0%      50.0 ± 4%     ~     (p=0.333 n=4+5)
_directGzip_decode-2            500 ± 0%       500 ± 0%     ~     (all equal)
_noDirectGzip_decode-2         50.0 ± 0%      50.0 ± 0%     ~     (all equal)
_jsonBody-2                     127 ± 0%       127 ± 0%     ~     (all equal)
_jsonBodyValidation-2           183 ± 0%       183 ± 0%     ~     (all equal)
_outputHeaders-2               37.0 ± 0%      37.0 ± 0%     ~     (all equal)
_requestResponseMapping-2       123 ± 0%       123 ± 0%     ~     (all equal)
_validation-2                   152 ± 0%       152 ± 0%     ~     (all equal)
_noValidation-2                72.0 ± 0%      72.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                51.0 ± 4%      52.0 ± 0%     ~     (p=0.556 n=5+4)
_directGzip_decode-2            501 ± 0%       501 ± 0%     ~     (p=0.397 n=5+5)
_noDirectGzip_decode-2         51.0 ± 0%      51.0 ± 0%     ~     (all equal)
_jsonBody-2                     128 ± 0%       128 ± 0%     ~     (all equal)
_jsonBodyValidation-2           184 ± 0%       184 ± 0%     ~     (all equal)
_outputHeaders-2               37.0 ± 0%      37.0 ± 0%     ~     (all equal)
_requestResponseMapping-2       124 ± 0%       124 ± 0%     ~     (all equal)
_validation-2                   153 ± 0%       153 ± 0%     ~     (all equal)
_noValidation-2                 153 ± 0%       153 ± 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%       101 ± 2%     ~     (p=0.556 n=4+5)
```
</details>
<!-- Sticky Pull Request Commentbench-examples -->

Patch:
diff --git a/.golangci.yml b/.golangci.yml
index 1ba5968..1c5f71c 100644
--- a/.golangci.yml
+++ b/.golangci.yml
@@ -50,5 +50,7 @@ issues:
         - noctx
         - funlen
         - dupl
+        - structcheck
+        - unused
       path: "_test.go"
 
diff --git a/request/factory.go b/request/factory.go
index 9bc9f8b..7205882 100644
--- a/request/factory.go
+++ b/request/factory.go
@@ -200,6 +200,11 @@ func (df *DecoderFactory) prepareCustomMapping(input interface{}, customMapping
 func (df *DecoderFactory) jsonParams(formDecoder *form.Decoder, in rest.ParamIn, input interface{}) {
 	// Check fields for struct values with json tags. E.g. query parameter with json value.
 	refl.WalkTaggedFields(reflect.ValueOf(input), func(v reflect.Value, sf reflect.StructField, tag string) {
+		// Skip unexported fields.
+		if sf.PkgPath != "" {
+			return
+		}
+
 		fieldVal := v.Interface()
 
 		if refl.HasTaggedFields(fieldVal, jsonTag) {


Test patch:
diff --git a/request/factory_test.go b/request/factory_test.go
index b2151cd..d7e05db 100644
--- a/request/factory_test.go
+++ b/request/factory_test.go
@@ -117,8 +117,9 @@ func BenchmarkDecoderFactory_SetDecoderFunc(b *testing.B) {
 
 func TestDecoderFactory_MakeDecoder_default(t *testing.T) {
 	type MyInput struct {
-		ID   int    `query:"id" default:"123"`
-		Name string `header:"X-Name" default:"foo"`
+		ID         int    `query:"id" default:"123"`
+		Name       string `header:"X-Name" default:"foo"`
+		unexported bool   `query:"unexported"` // This field is skipped because it is unexported.
 	}
 
 	df := request.NewDecoderFactory()