swaggest / jsonschema-go

JSON Schema mapping for Go
https://pkg.go.dev/github.com/swaggest/jsonschema-go
MIT License
112 stars 14 forks source link

Add control to skip unsupported properties during reflection #55

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 6 1765 (+28) 1205 (+7) 192 (+18) 368 (+3) 474 (+1) 42.2K (+712B)
Go (test) 11 2364 (+21) 1712 (+17) 268 384 (+4) 43 60.4K (+517B)
github-actions[bot] commented 2 years ago

Unit Test Coverage

total: (statements) 77.5% changed lines: (statements) 100.0%

Coverage of changed lines | File | Function | Coverage | |----------------|---------------------------|----------| | Total | | 100.0% | | context.go | | 100.0% | | context.go:131 | SkipUnsupportedProperties | 100.0% | | reflect.go | | 100.0% | | reflect.go:599 | kindSwitch | 100.0% |
Coverage diff with base branch | File | Function | Base Coverage | Current Coverage | |----------------------------------------------|---------------------------|---------------|------------------| | Total | | 77.2% | 77.5% (+0.3%) | | github.com/swaggest/jsonschema-go/context.go | SkipUnsupportedProperties | no function | 100.0% | | github.com/swaggest/jsonschema-go/reflect.go | kindSwitch | 87.2% | 87.8% (+0.6%) | | github.com/swaggest/jsonschema-go/reflect.go | walkProperties | 85.0% | 87.5% (+2.5%) |
github-actions[bot] commented 2 years ago

Go API Changes

# github.com/swaggest/jsonschema-go
## compatible changes
ReflectContext.SkipUnsupportedProperties: added
SkipUnsupportedProperties: added

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

Benchmark Result

Benchmark diff with base branch ``` name old time/op new time/op delta Schema_UnmarshalJSON_raw-2 73.9µs ± 1% 73.7µs ± 0% ~ (p=0.905 n=5+4) Schema_UnmarshalJSON-2 596µs ± 0% 600µs ± 0% +0.68% (p=0.016 n=4+5) Schema_MarshalJSON_raw-2 70.4µs ± 0% 71.1µs ± 0% +1.00% (p=0.008 n=5+5) Schema_MarshalJSON-2 244µs ± 1% 245µs ± 0% ~ (p=0.056 n=5+5) name old alloc/op new alloc/op delta Schema_UnmarshalJSON_raw-2 31.7kB ± 0% 31.7kB ± 0% ~ (p=0.762 n=5+5) Schema_UnmarshalJSON-2 184kB ± 0% 184kB ± 0% ~ (all equal) Schema_MarshalJSON_raw-2 21.9kB ± 0% 21.9kB ± 0% ~ (p=0.079 n=5+5) Schema_MarshalJSON-2 55.3kB ± 0% 55.3kB ± 0% ~ (p=0.333 n=5+5) name old allocs/op new allocs/op delta Schema_UnmarshalJSON_raw-2 457 ± 0% 457 ± 0% ~ (all equal) Schema_UnmarshalJSON-2 2.00k ± 0% 2.00k ± 0% ~ (all equal) Schema_MarshalJSON_raw-2 484 ± 0% 484 ± 0% ~ (all equal) Schema_MarshalJSON-2 477 ± 0% 477 ± 0% ~ (all equal) ```
Benchmark result ``` name time/op Schema_UnmarshalJSON_raw-2 73.7µs ± 0% Schema_UnmarshalJSON-2 600µs ± 0% Schema_MarshalJSON_raw-2 71.1µs ± 0% Schema_MarshalJSON-2 245µs ± 0% name alloc/op Schema_UnmarshalJSON_raw-2 31.7kB ± 0% Schema_UnmarshalJSON-2 184kB ± 0% Schema_MarshalJSON_raw-2 21.9kB ± 0% Schema_MarshalJSON-2 55.3kB ± 0% name allocs/op Schema_UnmarshalJSON_raw-2 457 ± 0% Schema_UnmarshalJSON-2 2.00k ± 0% Schema_MarshalJSON_raw-2 484 ± 0% Schema_MarshalJSON-2 477 ± 0% ```
codecov[bot] commented 2 years ago

Codecov Report

Merging #55 (17f2e23) into master (917967d) will increase coverage by 0.48%. The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master      #55      +/-   ##
==========================================
+ Coverage   71.22%   71.71%   +0.48%     
==========================================
  Files           6        6              
  Lines        1001     1004       +3     
==========================================
+ Hits          713      720       +7     
+ Misses        221      218       -3     
+ Partials       67       66       -1     
Flag Coverage Δ
unittests 71.71% <100.00%> (+0.48%) :arrow_up:

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

Impacted Files Coverage Δ
context.go 67.44% <100.00%> (+0.77%) :arrow_up:
reflect.go 80.27% <100.00%> (+0.87%) :arrow_up:

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more