-
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
[OAS] Include alerting rule APIs #189962
[OAS] Include alerting rule APIs #189962
Conversation
Pinging @elastic/kibana-core (Team:Core) |
Pinging @elastic/response-ops (Team:ResponseOps) |
@lcawl previewing this in bump.sh does not render the "Create a rule" operation, any ideas on why that might be 🤔 ? |
One of the errors returned by the linter is as follows:
Per https://docs.stoplight.io/docs/spectral/4dec24461f3af-open-api-rules#operation-operationid-valid-in-url "Seeing as operationId is often used for unique URLs in documentation systems, it's a good idea to avoid non-URL-safe characters." In the preview, the URL that is derived from the operationId in the OpenAPI document for "get rule details" is "operation-api-alerting-rule-id-0", which seems very likely to be the same as what would be derived from the "create a rule" operationId ( Is there some way we can generate a more URL-safe unique operationId for each operation in the document? To ensure that it doesn't change, perhaps the simplest method is to provide it as a value in the code? |
Yay, I'm glad the operationId solution worked. There are a few other things picked up by the linter that I think are worth mentioning. Not sure if they need to be resolved in the core functionality or if it's just something incorrect in the alerting API details specifically, but here's what I see: Empty enum list
For example:
This missing information shows up in the docs like this: Optional path parameters
For example:
Per https://spec.openapis.org/oas/v3.0.3#parameter-object "If the parameter location is "path", this [required] property is REQUIRED and its value MUST be true" so I suspect that's the cause of this message. The docs preview doesn't seem to mind this, however: Empty required lists
For example:
It looks like this is ignored and non-problematic in the docs, so perhaps it is another case where if we can't omit the empty lists we can just lower the severity of this oas3-schema rule in our linter so it's not considered an error. |
Should be fixed 06bc1a3
I'm not entirely sure I understand the lint rule in this case. Are optional path parameters not possible in OAS? Kibana does support optional path parameters so not sure how to reconcile those.
Should be fixed b776259 More a q for responseops: In bump and in the diff I noticed that certain fields that are nullable are being marked as required: vs.Could it be that these should both be Would you mind taking another look @lcawl ? |
💛 Build succeeded, but was flaky
Failed CI StepsMetrics [docs]
History
To update your PR or re-run it, just comment with: cc @jloleysens |
Yeah, you basically have to have two copies defined: one with the parameter and one without. Per OAI/OpenAPI-Specification#93 (comment) it seems like this will be fixed in the next OAS version and since Bump.sh doesn't seem to have a problem with it, it's probably not worth "fixing" to align with OAS v3.
Those fixes all look great, thanks! There is one more that I must have missed in the previous lint results related to some empty responses, so I've created #190265 |
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.
IMO this PR can wait for #190265 or I can regenerate the bundles thereafter.
I'm a little surprised to see I would think on an API definition it would basically mean optional, or maybe |
Yeah, the main concern I wanted to raise is cases where FWIW I don't think this is a blocker, but happy to view it as one if you feel differently @pmuellr |
…t --include-path /api/status --include-path /api/alerting/rule/ --include-path /api/alerting/rules --update'
## Summary Includes alerting rule APIs in our OAS snapshots. ## How to test Using bump CLI you can preview the output: ```sh bump preview ./oas_docs/bundle.json # or bump preview ./oas_docs/bundle.serverless.json ``` --------- Co-authored-by: kibanamachine <[email protected]>
Reverted with a9c4d2f. See https://buildkite.com/elastic/kibana-on-merge/builds/48864 |
IMO all of those "errors" should be warnings so I've created a PR (#190470) that changes the severity level of those linting rules (though it's cool to see them incorporated into an automated check)! |
## Summary Includes alerting rule APIs in our OAS snapshots. ## How to test Using bump CLI you can preview the output: ```sh bump preview ./oas_docs/bundle.json # or bump preview ./oas_docs/bundle.serverless.json ``` --------- Co-authored-by: kibanamachine <[email protected]>
Summary
Includes alerting rule APIs in our OAS snapshots.
How to test
Using bump CLI you can preview the output:
bump preview ./oas_docs/bundle.json # or bump preview ./oas_docs/bundle.serverless.json