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

Optionally expose embedded structs with allOf #107

Closed vearutop closed 4 months ago

vearutop commented 4 months ago

Related to https://github.com/swaggest/jsonschema-go/discussions/105.

github-actions[bot] commented 4 months ago

Lines Of Code

Language Files Lines Code Comments Blanks Complexity Bytes
Go 7 2338 (+22) 1581 (+13) 275 (+5) 482 (+4) 615 (+7) 56.5K (+851B)
Go (test) 13 3396 (+33) 2503 (+28) 308 585 (+5) 51 85.4K (+749B)
YAML 6 498 (+1) 412 (+1) 36 50 0 16.4K (+15B)
github-actions[bot] commented 4 months ago

Unit Test Coverage

total: (statements) 79.0% changed lines: (statements) 77.8%, coverage is less than 90.0%, consider testing the changes more thoroughly

Coverage of changed lines | File | Function | Coverage | |----------------|----------------|----------| | Total | | 77.8% | | reflect.go | | 77.8% | | reflect.go:912 | walkProperties | 93.1% |
Coverage diff with base branch | File | Function | Base Coverage | Current Coverage | |------------|----------------|---------------|------------------| | Total | | 79.0% | 79.0% (0.0%) | | reflect.go | walkProperties | 84.8% | 84.9% (+0.1%) |
github-actions[bot] commented 4 months ago

Go API Changes

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

# summary
Inferred base version: v0.3.64
Suggested version: v0.4.0
codecov[bot] commented 4 months ago

Codecov Report

Attention: Patch coverage is 66.66667% with 3 lines in your changes are missing coverage. Please review.

Project coverage is 73.99%. Comparing base (04e0738) to head (55eb02f).

Files Patch % Lines
reflect.go 66.66% 1 Missing and 2 partials :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #107 +/- ## ======================================= Coverage 73.98% 73.99% ======================================= Files 7 7 Lines 1207 1215 +8 ======================================= + Hits 893 899 +6 - Misses 243 244 +1 - Partials 71 72 +1 ``` | [Flag](https://app.codecov.io/gh/swaggest/jsonschema-go/pull/107/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=swaggest) | Coverage Δ | | |---|---|---| | [unittests](https://app.codecov.io/gh/swaggest/jsonschema-go/pull/107/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=swaggest) | `73.99% <66.66%> (+<0.01%)` | :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.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

github-actions[bot] commented 4 months ago

Benchmark Result

Benchmark diff with base branch ``` name old time/op new time/op delta Schema_UnmarshalJSON_raw-4 60.5µs ± 1% 61.3µs ± 1% +1.40% (p=0.017 n=5+6) Schema_UnmarshalJSON-4 486µs ± 0% 486µs ± 0% ~ (p=0.394 n=6+6) Schema_MarshalJSON_raw-4 43.3µs ± 1% 44.0µs ± 1% +1.49% (p=0.004 n=5+6) Schema_MarshalJSON-4 185µs ± 0% 186µs ± 1% ~ (p=0.329 n=5+6) name old alloc/op new alloc/op delta Schema_UnmarshalJSON_raw-4 31.7kB ± 0% 31.7kB ± 0% ~ (p=0.563 n=6+6) Schema_UnmarshalJSON-4 180kB ± 0% 180kB ± 0% ~ (all equal) Schema_MarshalJSON_raw-4 14.6kB ± 0% 14.6kB ± 0% ~ (p=0.567 n=6+6) Schema_MarshalJSON-4 53.9kB ± 0% 53.9kB ± 0% ~ (p=0.054 n=6+6) name old allocs/op new allocs/op delta Schema_UnmarshalJSON_raw-4 457 ± 0% 457 ± 0% ~ (all equal) Schema_UnmarshalJSON-4 1.85k ± 0% 1.85k ± 0% ~ (all equal) Schema_MarshalJSON_raw-4 370 ± 0% 370 ± 0% ~ (all equal) Schema_MarshalJSON-4 468 ± 0% 468 ± 0% ~ (all equal) ```
Benchmark result ``` name time/op Schema_UnmarshalJSON_raw-4 61.3µs ± 1% Schema_UnmarshalJSON-4 486µs ± 0% Schema_MarshalJSON_raw-4 44.0µs ± 1% Schema_MarshalJSON-4 186µs ± 1% name alloc/op Schema_UnmarshalJSON_raw-4 31.7kB ± 0% Schema_UnmarshalJSON-4 180kB ± 0% Schema_MarshalJSON_raw-4 14.6kB ± 0% Schema_MarshalJSON-4 53.9kB ± 0% name allocs/op Schema_UnmarshalJSON_raw-4 457 ± 0% Schema_UnmarshalJSON-4 1.85k ± 0% Schema_MarshalJSON_raw-4 370 ± 0% Schema_MarshalJSON-4 468 ± 0% ```