-
Notifications
You must be signed in to change notification settings - Fork 0
Add RuleSet validation endpoint (in swagger). #49
Conversation
1 similar comment
public/r2/v1/swagger/swagger.json
Outdated
@@ -771,6 +775,52 @@ | |||
} | |||
} | |||
} | |||
}, | |||
"/rulesets/validate": { |
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.
If we're validating the full RuleSet, why not have the validation process apart of the normal POST and PUT operations for the mapping and rollup roles.
For example, when you do a PUT on a mapping rules
PUT /namespaces/{namespaceID}/mapping-rules
It can return a HTTP 400: Mapping rule is invalid because {error}
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.
Hey @saminzadeh I've actually updated the diff to include validation for namespace as well so things have changed around. I believe RuleSets are validated on all POST and PUT operations dealing with rules already. The motivation for this endpoint is to:
-
Provide a validation endpoint for proposed changes to a namespace (ie given a namespace name and its updated RuleSets - validate them). This will be used in CI to validate changes to rules when users have diffs created for their rule changes
-
Have a way to validate new changes while the user is making them from the UI (without them having to hit create/update.
1 similar comment
1 similar comment
1 similar 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.
LGMT. As discussed, it will be nice to consolidate a single endpoint in the future POST /namespace and it could take a dry_run parameter.
1 similar 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 other than the nits.
public/r2/v1/swagger/swagger.json
Outdated
"tags": [ | ||
"namespaces" | ||
], | ||
"summary": "Performs validation for a Namespace's RuleSet.", |
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.
nit: ... for a namespace's ruleset
.
public/r2/v1/swagger/swagger.json
Outdated
"namespaces" | ||
], | ||
"summary": "Performs validation for a Namespace's RuleSet.", | ||
"operationId": "validateNamespaceRuleSet", |
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.
nit: just validateRuleSet
?
public/r2/v1/swagger/swagger.json
Outdated
}, | ||
{ | ||
"in": "body", | ||
"name": "rule-set", |
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.
nit: just ruleset
?
public/r2/v1/swagger/swagger.json
Outdated
{ | ||
"in": "body", | ||
"name": "rule-set", | ||
"description": "The rule-set to validate.", |
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.
nit: The ruleset to validate
.
public/r2/v1/swagger/swagger.json
Outdated
], | ||
"responses": { | ||
"200": { | ||
"description": "The rule-set is valid.", |
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.
nit: rule-set
-> ruleset
.
public/r2/v1/swagger/swagger.json
Outdated
} | ||
}, | ||
"400": { | ||
"description": "The rule-set is invalid.", |
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.
nit: rule-set
-> ruleset
.
1 similar comment
public/r2/v1/swagger/swagger.json
Outdated
@@ -189,8 +189,8 @@ | |||
"tags": [ | |||
"namespaces" | |||
], | |||
"summary": "Performs validation for a Namespace's RuleSet.", | |||
"operationId": "validateNamespaceRuleSet", | |||
"summary": "Performs validation for a namespace's ruleSet.", |
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.
nit: a namespace's ruleset
?
No description provided.