swaggest / openapi-go

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

Sanitize schema definition names #72

Closed vearutop closed 1 year ago

vearutop commented 1 year ago

Fixes #71.

This PR strips all invalid chars (non a-zA-Z0-9.\-_) from definition names.

github-actions[bot] commented 1 year ago

Lines Of Code

Language Files Lines Code Comments Blanks Complexity Bytes
Go 13 2084 (+18) 1530 (+15) 128 426 (+3) 408 48.9K (+423B)
Go (test) 10 (+1) 3346 (+166) 2589 (+155) 333 (+2) 424 (+9) 32 87.7K (+4K)
github-actions[bot] commented 1 year ago

Go API Changes

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

Unit Test Coverage

total: (statements) 50.8% changed lines: (statements) 95.2%

Coverage of changed lines | File | Function | Coverage | |-------------------------|----------------------|----------| | Total | | 95.2% | | openapi3/reflect.go | | 95.2% | | openapi3/reflect.go:67 | ResolveJSONSchemaRef | 100.0% | | openapi3/reflect.go:306 | parseRequestBody | 100.0% | | openapi3/reflect.go:435 | parseParametersIn | 100.0% | | openapi3/reflect.go:575 | sanitizeDefName | 100.0% | | openapi3/reflect.go:596 | parseResponseHeader | 100.0% | | openapi3/reflect.go:659 | hasJSONBody | 100.0% | | openapi3/reflect.go:740 | parseJSONResponse | 100.0% |
Coverage diff with base branch | File | Function | Base Coverage | Current Coverage | |----------------------------------------------------|-----------------|---------------|------------------| | Total | | 50.8% | 50.8% (0.0%) | | github.com/swaggest/openapi-go/openapi3/reflect.go | sanitizeDefName | no function | 100.0% |
codecov[bot] commented 1 year ago

Codecov Report

Merging #72 (dafdce4) into master (d914826) will increase coverage by 0.11%. The diff coverage is 93.33%.

@@            Coverage Diff             @@
##           master      #72      +/-   ##
==========================================
+ Coverage   43.00%   43.12%   +0.11%     
==========================================
  Files           8        8              
  Lines        3802     3810       +8     
==========================================
+ Hits         1635     1643       +8     
  Misses       1859     1859              
  Partials      308      308              
Flag Coverage Δ
unittests 43.12% <93.33%> (+0.11%) :arrow_up:

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

Files Changed Coverage Δ
openapi3/reflect.go 81.12% <93.33%> (+0.39%) :arrow_up:

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