-
Notifications
You must be signed in to change notification settings - Fork 8.6k
Simplify OAS schema for GET /api/spaces/space query params
#260831
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
TinaHeiligers
merged 12 commits into
elastic:main
from
TinaHeiligers:fix/oas-spaces-include-authorized-purposes
Apr 14, 2026
Merged
Changes from 3 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
a3f53e7
Replace schema.conditional with schema.maybe(schema.boolean()) for in…
TinaHeiligers 2015e55
Changes from make api-docs
kibanamachine 3fa1d29
allowlist spaces API breaking change for include_authorized_purposes …
TinaHeiligers fdc0475
Update x-pack/platform/plugins/shared/spaces/server/routes/api/extern…
TinaHeiligers 4d04f0a
Update x-pack/platform/plugins/shared/spaces/server/routes/api/extern…
TinaHeiligers 3efb703
fix unescaped apostrophe in description string and regenerate OAS output
TinaHeiligers 114eff2
Merge branch 'main' into fix/oas-spaces-include-authorized-purposes
elasticmachine f0390f9
Merge branch 'main' into fix/oas-spaces-include-authorized-purposes
elasticmachine 2f10964
Merge branch 'main' into fix/oas-spaces-include-authorized-purposes
elasticmachine 5751160
Merge branch 'main' into fix/oas-spaces-include-authorized-purposes
elasticmachine f9797f8
Merge branch 'main' into fix/oas-spaces-include-authorized-purposes
elasticmachine 2de4d23
Merge branch 'main' into fix/oas-spaces-include-authorized-purposes
elasticmachine File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -36,35 +36,44 @@ export function initGetAllSpacesApi(deps: ExternalRouteDeps) { | |
| version: API_VERSIONS.public.v1, | ||
| validate: { | ||
| request: { | ||
| query: schema.object({ | ||
| purpose: schema.maybe( | ||
| schema.oneOf( | ||
| [ | ||
| schema.literal('any'), | ||
| schema.literal('copySavedObjectsIntoSpace'), | ||
| schema.literal('shareSavedObjectsIntoSpace'), | ||
| ], | ||
| { | ||
| query: schema.object( | ||
| { | ||
| purpose: schema.maybe( | ||
| schema.oneOf( | ||
| [ | ||
| schema.literal('any'), | ||
| schema.literal('copySavedObjectsIntoSpace'), | ||
| schema.literal('shareSavedObjectsIntoSpace'), | ||
| ], | ||
| { | ||
| meta: { | ||
| description: | ||
| 'Specifies which authorization checks are applied to the API call. The default value is `any`.', | ||
| }, | ||
| } | ||
| ) | ||
| ), | ||
| include_authorized_purposes: schema.maybe( | ||
| schema.boolean({ | ||
| meta: { | ||
| description: | ||
| 'Specifies which authorization checks are applied to the API call. The default value is `any`.', | ||
| 'When enabled, the API returns any spaces that the user is authorized to access in any capacity and each space will contain the purposes for which the user is authorized. This can be useful to determine which spaces a user can read but not take a specific action in. If the security plugin is not enabled, this parameter has no effect, since no authorization checks take place. This parameter cannot be used in with the `purpose` parameter.', | ||
| }, | ||
| }) | ||
| ), | ||
| }, | ||
| { | ||
| validate: (value) => { | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. preserves runtime validation |
||
| if ( | ||
| value.purpose && | ||
| value.include_authorized_purposes !== undefined && | ||
| value.include_authorized_purposes !== false | ||
| ) { | ||
| return 'include_authorized_purposes can only be false when purpose is specified'; | ||
| } | ||
| ) | ||
| ), | ||
| include_authorized_purposes: schema.conditional( | ||
| schema.siblingRef('purpose'), | ||
| schema.string(), | ||
| schema.maybe(schema.literal(false)), | ||
| schema.maybe(schema.boolean()), | ||
| { | ||
| meta: { | ||
| description: | ||
| 'When enabled, the API returns any spaces that the user is authorized to access in any capacity and each space will contain the purposes for which the user is authorized. This can be useful to determine which spaces a user can read but not take a specific action in. If the security plugin is not enabled, this parameter has no effect, since no authorization checks take place. This parameter cannot be used in with the `purpose` parameter.', | ||
| }, | ||
| } | ||
| ), | ||
| }), | ||
| }, | ||
| } | ||
| ), | ||
| }, | ||
| response: { | ||
| 200: { | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.