-
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
Versioned common Space interface #160237
Versioned common Space interface #160237
Conversation
@@ -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 }; |
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.
Returning a non-empty object now to satisfy the explicit conversion in the client.
throw SavedObjectsErrorHelpers.createGenericNotFoundError(type, id); | ||
} | ||
return {}; | ||
return result[0]; |
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.
Returning a non-empty object now to satisfy the explicit conversion in the client.
x-pack/plugins/spaces/server/spaces_client/spaces_client.test.ts
Outdated
Show resolved
Hide resolved
Pinging @elastic/kibana-security (Team:Security) |
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.
Looking good so far 🚀 I think adding the additional fields to the test data will help lock in the
expected transform
x-pack/plugins/spaces/server/spaces_client/spaces_client.test.ts
Outdated
Show resolved
Hide resolved
…-ref HEAD~1..HEAD --fix'
_reserved: savedObject.attributes._reserved, | ||
} as v1.Space; | ||
} | ||
|
||
private generateSpaceAttributes(space: v1.Space) { | ||
return omit(space, ['id', '_reserved']); | ||
return { |
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.
++ nice!
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.
LGTM!
💚 Build Succeeded
Metrics [docs]Module Count
Page load bundle
Unknown metric groupsESLint disabled line counts
Total ESLint disabled count
History
To update your PR or re-run it, just comment with: |
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