-
Notifications
You must be signed in to change notification settings - Fork 16
feat(admin): validate requests based on OpenAPI #212
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
Conversation
Codecov Report❌ Patch coverage is
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 90 files with indirect coverage changes 🚀 New features to boost your workflow:
|
30f942c to
ea39177
Compare
pkg/openapi/openapi.go
Outdated
| case *openapi3.SchemaError: | ||
| node := validateErr.Fields | ||
| fields := se.JSONPointer() | ||
| for i, field := range fields { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
consider array type invalid, for example attempts: [0, "123", 30], error msg will be {"attempts":[null,"value must be an integer"]}, need a test case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
ac3caf9 to
e821f62
Compare
da40019 to
01c4de8
Compare
Co-authored-by: cchenggit <cchenggit@users.noreply.github.com> Signed-off-by: Yusheng Li <leeys.top@gmail.com>
webhookx-x
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
cchenggit
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Summary
This PR enhances the OpenAPI Specification. Ideally, the spec should become the source of truth. However, the validation for the Plugin and its configuration is not flexible enough, and we must retain manual validation until OpenAPI 3.1.0 is supported.
issue #145
Benchmark
Roughly, using JSONSchema validation is about twice as slow as go-playground/validator(via reflection).