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

Use type string for encoding.TextMarshaler #108

Closed vearutop closed 4 months ago

vearutop commented 4 months ago

Resolves #104.

github-actions[bot] commented 4 months ago

Lines Of Code

Language Files Lines Code Comments Blanks Complexity Bytes
Go 7 2352 (+14) 1592 (+11) 275 485 (+3) 618 (+3) 56.9K (+411B)
Go (test) 13 3419 (+23) 2521 (+18) 308 590 (+5) 51 85.9K (+548B)
github-actions[bot] commented 4 months ago

Go API Changes

# summary
Inferred base version: v0.3.65
Suggested version: v0.3.66
github-actions[bot] commented 4 months ago

Unit Test Coverage

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

Coverage of changed lines | File | Function | Coverage | |----------------|--------------------|----------| | Total | | 100.0% | | reflect.go | | 100.0% | | reflect.go:407 | reflect | 100.0% | | reflect.go:544 | checkTextMarshaler | 100.0% |
Coverage diff with base branch | File | Function | Base Coverage | Current Coverage | |-------------|--------------------|---------------|------------------| | Total | | 79.0% | 79.2% (+0.2%) | | entities.go | TypeEns | 66.7% | 100.0% (+33.3%) | | entities.go | WithSimpleTypes | 0.0% | 100.0% (+100.0%) | | helper.go | AddType | 92.9% | 85.7% (-7.2%) | | reflect.go | checkTextMarshaler | no function | 100.0% | | reflect.go | kindSwitch | 90.4% | 88.5% (-1.9%) |
codecov[bot] commented 4 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 74.11%. Comparing base (8eee225) to head (4ea788f).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #108 +/- ## ========================================== + Coverage 73.99% 74.11% +0.12% ========================================== Files 7 7 Lines 1215 1221 +6 ========================================== + Hits 899 905 +6 Misses 244 244 Partials 72 72 ``` | [Flag](https://app.codecov.io/gh/swaggest/jsonschema-go/pull/108/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/108/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=swaggest) | `74.11% <100.00%> (+0.12%)` | :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.9µs ± 1% 61.3µs ± 2% ~ (p=0.247 n=5+6) Schema_UnmarshalJSON-4 487µs ± 1% 490µs ± 1% ~ (p=0.151 n=5+5) Schema_MarshalJSON_raw-4 43.5µs ± 1% 43.5µs ± 1% ~ (p=1.000 n=6+6) Schema_MarshalJSON-4 186µs ± 1% 184µs ± 1% -0.94% (p=0.009 n=6+6) name old alloc/op new alloc/op delta Schema_UnmarshalJSON_raw-4 31.7kB ± 0% 31.7kB ± 0% ~ (p=0.199 n=5+6) Schema_UnmarshalJSON-4 180kB ± 0% 180kB ± 0% ~ (all equal) Schema_MarshalJSON_raw-4 14.6kB ± 0% 14.6kB ± 0% ~ (p=1.000 n=6+6) Schema_MarshalJSON-4 53.9kB ± 0% 53.9kB ± 0% ~ (p=0.721 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 ± 2% Schema_UnmarshalJSON-4 490µs ± 1% Schema_MarshalJSON_raw-4 43.5µs ± 1% Schema_MarshalJSON-4 184µ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% ```