-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[ResponseOps][Rules] OAS schema registration for Rule APIs #188445
[ResponseOps][Rules] OAS schema registration for Rule APIs #188445
Conversation
Pinging @elastic/response-ops (Team:ResponseOps) |
}), | ||
{ meta: { description: 'History of the rule run.' } } | ||
), | ||
calculated_metrics: schema.object({ |
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.
Couldn't find any docs, comments or example which could help explain this metrics. Would be great if someone can suggest description for calculated_metrics
object.
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.
How about "Calculation of different percentiles and success ratio"
?
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.
Tested and it is working as expected!
x-pack/plugins/alerting/server/routes/rule/apis/create/create_rule_route.ts
Outdated
Show resolved
Hide resolved
💚 Build Succeeded
Metrics [docs]
History
|
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.
Tested and works 👌
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.
code LGTM! I will approve when @lcawl looks over the descriptions and gives it a green light 😄
@@ -26,7 +26,9 @@ export const muteAlertRoute = ( | |||
summary: `Mute an alert`, | |||
}, | |||
validate: { | |||
params: muteAlertParamsSchemaV1, | |||
request: { | |||
params: muteAlertParamsSchemaV1, |
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.
Should we specify the 403
here? Since we have the RuleTypeDisabledError
in 42, which sends out a custom error body. If so we should version that schema well
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.
@lcawl what do you think?
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.
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.
Yes, that seems fine to me!
}, | ||
response: { | ||
200: { | ||
body: () => ruleResponseSchemaV1, |
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.
Same here this can also 403
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.
Awesome! Added some feedback on the strings but otherwise LGTM!
x-pack/plugins/alerting/common/routes/alerts_filter_query/schemas/v1.ts
Outdated
Show resolved
Hide resolved
x-pack/plugins/alerting/common/routes/r_rule/response/schemas/v1.ts
Outdated
Show resolved
Hide resolved
x-pack/plugins/alerting/common/routes/r_rule/response/schemas/v1.ts
Outdated
Show resolved
Hide resolved
x-pack/plugins/alerting/common/routes/r_rule/response/schemas/v1.ts
Outdated
Show resolved
Hide resolved
x-pack/plugins/alerting/common/routes/r_rule/response/schemas/v1.ts
Outdated
Show resolved
Hide resolved
x-pack/plugins/alerting/common/routes/rule/response/schemas/v1.ts
Outdated
Show resolved
Hide resolved
x-pack/plugins/alerting/common/routes/rule/response/schemas/v1.ts
Outdated
Show resolved
Hide resolved
x-pack/plugins/alerting/common/routes/rule/response/schemas/v1.ts
Outdated
Show resolved
Hide resolved
x-pack/plugins/alerting/server/routes/rule/apis/find/find_rules_route.ts
Outdated
Show resolved
Hide resolved
💛 Build succeeded, but was flaky
Failed CI StepsMetrics [docs]
History
To update your PR or re-run it, just comment with: |
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
Issue: #187574
This PR updates
request
andresponse
schemas below for rule APIs to generate OAS documentation:POST /api/alerting/rule/{id?}
GET /api/alerting/rule/{id}
DELETE /api/alerting/rule/{id}
PUT /api/alerting/rule/{id}
GET /api/alerting/rules/_find
POST /api/alerting/rule/{rule_id}/alert/{alert_id}/_mute
How to test
server.oas.enabled: true
tokibana.dev.yml
yarn start --no-base-path
curl -s -uelastic:changeme http://localhost:5601/api/oas\?pathStartsWith\=/api/alerting/rule/ | jq
curl -s -uelastic:changeme http://localhost:5601/api/oas\?pathStartsWith\=/api/alerting/rules/ | jq