Skip to content

Commit 013de84

Browse files
committed
Tweak SavedObjectsClient.resolve() return type
The server-side implementation returned a `saved_object` field, while the client-side implementation returned a `savedObject` field. I originally used the former to align with return types like that from `bulkGet()`, `bulkUpdate()`, etc., but I think it makes more sense to use snakeCase on both client- and server-side for simplicity.
1 parent 0f05ecf commit 013de84

24 files changed

+60
-60
lines changed

docs/api/saved-objects/resolve.asciidoc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ The API returns the following:
5252
[source,sh]
5353
--------------------------------------------------
5454
{
55-
"saved_object": {
55+
"savedObject": {
5656
"id": "my-pattern",
5757
"type": "index-pattern",
5858
"version": 1,
@@ -67,8 +67,8 @@ The API returns the following:
6767
The `outcome` field may be any of the following:
6868

6969
* `"exactMatch"` -- One document exactly matched the given ID.
70-
* `"aliasMatch"` -- One document with a legacy URL alias matched the given ID; in this case the `saved_object.id` field is different than the given ID.
71-
* `"conflict"` -- Two documents matched the given ID, one was an exact match and another with a legacy URL alias; in this case the `saved_object` object is the exact match, and the `saved_object.id` field is the same as the given ID.
70+
* `"aliasMatch"` -- One document with a legacy URL alias matched the given ID; in this case the `savedObject.id` field is different than the given ID.
71+
* `"conflict"` -- Two documents matched the given ID, one was an exact match and another with a legacy URL alias; in this case the `savedObject` object is the exact match, and the `savedObject.id` field is the same as the given ID.
7272

7373
Retrieve a dashboard object in the `testspace` by ID:
7474

@@ -83,7 +83,7 @@ The API returns the following:
8383
[source,sh]
8484
--------------------------------------------------
8585
{
86-
"saved_object": {
86+
"savedObject": {
8787
"id": "7adfa750-4c81-11e8-b3d7-01146121b73d",
8888
"type": "dashboard",
8989
"updated_at": "2019-07-23T00:11:07.059Z",

docs/development/core/public/kibana-plugin-core-public.savedobjectsresolveresponse.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ export interface SavedObjectsResolveResponse<T = unknown>
1616
| Property | Type | Description |
1717
| --- | --- | --- |
1818
| [aliasTargetId](./kibana-plugin-core-public.savedobjectsresolveresponse.aliastargetid.md) | <code>string</code> | The ID of the object that the legacy URL alias points to. This is only defined when the outcome is <code>'aliasMatch'</code> or <code>'conflict'</code>. |
19-
| [outcome](./kibana-plugin-core-public.savedobjectsresolveresponse.outcome.md) | <code>'exactMatch' &#124; 'aliasMatch' &#124; 'conflict'</code> | The outcome for a successful <code>resolve</code> call is one of the following values:<!-- -->\* <code>'exactMatch'</code> -- One document exactly matched the given ID. \* <code>'aliasMatch'</code> -- One document with a legacy URL alias matched the given ID; in this case the <code>saved_object.id</code> field is different than the given ID. \* <code>'conflict'</code> -- Two documents matched the given ID, one was an exact match and another with a legacy URL alias; in this case the <code>saved_object</code> object is the exact match, and the <code>saved_object.id</code> field is the same as the given ID. |
20-
| [saved\_object](./kibana-plugin-core-public.savedobjectsresolveresponse.saved_object.md) | <code>SavedObject&lt;T&gt;</code> | The saved object that was found. |
19+
| [outcome](./kibana-plugin-core-public.savedobjectsresolveresponse.outcome.md) | <code>'exactMatch' &#124; 'aliasMatch' &#124; 'conflict'</code> | The outcome for a successful <code>resolve</code> call is one of the following values:<!-- -->\* <code>'exactMatch'</code> -- One document exactly matched the given ID. \* <code>'aliasMatch'</code> -- One document with a legacy URL alias matched the given ID; in this case the <code>savedObject.id</code> field is different than the given ID. \* <code>'conflict'</code> -- Two documents matched the given ID, one was an exact match and another with a legacy URL alias; in this case the <code>savedObject</code> object is the exact match, and the <code>savedObject.id</code> field is the same as the given ID. |
20+
| [savedObject](./kibana-plugin-core-public.savedobjectsresolveresponse.savedobject.md) | <code>SavedObject&lt;T&gt;</code> | The saved object that was found. |
2121

docs/development/core/public/kibana-plugin-core-public.savedobjectsresolveresponse.outcome.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
The outcome for a successful `resolve` call is one of the following values:
88

9-
\* `'exactMatch'` -- One document exactly matched the given ID. \* `'aliasMatch'` -- One document with a legacy URL alias matched the given ID; in this case the `saved_object.id` field is different than the given ID. \* `'conflict'` -- Two documents matched the given ID, one was an exact match and another with a legacy URL alias; in this case the `saved_object` object is the exact match, and the `saved_object.id` field is the same as the given ID.
9+
\* `'exactMatch'` -- One document exactly matched the given ID. \* `'aliasMatch'` -- One document with a legacy URL alias matched the given ID; in this case the `savedObject.id` field is different than the given ID. \* `'conflict'` -- Two documents matched the given ID, one was an exact match and another with a legacy URL alias; in this case the `savedObject` object is the exact match, and the `savedObject.id` field is the same as the given ID.
1010

1111
<b>Signature:</b>
1212

Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
22

3-
[Home](./index.md) &gt; [kibana-plugin-core-public](./kibana-plugin-core-public.md) &gt; [SavedObjectsResolveResponse](./kibana-plugin-core-public.savedobjectsresolveresponse.md) &gt; [saved\_object](./kibana-plugin-core-public.savedobjectsresolveresponse.saved_object.md)
3+
[Home](./index.md) &gt; [kibana-plugin-core-public](./kibana-plugin-core-public.md) &gt; [SavedObjectsResolveResponse](./kibana-plugin-core-public.savedobjectsresolveresponse.md) &gt; [savedObject](./kibana-plugin-core-public.savedobjectsresolveresponse.savedobject.md)
44

5-
## SavedObjectsResolveResponse.saved\_object property
5+
## SavedObjectsResolveResponse.savedObject property
66

77
The saved object that was found.
88

99
<b>Signature:</b>
1010

1111
```typescript
12-
saved_object: SavedObject<T>;
12+
savedObject: SavedObject<T>;
1313
```

docs/development/core/server/kibana-plugin-core-server.savedobjectsrepository.resolve.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,5 @@ resolve<T = unknown>(type: string, id: string, options?: SavedObjectsBaseOptions
2424
2525
`Promise<SavedObjectsResolveResponse<T>>`
2626
27-
{<!-- -->promise<!-- -->} - { saved\_object, outcome }
27+
{<!-- -->promise<!-- -->} - { savedObject, outcome }
2828

docs/development/core/server/kibana-plugin-core-server.savedobjectsresolveresponse.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ export interface SavedObjectsResolveResponse<T = unknown>
1616
| Property | Type | Description |
1717
| --- | --- | --- |
1818
| [aliasTargetId](./kibana-plugin-core-server.savedobjectsresolveresponse.aliastargetid.md) | <code>string</code> | The ID of the object that the legacy URL alias points to. This is only defined when the outcome is <code>'aliasMatch'</code> or <code>'conflict'</code>. |
19-
| [outcome](./kibana-plugin-core-server.savedobjectsresolveresponse.outcome.md) | <code>'exactMatch' &#124; 'aliasMatch' &#124; 'conflict'</code> | The outcome for a successful <code>resolve</code> call is one of the following values:<!-- -->\* <code>'exactMatch'</code> -- One document exactly matched the given ID. \* <code>'aliasMatch'</code> -- One document with a legacy URL alias matched the given ID; in this case the <code>saved_object.id</code> field is different than the given ID. \* <code>'conflict'</code> -- Two documents matched the given ID, one was an exact match and another with a legacy URL alias; in this case the <code>saved_object</code> object is the exact match, and the <code>saved_object.id</code> field is the same as the given ID. |
20-
| [saved\_object](./kibana-plugin-core-server.savedobjectsresolveresponse.saved_object.md) | <code>SavedObject&lt;T&gt;</code> | The saved object that was found. |
19+
| [outcome](./kibana-plugin-core-server.savedobjectsresolveresponse.outcome.md) | <code>'exactMatch' &#124; 'aliasMatch' &#124; 'conflict'</code> | The outcome for a successful <code>resolve</code> call is one of the following values:<!-- -->\* <code>'exactMatch'</code> -- One document exactly matched the given ID. \* <code>'aliasMatch'</code> -- One document with a legacy URL alias matched the given ID; in this case the <code>savedObject.id</code> field is different than the given ID. \* <code>'conflict'</code> -- Two documents matched the given ID, one was an exact match and another with a legacy URL alias; in this case the <code>savedObject</code> object is the exact match, and the <code>savedObject.id</code> field is the same as the given ID. |
20+
| [savedObject](./kibana-plugin-core-server.savedobjectsresolveresponse.savedobject.md) | <code>SavedObject&lt;T&gt;</code> | The saved object that was found. |
2121

docs/development/core/server/kibana-plugin-core-server.savedobjectsresolveresponse.outcome.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
The outcome for a successful `resolve` call is one of the following values:
88

9-
\* `'exactMatch'` -- One document exactly matched the given ID. \* `'aliasMatch'` -- One document with a legacy URL alias matched the given ID; in this case the `saved_object.id` field is different than the given ID. \* `'conflict'` -- Two documents matched the given ID, one was an exact match and another with a legacy URL alias; in this case the `saved_object` object is the exact match, and the `saved_object.id` field is the same as the given ID.
9+
\* `'exactMatch'` -- One document exactly matched the given ID. \* `'aliasMatch'` -- One document with a legacy URL alias matched the given ID; in this case the `savedObject.id` field is different than the given ID. \* `'conflict'` -- Two documents matched the given ID, one was an exact match and another with a legacy URL alias; in this case the `savedObject` object is the exact match, and the `savedObject.id` field is the same as the given ID.
1010

1111
<b>Signature:</b>
1212

Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
22

3-
[Home](./index.md) &gt; [kibana-plugin-core-server](./kibana-plugin-core-server.md) &gt; [SavedObjectsResolveResponse](./kibana-plugin-core-server.savedobjectsresolveresponse.md) &gt; [saved\_object](./kibana-plugin-core-server.savedobjectsresolveresponse.saved_object.md)
3+
[Home](./index.md) &gt; [kibana-plugin-core-server](./kibana-plugin-core-server.md) &gt; [SavedObjectsResolveResponse](./kibana-plugin-core-server.savedobjectsresolveresponse.md) &gt; [savedObject](./kibana-plugin-core-server.savedobjectsresolveresponse.savedobject.md)
44

5-
## SavedObjectsResolveResponse.saved\_object property
5+
## SavedObjectsResolveResponse.savedObject property
66

77
The saved object that was found.
88

99
<b>Signature:</b>
1010

1111
```typescript
12-
saved_object: SavedObject<T>;
12+
savedObject: SavedObject<T>;
1313
```

src/core/public/public.api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1520,7 +1520,7 @@ export type SavedObjectsNamespaceType = 'single' | 'multiple' | 'multiple-isolat
15201520
export interface SavedObjectsResolveResponse<T = unknown> {
15211521
aliasTargetId?: string;
15221522
outcome: 'exactMatch' | 'aliasMatch' | 'conflict';
1523-
saved_object: SavedObject<T>;
1523+
savedObject: SavedObject<T>;
15241524
}
15251525

15261526
// @public (undocumented)

src/core/public/saved_objects/saved_objects_client.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ describe('SavedObjectsClient', () => {
153153
beforeEach(() => {
154154
beforeEach(() => {
155155
http.fetch.mockResolvedValue({
156-
saved_object: doc,
156+
savedObject: doc,
157157
outcome: 'conflict',
158158
aliasTargetId: 'another-id',
159159
} as SavedObjectsResolveResponse);

0 commit comments

Comments
 (0)