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

Inline trivial scalar schemas without making definitions #85

Closed vearutop closed 1 year ago

vearutop commented 1 year ago

Related to https://github.com/swaggest/rest/issues/161.

github-actions[bot] commented 1 year ago

Lines Of Code

Language Files Lines Code Comments Blanks Complexity Bytes
Go 6 2100 (+5) 1417 (+3) 254 (+1) 429 (+1) 547 (+5) 51.2K (+157B)
Go (test) 12 2780 (+51) 2009 (+36) 289 (+5) 482 (+10) 48 70.8K (+1.8K)
github-actions[bot] commented 1 year ago

Go API Changes

gorelease: go: updates to go.sum needed, disabled by -mod=readonly
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 73.0µs ± 1% 73.2µs ± 0% ~ (p=0.537 n=5+6) Schema_UnmarshalJSON-2 585µs ± 0% 587µs ± 1% ~ (p=0.126 n=5+6) Schema_MarshalJSON_raw-2 70.6µs ± 0% 70.8µs ± 0% +0.32% (p=0.017 n=5+6) Schema_MarshalJSON-2 234µs ± 0% 237µs ± 2% ~ (p=0.394 n=6+6) name old alloc/op new alloc/op delta Schema_UnmarshalJSON_raw-2 31.7kB ± 0% 31.7kB ± 0% ~ (p=0.846 n=6+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.675 n=6+6) Schema_MarshalJSON-2 55.3kB ± 0% 55.3kB ± 0% ~ (p=0.846 n=6+6) 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.2µs ± 0% Schema_UnmarshalJSON-2 587µs ± 1% Schema_MarshalJSON_raw-2 70.8µs ± 0% Schema_MarshalJSON-2 237µs ± 2% 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% ```
github-actions[bot] commented 1 year ago

Unit Test Coverage

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

Coverage of changed lines | File | Function | Coverage | |----------------|--------------|----------| | Total | | 100.0% | | reflect.go | | 100.0% | | reflect.go:296 | reflectDefer | 100.0% |
Coverage diff with base branch | File | Function | Base Coverage | Current Coverage | |----------------------------------------------|--------------|---------------|------------------| | Total | | 78.1% | 78.1% (0.0%) | | github.com/swaggest/jsonschema-go/reflect.go | reflectDefer | 96.2% | 96.4% (+0.2%) |
codecov[bot] commented 1 year ago

Codecov Report

Merging #85 (271f3c1) into master (a0dc9b7) will increase coverage by 0.04%. The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master      #85      +/-   ##
==========================================
+ Coverage   72.90%   72.95%   +0.04%     
==========================================
  Files           6        6              
  Lines        1122     1124       +2     
==========================================
+ Hits          818      820       +2     
  Misses        235      235              
  Partials       69       69              
Flag Coverage Δ
unittests 72.95% <100.00%> (+0.04%) :arrow_up:

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

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

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