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

Check reflect value kind before iterating #76

Closed vearutop closed 1 year ago

github-actions[bot] commented 1 year ago

Lines Of Code

Language Files Lines Code Comments Blanks Complexity Bytes
Go 6 1933 (+2) 1315 (+2) 219 399 521 (+2) 46.9K (+40B)
github-actions[bot] commented 1 year ago

Go API Changes

# summary
Inferred base version: v0.3.46
Suggested version: v0.3.47
github-actions[bot] commented 1 year ago

Unit Test Coverage

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

Coverage of changed lines | File | Function | Coverage | |----------------|------------|----------| | Total | | 100.0% | | reflect.go | | 100.0% | | reflect.go:632 | kindSwitch | 100.0% |
Coverage diff with base branch | File | Function | Base Coverage | Current Coverage | |----------------------------------------------|------------|---------------|------------------| | Total | | 79.1% | 79.1% (0.0%) | | github.com/swaggest/jsonschema-go/reflect.go | kindSwitch | 90.2% | 90.4% (+0.2%) |
codecov[bot] commented 1 year ago

Codecov Report

Merging #76 (86af65b) into master (38f7c5b) will increase coverage by 0.02%. The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master      #76      +/-   ##
==========================================
+ Coverage   73.30%   73.33%   +0.02%     
==========================================
  Files           6        6              
  Lines        1064     1065       +1     
==========================================
+ Hits          780      781       +1     
  Misses        216      216              
  Partials       68       68              
Flag Coverage Δ
unittests 73.33% <100.00%> (+0.02%) :arrow_up:

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

Impacted Files Coverage Δ
reflect.go 82.29% <100.00%> (+0.03%) :arrow_up:

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

github-actions[bot] commented 1 year ago

Benchmark Result

Benchmark diff with base branch ``` name old time/op new time/op delta Schema_UnmarshalJSON_raw-2 72.5µs ± 0% 72.4µs ± 0% ~ (p=0.421 n=5+5) Schema_UnmarshalJSON-2 593µs ± 0% 596µs ± 1% ~ (p=0.052 n=5+6) Schema_MarshalJSON_raw-2 71.4µs ± 1% 71.5µs ± 0% ~ (p=0.429 n=6+5) Schema_MarshalJSON-2 240µs ± 1% 239µs ± 0% ~ (p=0.937 n=6+6) name old alloc/op new alloc/op delta Schema_UnmarshalJSON_raw-2 31.7kB ± 0% 31.7kB ± 0% ~ (p=0.294 n=5+6) Schema_UnmarshalJSON-2 184kB ± 0% 184kB ± 0% ~ (p=0.545 n=6+5) Schema_MarshalJSON_raw-2 21.9kB ± 0% 21.9kB ± 0% ~ (p=0.242 n=6+5) Schema_MarshalJSON-2 55.3kB ± 0% 55.3kB ± 0% ~ (p=0.571 n=5+4) 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 72.4µs ± 0% Schema_UnmarshalJSON-2 596µs ± 1% Schema_MarshalJSON_raw-2 71.5µs ± 0% Schema_MarshalJSON-2 239µ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% ```