-
Notifications
You must be signed in to change notification settings - Fork 15
feat: support inbound plugin jsonschema validator #239
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
base: main
Are you sure you want to change the base?
feat: support inbound plugin jsonschema validator #239
Conversation
e24260e
to
e613d87
Compare
Codecov Report❌ Patch coverage is
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 1 file with indirect coverage changes 🚀 New features to boost your workflow:
|
d4f58ec
to
6166e8d
Compare
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.
default_schema
: to be used when event_type is not defined in theschemas
version
: define the jsonschema dialect version
"encoding/hex" | ||
) | ||
|
||
func Hash256(s string) string { |
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.
Sha256 is more accurate
"time" | ||
) | ||
|
||
type Config struct { |
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.
Requires a version
field. (enum: draft4/draft6/draft7/etc..)
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.
current jsonschema only support openapi3 schema, which based on the draft6
RawBody: body, | ||
}) | ||
if err != nil { | ||
if validateErr, ok := err.(*errs.ValidateError); ok { |
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.
Can this be handled inside the plugin?
} | ||
|
||
type SchemaResource struct { | ||
JSONString string `json:"json" validate:"omitempty,json,max=1048576"` |
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.
I prefer to use json:"schema"
Schemas map[string]*SchemaResource `json:"schemas" validate:"dive,required"` | ||
} | ||
|
||
type EventTypeSchema struct { |
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.
I don't see this struct is used.
I think we can design a feature to support loading values from external system(including file, env, and network), this would be a different topic. Let's remove the part of loading schema from the file and network to keep the plugin as simple as possible. |
good idea, this should the common requirement of plugin |
Please update the README.md to mention this cool plugin. |
issue #227