swaggest / openapi-go

OpenAPI structures for Go
https://pkg.go.dev/github.com/swaggest/openapi-go/openapi3
MIT License
223 stars 18 forks source link

Abstract OpenAPI schema with an interface #73

Closed vearutop closed 11 months ago

vearutop commented 11 months ago

In order to prepare for OpenAPI 3.1 addition, current OpenAPI 3.0 implementation has to be generalized and decoupled from useful public API.

github-actions[bot] commented 11 months ago

Lines Of Code

Language Files Lines Code Comments Blanks Complexity Bytes
Go 14 (+1) 2124 (+40) 1554 (+24) 134 (+6) 436 (+10) 412 (+4) 49.8K (+936B)
Go (test) 10 3352 (+6) 2595 (+6) 333 424 32 87.9K (+237B)
JSON 7 (+1) 2230 (+24) 2230 (+24) 0 0 0 51K (+969B)
github-actions[bot] commented 11 months ago

Go API Changes

# github.com/swaggest/openapi-go
## incompatible changes
Reflector.JSONSchemaReflector: added
Reflector.SpecSchema: added
## compatible changes
SpecSchema: added

# github.com/swaggest/openapi-go/openapi3
## compatible changes
(*Reflector).JSONSchemaReflector: added
(*Reflector).SpecSchema: added
(*Spec).SetDescription: added
(*Spec).SetTitle: added
(*Spec).SetVersion: added

# summary
Inferred base version: v0.2.35
Suggested version: v0.3.0
github-actions[bot] commented 11 months ago

Unit Test Coverage

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

Coverage of changed lines | File | Function | Coverage | |-------------------------|---------------------|----------| | Total | | 53.8% | | openapi3/helper.go | | 100.0% | | openapi3/helper.go:134 | SetTitle | 100.0% | | openapi3/helper.go:139 | SetDescription | 100.0% | | openapi3/helper.go:144 | SetVersion | 100.0% | | openapi3/reflect.go | | 40.0% | | openapi3/reflect.go:581 | sanitizeDefName | 100.0% | | openapi3/reflect.go:801 | SpecSchema | 100.0% | | openapi3/reflect.go:242 | setupRequest | 22.2% | | openapi3/reflect.go:806 | JSONSchemaReflector | 0.0% |
Coverage diff with base branch | File | Function | Base Coverage | Current Coverage | |----------------------------------------------------|---------------------|---------------|------------------| | Total | | 50.8% | 50.9% (+0.1%) | | github.com/swaggest/openapi-go/openapi3/helper.go | SetDescription | no function | 100.0% | | github.com/swaggest/openapi-go/openapi3/helper.go | SetTitle | no function | 100.0% | | github.com/swaggest/openapi-go/openapi3/helper.go | SetVersion | no function | 100.0% | | github.com/swaggest/openapi-go/openapi3/reflect.go | JSONSchemaReflector | no function | 0.0% | | github.com/swaggest/openapi-go/openapi3/reflect.go | SpecSchema | no function | 100.0% | | github.com/swaggest/openapi-go/openapi3/reflect.go | setupRequest | 57.1% | 50.0% (-7.1%) | | github.com/swaggest/openapi-go/openapi3/reflect.go | stringRequestBody | 0.0% | 100.0% (+100.0%) |
codecov[bot] commented 11 months ago

Codecov Report

Merging #73 (f3dd446) into master (709f0d7) will increase coverage by 0.10%. The diff coverage is 43.75%.

@@            Coverage Diff             @@
##           master      #73      +/-   ##
==========================================
+ Coverage   43.12%   43.23%   +0.10%     
==========================================
  Files           8        8              
  Lines        3810     3819       +9     
==========================================
+ Hits         1643     1651       +8     
  Misses       1859     1859              
- Partials      308      309       +1     
Flag Coverage Δ
unittests 43.23% <43.75%> (+0.10%) :arrow_up:

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

Files Changed Coverage Δ
openapi3/reflect.go 81.15% <30.76%> (+0.03%) :arrow_up:
openapi3/helper.go 90.38% <100.00%> (+0.58%) :arrow_up:

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