Skip to content
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

Versioned common Space interface #160237

Merged
merged 10 commits into from
Jun 28, 2023

Conversation

jeramysoucy
Copy link
Contributor

Closes #159708

Summary

This PR replaces the common Space interface with a versioned interface per The road to versioned HTTP APIs doc, and guidance of Versioning Interfaces. Additionally, this PR replaces the implicit use of saved object attributes with an explicit conversion from the SO attributes to versioned interface properties.

Tests

  • x-pack/plugins/spaces/server/spaces_client/spaces_client_service.test.ts
  • x-pack/test/functional/apps/spaces
  • x-pack/test/api_integration/apis/spaces

@jeramysoucy jeramysoucy added Team:Security Team focused on: Auth, Users, Roles, Spaces, Audit Logging, and more! Feature:Security/Spaces Platform Security - Spaces feature release_note:skip Skip the PR/issue when compiling release notes backport:skip This commit does not require backporting v8.9.0 labels Jun 22, 2023
@@ -27,13 +27,14 @@ export const createMockSavedObjectsRepository = (spaces: any[] = []) => {
if (spaces.find((s) => s.id === id)) {
throw SavedObjectsErrorHelpers.decorateConflictError(new Error(), 'space conflict');
}
return {};
return { id, attributes };
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Returning a non-empty object now to satisfy the explicit conversion in the client.

throw SavedObjectsErrorHelpers.createGenericNotFoundError(type, id);
}
return {};
return result[0];
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Returning a non-empty object now to satisfy the explicit conversion in the client.

@jeramysoucy jeramysoucy marked this pull request as ready for review June 26, 2023 13:11
@jeramysoucy jeramysoucy requested a review from a team as a code owner June 26, 2023 13:11
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-security (Team:Security)

@kc13greiner kc13greiner self-requested a review June 27, 2023 19:08
Copy link
Contributor

@kc13greiner kc13greiner left a comment

Choose a reason for hiding this comment

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

Looking good so far 🚀 I think adding the additional fields to the test data will help lock in the
expected transform

_reserved: savedObject.attributes._reserved,
} as v1.Space;
}

private generateSpaceAttributes(space: v1.Space) {
return omit(space, ['id', '_reserved']);
return {
Copy link
Contributor

Choose a reason for hiding this comment

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

++ nice!

Copy link
Contributor

@kc13greiner kc13greiner left a comment

Choose a reason for hiding this comment

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

LGTM!

@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
spaces 261 263 +2

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
spaces 25.8KB 25.9KB +56.0B
Unknown metric groups

ESLint disabled line counts

id before after diff
enterpriseSearch 14 16 +2
securitySolution 413 417 +4
total +6

Total ESLint disabled count

id before after diff
enterpriseSearch 15 17 +2
securitySolution 492 496 +4
total +6

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@jeramysoucy jeramysoucy merged commit 870d92b into elastic:main Jun 28, 2023
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:Security/Spaces Platform Security - Spaces feature release_note:skip Skip the PR/issue when compiling release notes Team:Security Team focused on: Auth, Users, Roles, Spaces, Audit Logging, and more! v8.10.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create a versioned common Space interface for Spaces API endpoints
5 participants