Skip to content

[OAS] Update x-state behaviour to include availability.since #221137

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

Merged
merged 10 commits into from
May 27, 2025

Conversation

jloleysens
Copy link
Contributor

Summary

Updated the behaviour of setXState per #221056.

Partially addresses that issue. In future we need to migrate existing routes to add that information, this covers the Core provided capability.

Checklist

@jloleysens jloleysens self-assigned this May 21, 2025
@jloleysens jloleysens requested a review from a team as a code owner May 21, 2025 15:19
@jloleysens jloleysens added Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc release_note:skip Skip the PR/issue when compiling release notes backport:skip This commit does not require backporting Feature:OAS Work or issues related to Core-provided mechanisms for generating OAS labels May 21, 2025
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-core (Team:Core)

@jloleysens jloleysens requested a review from Copilot May 21, 2025 15:19
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR updates the behavior of setXState to incorporate the availability.since property, enhancing the x-state description for operations based on their stability and version introduction.

  • Updated setXState logic to support a new "stable" state and attach release version details.
  • Added comprehensive test cases in util.test.ts for different availability scenarios.
  • Adjusted the CustomOperationObject type in type.ts to allow a broader x-state string value.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/platform/packages/shared/kbn-router-to-openapispec/src/util.ts Updated setXState to include a stable state and version information from availability.since
src/platform/packages/shared/kbn-router-to-openapispec/src/util.test.ts Added tests covering various availability configurations, including cases with only "since" provided
src/platform/packages/shared/kbn-router-to-openapispec/src/type.ts Modified the x-state property type to accept any string value

kibanamachine and others added 7 commits May 21, 2025 15:40
…t --include-path /api/status --include-path /api/alerting/rule/ --include-path /api/alerting/rules --include-path /api/actions --include-path /api/security/role --include-path /api/spaces --include-path /api/streams --include-path /api/fleet --include-path /api/dashboards --include-path /api/saved_objects/_import --include-path /api/saved_objects/_export --include-path /api/alerting/maintenance_window --update'
@elasticmachine
Copy link
Contributor

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] FTR Configs #7 / serverless search UI - feature flags Serverless Synonyms Overview Synonyms get started Page should not override existing synonyms set unless specified

Metrics [docs]

✅ unchanged

History

cc @jloleysens

Copy link
Contributor

@jesuswr jesuswr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, left a question 😄

Comment on lines +190 to +192
if (availability.stability === 'stable') {
state = 'Generally available';
} else if (availability.stability === 'experimental') {
Copy link
Contributor

@jesuswr jesuswr May 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reading the issue it says

if availability.stability = stable, since should be mandatory and x-state should be "Generally available; added in xxx" where xxxx is the since value.

How strict should we be with the mandatory? Do we need to throw an error or log a warning if it doesn't exist? Or maybe it's not that important

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good q. I avoided making these required for now in favour of getting the functionality merged in. My reasoning was that I'd keep things a bit more flexible for now rather than incur any refactoring outside of this code. It could be that as a next step we should follow up on this.

@jloleysens jloleysens merged commit feb0e96 into elastic:main May 27, 2025
10 checks passed
@jloleysens jloleysens deleted the oas/update-x-state-behaviour branch May 27, 2025 09:47
akowalska622 pushed a commit to akowalska622/kibana that referenced this pull request May 29, 2025
…stic#221137)

## Summary

Updated the behaviour of `setXState` per
elastic#221056.

Partially addresses that issue. In future we need to migrate existing
routes to add that information, this covers the Core provided
capability.


### 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: kibanamachine <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting Feature:OAS Work or issues related to Core-provided mechanisms for generating OAS release_note:skip Skip the PR/issue when compiling release notes Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc v9.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants