Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add nullable field tag to override nullability #96

Merged
merged 5 commits into from
Sep 21, 2023
Merged

Add nullable field tag to override nullability #96

merged 5 commits into from
Sep 21, 2023

Conversation

vearutop
Copy link
Member

@vearutop vearutop commented Sep 21, 2023

Related to swaggest/rest#173.

@github-actions
Copy link

github-actions bot commented Sep 21, 2023

Lines Of Code

Language Files Lines Code Comments Blanks Complexity Bytes
Go 7 2291 (+56) 1551 (+39) 269 (+5) 471 (+12) 599 (+22) 55.1K (+1.1K)
Go (test) 13 3214 (+30) 2355 (+26) 305 554 (+4) 48 80.8K (+925B)
Markdown 4 280 (+1) 226 (+1) 0 54 0 12.6K (+61B)
YAML 6 497 (+2) 411 (+2) 36 50 0 16.4K (+125B)

@github-actions
Copy link

github-actions bot commented Sep 21, 2023

Go API Changes

# github.com/swaggest/jsonschema-go
## compatible changes
(*Schema).RemoveType: added

# summary
Inferred base version: v0.3.59
Suggested version: v0.4.0

@github-actions
Copy link

github-actions bot commented Sep 21, 2023

Benchmark Result

Benchmark diff with base branch
name                        old time/op    new time/op    delta
Schema_UnmarshalJSON_raw-2    78.0µs ± 1%    78.0µs ± 1%    ~     (p=0.699 n=6+6)
Schema_UnmarshalJSON-2         586µs ± 1%     589µs ± 0%    ~     (p=0.126 n=6+5)
Schema_MarshalJSON_raw-2      71.0µs ± 1%    70.9µs ± 1%    ~     (p=0.394 n=6+6)
Schema_MarshalJSON-2           240µs ± 0%     241µs ± 0%  +0.28%  (p=0.008 n=5+5)

name                        old alloc/op   new alloc/op   delta
Schema_UnmarshalJSON_raw-2    31.6kB ± 0%    31.6kB ± 0%    ~     (p=0.794 n=6+6)
Schema_UnmarshalJSON-2         184kB ± 0%     184kB ± 0%    ~     (p=0.121 n=5+6)
Schema_MarshalJSON_raw-2      21.9kB ± 0%    21.9kB ± 0%    ~     (p=0.182 n=6+6)
Schema_MarshalJSON-2          55.3kB ± 0%    55.3kB ± 0%    ~     (p=0.567 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  78.0µs ± 1%
Schema_UnmarshalJSON-2       589µs ± 0%
Schema_MarshalJSON_raw-2    70.9µs ± 1%
Schema_MarshalJSON-2         241µs ± 0%

name                        alloc/op
Schema_UnmarshalJSON_raw-2  31.6kB ± 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%

@vearutop vearutop marked this pull request as ready for review September 21, 2023 11:43
@github-actions
Copy link

github-actions bot commented Sep 21, 2023

Unit Test Coverage

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

Coverage of changed lines
File Function Coverage
Total 82.4%
helper.go 66.7%
helper.go:113 RemoveType 74.3%
reflect.go 94.7%
reflect.go:1148 checkNullability 100.0%
reflect.go:880 walkProperties 87.5%
Coverage diff with base branch
File Function Base Coverage Current Coverage
Total 78.8% 78.7% (-0.1%)
helper.go RemoveType no function 66.7%
reflect.go walkProperties 85.5% 84.8% (-0.7%)

@codecov
Copy link

codecov bot commented Sep 21, 2023

Codecov Report

Merging #96 (553adb2) into master (bc13a7d) will decrease coverage by 0.28%.
The diff coverage is 62.96%.

@@            Coverage Diff             @@
##           master      #96      +/-   ##
==========================================
- Coverage   73.97%   73.70%   -0.28%     
==========================================
  Files           7        7              
  Lines        1168     1194      +26     
==========================================
+ Hits          864      880      +16     
- Misses        237      243       +6     
- Partials       67       71       +4     
Flag Coverage Δ
unittests 73.70% <62.96%> (-0.28%) ⬇️

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

Files Changed Coverage Δ
helper.go 80.99% <46.66%> (-4.86%) ⬇️
reflect.go 84.10% <83.33%> (-0.05%) ⬇️

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

@vearutop vearutop merged commit f6cad16 into master Sep 21, 2023
@vearutop vearutop deleted the nullable branch September 21, 2023 11:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant