swaggest / jsonschema-go

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

Fix handling of embedded virtual struct #94

Closed vearutop closed 10 months ago

github-actions[bot] commented 10 months ago

Lines Of Code

Language Files Lines Code Comments Blanks Complexity Bytes
Go 7 2235 (+8) 1512 (+6) 264 459 (+2) 577 (+2) 54.1K (+130B)
Go (test) 13 3184 (+138) 2329 (+116) 305 (-2) 550 (+24) 48 79.9K (+3K)
github-actions[bot] commented 10 months ago

Unit Test Coverage

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

Coverage of changed lines | File | Function | Coverage | |----------------|-----------|----------| | Total | | 100.0% | | reflect.go | | 100.0% | | reflect.go:371 | reflect | 100.0% | | struct.go | | 100.0% | | struct.go:45 | structPtr | 100.0% | | struct.go:49 | names | 100.0% |
Coverage diff with base branch | File | Function | Base Coverage | Current Coverage | |---------------------------------------------|-----------|---------------|------------------| | Total | | 78.8% | 78.8% (0.0%) | | github.com/swaggest/jsonschema-go/struct.go | structPtr | no function | 100.0% |
codecov[bot] commented 10 months ago

Codecov Report

Merging #94 (51414d9) into master (34ecc32) will increase coverage by 0.02%. The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master      #94      +/-   ##
==========================================
+ Coverage   73.95%   73.97%   +0.02%     
==========================================
  Files           7        7              
  Lines        1167     1168       +1     
==========================================
+ Hits          863      864       +1     
  Misses        237      237              
  Partials       67       67              
Flag Coverage Δ
unittests 73.97% <100.00%> (+0.02%) :arrow_up:

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

Files Changed Coverage Δ
reflect.go 84.15% <100.00%> (ø)
struct.go 100.00% <100.00%> (ø)

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

github-actions[bot] commented 10 months ago

Go API Changes

# summary
Inferred base version: v0.3.58
Suggested version: v0.3.59
github-actions[bot] commented 10 months ago

Benchmark Result

Benchmark diff with base branch ``` Module github.com/bool64/dev not found, downloading. name old time/op new time/op delta Schema_UnmarshalJSON_raw-2 102µs ± 3% 102µs ± 2% ~ (p=1.000 n=6+6) Schema_UnmarshalJSON-2 773µs ± 1% 767µs ± 2% ~ (p=0.240 n=6+6) Schema_MarshalJSON_raw-2 93.2µs ± 1% 93.9µs ± 0% ~ (p=0.093 n=6+6) Schema_MarshalJSON-2 300µs ± 4% 291µs ± 3% -3.20% (p=0.041 n=6+6) name old alloc/op new alloc/op delta Schema_UnmarshalJSON_raw-2 31.7kB ± 0% 31.7kB ± 0% ~ (p=0.212 n=6+6) Schema_UnmarshalJSON-2 184kB ± 0% 184kB ± 0% ~ (p=1.000 n=6+6) Schema_MarshalJSON_raw-2 21.9kB ± 0% 21.9kB ± 0% ~ (all equal) Schema_MarshalJSON-2 55.3kB ± 0% 55.3kB ± 0% ~ (p=0.987 n=6+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 102µs ± 2% Schema_UnmarshalJSON-2 767µs ± 2% Schema_MarshalJSON_raw-2 93.9µs ± 0% Schema_MarshalJSON-2 291µs ± 3% 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% ```