swaggest / openapi-go

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

Introduce abstraction to describe operation and reflector #65

Closed vearutop closed 1 year ago

github-actions[bot] commented 1 year ago

Go API Changes

# github.com/swaggest/openapi-go
## compatible changes
ContentOption: added
ContentUnit: added
In: added
InBody: added
InCookie: added
InFormData: added
InHeader: added
InPath: added
InQuery: added
JSONSchemaCallback: added
JSONSchemaWalker: added
OperationContext: added
OperationCtx: added
OperationInfo: added
OperationState: added
Reflector: added
RequestBodyEnforcer: added
RequestJSONBodyEnforcer: added
SanitizeMethodPath: added
WithOperationCtx: added

# github.com/swaggest/openapi-go/openapi3
## incompatible changes
Reflector.ResolveJSONSchemaRef: removed
## compatible changes
(*Reflector).AddOperation: added
(*Reflector).NewOperationContext: added
(*Reflector).WalkRequestJSONSchemas: added
(*Reflector).WalkResponseJSONSchemas: added
NewReflector: added
OperationExposer: added

# summary
Inferred base version: v0.2.33
Suggested version: v0.3.0
github-actions[bot] commented 1 year ago

Lines Of Code

Language Files Lines Code Comments Blanks Complexity Bytes
Go 13 (+6) 2066 (+737) 1515 (+520) 128 (+64) 423 (+153) 408 (+101) 48.5K (+18.3K)
Go (test) 9 (+2) 3180 (+1147) 2434 (+959) 331 (+12) 415 (+176) 32 (+5) 83.7K (+31K)
JSON 6 2206 (-6) 2206 (-6) 0 0 0 50.1K (-203B)
github-actions[bot] commented 1 year ago

Unit Test Coverage

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

Coverage of changed lines | File | Function | Coverage | |-----------------------------------|------------------------------|----------| | Total | | 75.3% | | openapi3/helper.go | | 94.7% | | openapi3/helper.go:27 | validatePathParams | 100.0% | | openapi3/helper.go:100 | AddOperation | 100.0% | | openapi3/helper.go:66 | SetupOperation | 93.9% | | openapi3/reflect.go | | 85.8% | | openapi3/reflect.go:27 | NewReflector | 100.0% | | openapi3/reflect.go:66 | ResolveJSONSchemaRef | 100.0% | | openapi3/reflect.go:121 | AddSecurity | 100.0% | | openapi3/reflect.go:154 | Operation | 100.0% | | openapi3/reflect.go:158 | toOpCtx | 100.0% | | openapi3/reflect.go:188 | fromOpCtx | 100.0% | | openapi3/reflect.go:303 | parseRequestBody | 100.0% | | openapi3/reflect.go:423 | parseParameters | 100.0% | | openapi3/reflect.go:431 | parseParametersIn | 100.0% | | openapi3/reflect.go:580 | parseResponseHeader | 100.0% | | openapi3/reflect.go:713 | ensureResponseContentType | 100.0% | | openapi3/reflect.go:723 | parseJSONResponse | 100.0% | | openapi3/reflect.go:278 | mediaType | 95.7% | | openapi3/reflect.go:36 | NewOperationContext | 91.8% | | openapi3/reflect.go:668 | setupResponse | 80.0% | | openapi3/reflect.go:220 | AddOperation | 66.7% | | openapi3/reflect.go:241 | setupRequest | 31.2% | | openapi3/reflect.go:129 | SetTags | 0.0% | | openapi3/reflect.go:133 | SetIsDeprecated | 0.0% | | openapi3/reflect.go:137 | SetSummary | 0.0% | | openapi3/reflect.go:141 | SetDescription | 0.0% | | openapi3/reflect.go:145 | SetID | 0.0% | | openapi3/reflect.go:149 | UnknownParamsAreForbidden | 0.0% | | openapi3/reflect.go:295 | stringRequestBody | 0.0% | | openapi3/reflect_deprecated.go | | 100.0% | | openapi3/reflect_deprecated.go:11 | SetupRequest | 100.0% | | openapi3/reflect_deprecated.go:18 | SetRequest | 100.0% | | openapi3/reflect_deprecated.go:48 | SetStringResponse | 100.0% | | openapi3/reflect_deprecated.go:59 | SetJSONResponse | 100.0% | | openapi3/reflect_deprecated.go:70 | SetupResponse | 100.0% | | openapi3/reflect_deprecated.go:77 | OperationCtx | 100.0% | | openapi3/walk_schema.go | | 72.5% | | openapi3/walk_schema.go:60 | provideHeaderSchemas | 88.6% | | openapi3/walk_schema.go:13 | WalkResponseJSONSchemas | 88.1% | | openapi3/walk_schema.go:85 | WalkRequestJSONSchemas | 84.4% | | openapi3/walk_schema.go:170 | provideParametersJSONSchemas | 83.3% | | openapi3/walk_schema.go:199 | paramSchema | 76.5% | | openapi3/walk_schema.go:141 | provideFormDataSchemas | 58.9% | | operation.go | | 0.0% | | operation.go:39 | SetFieldMapping | 0.0% | | operation.go:52 | FieldMapping | 0.0% | | operation.go:96 | WithOperationCtx | 0.0% | | operation.go:106 | OperationCtx | 0.0% | | operation.go:117 | SanitizeMethodPath | 0.0% |
Coverage diff with base branch | File | Function | Base Coverage | Current Coverage | |---------------------------------------------------------------|------------------------------|---------------|------------------| | Total | | 49.9% | 50.8% (+0.9%) | | github.com/swaggest/openapi-go/openapi3/helper.go | SetupOperation | 94.6% | 93.8% (-0.8%) | | github.com/swaggest/openapi-go/openapi3/helper.go | validatePathParams | no function | 94.4% | | github.com/swaggest/openapi-go/openapi3/jsonschema.go | FromJSONSchema | 79.3% | 81.7% (+2.4%) | | github.com/swaggest/openapi-go/openapi3/jsonschema.go | toJSONSchema | 78.9% | 81.7% (+2.8%) | | github.com/swaggest/openapi-go/openapi3/reflect.go | AddOperation | no function | 60.0% | | github.com/swaggest/openapi-go/openapi3/reflect.go | AddSecurity | no function | 100.0% | | github.com/swaggest/openapi-go/openapi3/reflect.go | NewOperationContext | no function | 83.3% | | github.com/swaggest/openapi-go/openapi3/reflect.go | NewReflector | no function | 100.0% | | github.com/swaggest/openapi-go/openapi3/reflect.go | Operation | no function | 100.0% | | github.com/swaggest/openapi-go/openapi3/reflect.go | OperationCtx | 100.0% | no function | | github.com/swaggest/openapi-go/openapi3/reflect.go | SetDescription | no function | 0.0% | | github.com/swaggest/openapi-go/openapi3/reflect.go | SetID | no function | 0.0% | | github.com/swaggest/openapi-go/openapi3/reflect.go | SetIsDeprecated | no function | 0.0% | | github.com/swaggest/openapi-go/openapi3/reflect.go | SetJSONResponse | 100.0% | no function | | github.com/swaggest/openapi-go/openapi3/reflect.go | SetRequest | 100.0% | no function | | github.com/swaggest/openapi-go/openapi3/reflect.go | SetStringResponse | 100.0% | no function | | github.com/swaggest/openapi-go/openapi3/reflect.go | SetSummary | no function | 0.0% | | github.com/swaggest/openapi-go/openapi3/reflect.go | SetTags | no function | 0.0% | | github.com/swaggest/openapi-go/openapi3/reflect.go | SetupRequest | 100.0% | no function | | github.com/swaggest/openapi-go/openapi3/reflect.go | SetupResponse | 90.0% | no function | | github.com/swaggest/openapi-go/openapi3/reflect.go | UnknownParamsAreForbidden | no function | 0.0% | | github.com/swaggest/openapi-go/openapi3/reflect.go | fromOpCtx | no function | 100.0% | | github.com/swaggest/openapi-go/openapi3/reflect.go | mediaType | no function | 85.7% | | github.com/swaggest/openapi-go/openapi3/reflect.go | parseJSONResponse | 89.5% | 90.5% (+1.0%) | | github.com/swaggest/openapi-go/openapi3/reflect.go | parseParameters | no function | 100.0% | | github.com/swaggest/openapi-go/openapi3/reflect.go | parseRequestBody | 98.0% | 97.9% (-0.1%) | | github.com/swaggest/openapi-go/openapi3/reflect.go | parseResponseHeader | 91.3% | 92.0% (+0.7%) | | github.com/swaggest/openapi-go/openapi3/reflect.go | setupRequest | no function | 57.1% | | github.com/swaggest/openapi-go/openapi3/reflect.go | setupResponse | no function | 84.2% | | github.com/swaggest/openapi-go/openapi3/reflect.go | stringRequestBody | no function | 0.0% | | github.com/swaggest/openapi-go/openapi3/reflect.go | toOpCtx | no function | 100.0% | | github.com/swaggest/openapi-go/openapi3/reflect.go | withOperation | 100.0% | no function | | github.com/swaggest/openapi-go/openapi3/reflect_deprecated.go | OperationCtx | no function | 100.0% | | github.com/swaggest/openapi-go/openapi3/reflect_deprecated.go | SetJSONResponse | no function | 100.0% | | github.com/swaggest/openapi-go/openapi3/reflect_deprecated.go | SetRequest | no function | 100.0% | | github.com/swaggest/openapi-go/openapi3/reflect_deprecated.go | SetStringResponse | no function | 100.0% | | github.com/swaggest/openapi-go/openapi3/reflect_deprecated.go | SetupRequest | no function | 100.0% | | github.com/swaggest/openapi-go/openapi3/reflect_deprecated.go | SetupResponse | no function | 100.0% | | github.com/swaggest/openapi-go/openapi3/walk_schema.go | WalkRequestJSONSchemas | no function | 79.2% | | github.com/swaggest/openapi-go/openapi3/walk_schema.go | WalkResponseJSONSchemas | no function | 81.0% | | github.com/swaggest/openapi-go/openapi3/walk_schema.go | paramSchema | no function | 60.0% | | github.com/swaggest/openapi-go/openapi3/walk_schema.go | provideFormDataSchemas | no function | 53.3% | | github.com/swaggest/openapi-go/openapi3/walk_schema.go | provideHeaderSchemas | no function | 75.0% | | github.com/swaggest/openapi-go/openapi3/walk_schema.go | provideParametersJSONSchemas | no function | 71.4% | | github.com/swaggest/openapi-go/operation.go | FieldMapping | no function | 0.0% | | github.com/swaggest/openapi-go/operation.go | OperationCtx | no function | 0.0% | | github.com/swaggest/openapi-go/operation.go | SanitizeMethodPath | no function | 0.0% | | github.com/swaggest/openapi-go/operation.go | SetFieldMapping | no function | 0.0% | | github.com/swaggest/openapi-go/operation.go | WithOperationCtx | no function | 0.0% |
codecov[bot] commented 1 year ago

Codecov Report

Merging #65 (62e765e) into master (c18f7f7) will increase coverage by 0.76%. The diff coverage is 64.70%.

@@            Coverage Diff             @@
##           master      #65      +/-   ##
==========================================
+ Coverage   42.24%   43.00%   +0.76%     
==========================================
  Files           5        8       +3     
  Lines        3589     3802     +213     
==========================================
+ Hits         1516     1635     +119     
- Misses       1784     1859      +75     
- Partials      289      308      +19     
Flag Coverage Δ
unittests 43.00% <64.70%> (+0.76%) :arrow_up:

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

Files Changed Coverage Δ
operation.go 0.00% <0.00%> (ø)
openapi3/walk_schema.go 53.84% <53.84%> (ø)
openapi3/reflect.go 80.72% <75.00%> (-6.36%) :arrow_down:
openapi3/helper.go 89.79% <85.71%> (-0.95%) :arrow_down:
openapi3/reflect_deprecated.go 100.00% <100.00%> (ø)

... and 1 file with indirect coverage changes

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