-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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] Support setting availability #196647
Conversation
/ci |
export function setXState( | ||
availability: RouteConfigOptions<RouteMethod>['availability'], | ||
operation: CustomOperationObject | ||
): void { | ||
if (availability) { | ||
if (availability.stability === 'experimental') { | ||
operation['x-state'] = 'Technical Preview'; | ||
} | ||
if (availability.stability === 'beta') { | ||
operation['x-state'] = 'Beta'; | ||
} | ||
} | ||
} |
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.
This is the logic for adding x-state
, added the types for since
but we can implement it in another PR.
/ci |
I added this new availability clause to a couple of endpoints and regenerated the OpenAPI document and it looks great! The only thing I can't tell from this PR is how/if I could indicate that an endpoint has differing availability in serverless context, for example. In the elasticsearch specification they have this flavour-awareness per https://github.com/elastic/elasticsearch-specification/blob/main/docs/add-new-api.md#add-the-endpoint-request-definition. Is this something that's possible and desirable here too? |
* @remark intended to be used for informational purposes only. | ||
* | ||
*/ | ||
availability?: { |
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.
The ES specification has availability
as either stack
or serverless
and we're missing that in the route config options.
It's probably not a deal breaker now but would be great to surface in the generated spec.
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.
Looks good thus far. I left a question about choosing stability
default that I'd like to hear your thoughts on. The main concern is consistency and risk.
* | ||
*/ | ||
availability?: { | ||
/** @default stable */ |
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.
Route access defaults to 'internal'. WDYT about reflecting that here and setting the default stability as 'experimental'? That way there's less risk to adding new routes and forgetting to change the stability descriptor to 'experimental' pre-GA.
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.
Yeah, I considered this too, but then realised our existing public routes would default to "experimental" too unless we explicitly set them all to "stable". So, in practice, we default to "stable" already today.
I'm not opposed to changing the default, and I tend to agree with you starting as "experimental" is better I just wanted to avoid a wider effort. We could do it as follow up work, happy to open an issue.
I wasn't too concerned about internal routes bc they are in principle "not available", but I think we can capture that in the doc 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.
Yeah, I considered this too, but then realised our existing public routes would default to "experimental" too unless we explicitly set them all to "stable".
We don't have that many public routes as we do internal. From a cost/benefit pov, changing public routes to stable
is worth the effort of mitigating the risk of accidentally marking a route as stable when it's not.
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'm not opposed to changing the default, and I tend to agree with you starting as "experimental" is better I just wanted to avoid a wider effort. We could do it as follow up work, happy to open an issue.
Sounds good, LMK when you've created an issue.
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.
#197003 🙌🏻
Co-authored-by: Christiane (Tina) Heiligers <[email protected]>
@TinaHeiligers @lcawl re "flavour" availability would this not already be captured by the fact that we have a Let me know what you think! |
Pinging @elastic/kibana-core (Team:Core) |
|
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.
Unblocking to add x-state
with the understanding that we'll switch the default stability to experimental
in a follow up PR.
* | ||
*/ | ||
availability?: { | ||
/** @default stable */ |
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'm not opposed to changing the default, and I tend to agree with you starting as "experimental" is better I just wanted to avoid a wider effort. We could do it as follow up work, happy to open an issue.
Sounds good, LMK when you've created an issue.
Starting backport for target branches: 8.16 |
💛 Build succeeded, but was flaky
Failed CI StepsTest Failures
Metrics [docs]History
cc @jloleysens |
## Summary Close elastic#181995 Related elastic#195325 ### Checklist - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios --------- Co-authored-by: Christiane (Tina) Heiligers <[email protected]> (cherry picked from commit 608cc70)
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
# Backport This will backport the following commits from `main` to `8.16`: - [[OAS] Support setting availability (#196647)](#196647) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Jean-Louis Leysens","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-10-21T10:30:45Z","message":"[OAS] Support setting availability (#196647)\n\n## Summary\r\n\r\nClose https://github.com/elastic/kibana/issues/181995\r\n\r\nRelated https://github.com/elastic/kibana/pull/195325\r\n\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n\r\n---------\r\n\r\nCo-authored-by: Christiane (Tina) Heiligers <[email protected]>","sha":"608cc70be56fa63cb68a93d480e545fa95c0846a","branchLabelMapping":{"^v9.0.0$":"main","^v8.17.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:Core","release_note:skip","v9.0.0","Feature:OAS","v8.16.0","backport:version"],"title":"[OAS] Support setting availability","number":196647,"url":"https://github.com/elastic/kibana/pull/196647","mergeCommit":{"message":"[OAS] Support setting availability (#196647)\n\n## Summary\r\n\r\nClose https://github.com/elastic/kibana/issues/181995\r\n\r\nRelated https://github.com/elastic/kibana/pull/195325\r\n\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n\r\n---------\r\n\r\nCo-authored-by: Christiane (Tina) Heiligers <[email protected]>","sha":"608cc70be56fa63cb68a93d480e545fa95c0846a"}},"sourceBranch":"main","suggestedTargetBranches":["8.16"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/196647","number":196647,"mergeCommit":{"message":"[OAS] Support setting availability (#196647)\n\n## Summary\r\n\r\nClose https://github.com/elastic/kibana/issues/181995\r\n\r\nRelated https://github.com/elastic/kibana/pull/195325\r\n\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n\r\n---------\r\n\r\nCo-authored-by: Christiane (Tina) Heiligers <[email protected]>","sha":"608cc70be56fa63cb68a93d480e545fa95c0846a"}},{"branch":"8.16","label":"v8.16.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Jean-Louis Leysens <[email protected]>
@jloleysens there's a version gap with this backport. Can you check if this should also be backported to 8.x/8.17? |
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
## Summary Close elastic#181995 Related elastic#195325 ### Checklist - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios --------- Co-authored-by: Christiane (Tina) Heiligers <[email protected]> (cherry picked from commit 608cc70)
# Backport This will backport the following commits from `main` to `8.x`: - [[OAS] Support setting availability (#196647)](#196647) <!--- Backport version: 8.9.8 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Jean-Louis Leysens","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-10-21T10:30:45Z","message":"[OAS] Support setting availability (#196647)\n\n## Summary\r\n\r\nClose https://github.com/elastic/kibana/issues/181995\r\n\r\nRelated https://github.com/elastic/kibana/pull/195325\r\n\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n\r\n---------\r\n\r\nCo-authored-by: Christiane (Tina) Heiligers <[email protected]>","sha":"608cc70be56fa63cb68a93d480e545fa95c0846a","branchLabelMapping":{"^v9.0.0$":"main","^v8.17.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:Core","release_note:skip","v9.0.0","Feature:OAS","v8.16.0","backport:version","v8.17.0"],"number":196647,"url":"https://github.com/elastic/kibana/pull/196647","mergeCommit":{"message":"[OAS] Support setting availability (#196647)\n\n## Summary\r\n\r\nClose https://github.com/elastic/kibana/issues/181995\r\n\r\nRelated https://github.com/elastic/kibana/pull/195325\r\n\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n\r\n---------\r\n\r\nCo-authored-by: Christiane (Tina) Heiligers <[email protected]>","sha":"608cc70be56fa63cb68a93d480e545fa95c0846a"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","labelRegex":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/196647","number":196647,"mergeCommit":{"message":"[OAS] Support setting availability (#196647)\n\n## Summary\r\n\r\nClose https://github.com/elastic/kibana/issues/181995\r\n\r\nRelated https://github.com/elastic/kibana/pull/195325\r\n\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n\r\n---------\r\n\r\nCo-authored-by: Christiane (Tina) Heiligers <[email protected]>","sha":"608cc70be56fa63cb68a93d480e545fa95c0846a"}},{"branch":"8.16","label":"v8.16.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"url":"https://github.com/elastic/kibana/pull/197025","number":197025,"state":"MERGED","mergeCommit":{"sha":"76993eb1f6b160a9f58377fee967c3b578023f5b","message":"[8.16] [OAS] Support setting availability (#196647) (#197025)\n\n# Backport\n\nThis will backport the following commits from `main` to `8.16`:\n- [[OAS] Support setting availability\n(#196647)](https://github.com/elastic/kibana/pull/196647)\n\n<!--- Backport version: 9.4.3 -->\n\n### Questions ?\nPlease refer to the [Backport tool\ndocumentation](https://github.com/sqren/backport)\n\n<!--BACKPORT [{\"author\":{\"name\":\"Jean-Louis\nLeysens\",\"email\":\"[email protected]\"},\"sourceCommit\":{\"committedDate\":\"2024-10-21T10:30:45Z\",\"message\":\"[OAS]\nSupport setting availability (#196647)\\n\\n## Summary\\r\\n\\r\\nClose\nhttps://github.com//issues/181995\\r\\n\\r\\nRelated\nhttps://github.com//pull/195325\\r\\n\\r\\n\\r\\n###\nChecklist\\r\\n\\r\\n- [x] [Unit or\nfunctional\\r\\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\\r\\nwere\nupdated or added to match the most common\nscenarios\\r\\n\\r\\n---------\\r\\n\\r\\nCo-authored-by: Christiane (Tina)\nHeiligers\n<[email protected]>\",\"sha\":\"608cc70be56fa63cb68a93d480e545fa95c0846a\",\"branchLabelMapping\":{\"^v9.0.0$\":\"main\",\"^v8.17.0$\":\"8.x\",\"^v(\\\\d+).(\\\\d+).\\\\d+$\":\"$1.$2\"}},\"sourcePullRequest\":{\"labels\":[\"Team:Core\",\"release_note:skip\",\"v9.0.0\",\"Feature:OAS\",\"v8.16.0\",\"backport:version\"],\"title\":\"[OAS]\nSupport setting\navailability\",\"number\":196647,\"url\":\"https://github.com/elastic/kibana/pull/196647\",\"mergeCommit\":{\"message\":\"[OAS]\nSupport setting availability (#196647)\\n\\n## Summary\\r\\n\\r\\nClose\nhttps://github.com//issues/181995\\r\\n\\r\\nRelated\nhttps://github.com//pull/195325\\r\\n\\r\\n\\r\\n###\nChecklist\\r\\n\\r\\n- [x] [Unit or\nfunctional\\r\\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\\r\\nwere\nupdated or added to match the most common\nscenarios\\r\\n\\r\\n---------\\r\\n\\r\\nCo-authored-by: Christiane (Tina)\nHeiligers\n<[email protected]>\",\"sha\":\"608cc70be56fa63cb68a93d480e545fa95c0846a\"}},\"sourceBranch\":\"main\",\"suggestedTargetBranches\":[\"8.16\"],\"targetPullRequestStates\":[{\"branch\":\"main\",\"label\":\"v9.0.0\",\"branchLabelMappingKey\":\"^v9.0.0$\",\"isSourceBranch\":true,\"state\":\"MERGED\",\"url\":\"https://github.com/elastic/kibana/pull/196647\",\"number\":196647,\"mergeCommit\":{\"message\":\"[OAS]\nSupport setting availability (#196647)\\n\\n## Summary\\r\\n\\r\\nClose\nhttps://github.com//issues/181995\\r\\n\\r\\nRelated\nhttps://github.com//pull/195325\\r\\n\\r\\n\\r\\n###\nChecklist\\r\\n\\r\\n- [x] [Unit or\nfunctional\\r\\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\\r\\nwere\nupdated or added to match the most common\nscenarios\\r\\n\\r\\n---------\\r\\n\\r\\nCo-authored-by: Christiane (Tina)\nHeiligers\n<[email protected]>\",\"sha\":\"608cc70be56fa63cb68a93d480e545fa95c0846a\"}},{\"branch\":\"8.16\",\"label\":\"v8.16.0\",\"branchLabelMappingKey\":\"^v(\\\\d+).(\\\\d+).\\\\d+$\",\"isSourceBranch\":false,\"state\":\"NOT_CREATED\"}]}]\nBACKPORT-->\n\nCo-authored-by: Jean-Louis Leysens <[email protected]>"}},{"branch":"8.x","label":"v8.17.0","labelRegex":"^v8.17.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT-->
Summary
Close #181995
Related #195325
Enables API authors to set APIs overall availability to one of:
experimental
: the "loosest" commitment to a public API, may be removedbeta
: expect changes, but the intention is to reachstable
stable
: rock soild 🪨 , ain't going nowhere and safe to integrate with and expect long term support with a deprecation window of 18 monthsNote: at time of writing we still need to figure out what
experimental
andbeta
practically mean for APIs, but could enable a bit more iteration without versioning and maintenance overhead.Checklist