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

Sanitize schema definition names #72

Merged
merged 1 commit into from
Jul 29, 2023
Merged

Sanitize schema definition names #72

merged 1 commit into from
Jul 29, 2023

Conversation

vearutop
Copy link
Member

@vearutop vearutop commented Jul 29, 2023

Fixes #71.

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

@github-actions
Copy link

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
Copy link

Go API Changes

# summary
Inferred base version: v0.2.34
Suggested version: v0.2.35

@github-actions
Copy link

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
Copy link

codecov bot commented Jul 29, 2023

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%) ⬆️

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%) ⬆️

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

@vearutop vearutop merged commit 709f0d7 into master Jul 29, 2023
@vearutop vearutop deleted the sanitize-def-name branch July 29, 2023 20:35
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.

req/resp struct using generic could cause semantic error in openapi output
1 participant