Skip to content

Commit

Permalink
Remove deprecated & unused SavedObjectsImportFailure.title (#127043)
Browse files Browse the repository at this point in the history
  • Loading branch information
afharo authored Mar 9, 2022
1 parent f89d531 commit b9b4dc0
Show file tree
Hide file tree
Showing 24 changed files with 43 additions and 123 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,5 @@ export interface SavedObjectsImportFailure
| [id](./kibana-plugin-core-public.savedobjectsimportfailure.id.md) | string | |
| [meta](./kibana-plugin-core-public.savedobjectsimportfailure.meta.md) | { title?: string; icon?: string; } | |
| [overwrite?](./kibana-plugin-core-public.savedobjectsimportfailure.overwrite.md) | boolean | <i>(Optional)</i> If <code>overwrite</code> is specified, an attempt was made to overwrite an existing object. |
| [title?](./kibana-plugin-core-public.savedobjectsimportfailure.title.md) | string | <i>(Optional)</i> |
| [type](./kibana-plugin-core-public.savedobjectsimportfailure.type.md) | string | |

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,5 @@ export interface SavedObjectsImportFailure
| [id](./kibana-plugin-core-server.savedobjectsimportfailure.id.md) | string | |
| [meta](./kibana-plugin-core-server.savedobjectsimportfailure.meta.md) | { title?: string; icon?: string; } | |
| [overwrite?](./kibana-plugin-core-server.savedobjectsimportfailure.overwrite.md) | boolean | <i>(Optional)</i> If <code>overwrite</code> is specified, an attempt was made to overwrite an existing object. |
| [title?](./kibana-plugin-core-server.savedobjectsimportfailure.title.md) | string | <i>(Optional)</i> |
| [type](./kibana-plugin-core-server.savedobjectsimportfailure.type.md) | string | |

This file was deleted.

2 changes: 0 additions & 2 deletions src/core/public/public.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -1255,8 +1255,6 @@ export interface SavedObjectsImportFailure {
icon?: string;
};
overwrite?: boolean;
// @deprecated (undocumented)
title?: string;
// (undocumented)
type: string;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ describe('#importSavedObjectsFromStream', () => {
return {
type: 'foo-type',
id: uuidv4(),
title: 'some-title',
meta: { title },
error: { type: 'conflict' },
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,11 @@ describe('#checkConflicts', () => {
errors: [
{
...obj2Error,
title: obj2.attributes.title,
meta: { title: obj2.attributes.title },
error: { type: 'conflict' },
},
{
...obj4Error,
title: obj4.attributes.title,
meta: { title: obj4.attributes.title },
error: { ...obj4Error.error, type: 'unknown' },
},
Expand All @@ -136,7 +134,6 @@ describe('#checkConflicts', () => {
errors: [
{
...obj4Error,
title: obj4.attributes.title,
meta: { title: obj4.attributes.title },
error: { ...obj4Error.error, type: 'unknown' },
},
Expand Down Expand Up @@ -174,13 +171,11 @@ describe('#checkConflicts', () => {
errors: [
{
...obj2Error,
title: obj2.attributes.title,
meta: { title: obj2.attributes.title },
error: { type: 'conflict', destinationId: 'some-object-id' },
},
{
...obj4Error,
title: obj4.attributes.title,
meta: { title: obj4.attributes.title },
error: { ...obj4Error.error, type: 'unknown' },
},
Expand Down
4 changes: 2 additions & 2 deletions src/core/server/saved_objects/import/lib/check_conflicts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,10 @@ export async function checkConflicts({
importStateMap.set(`${type}:${id}`, { destinationId: uuidv4(), omitOriginId });
filteredObjects.push(object);
} else if (errorObj && errorObj.statusCode !== 409) {
errors.push({ type, id, title, meta: { title }, error: { ...errorObj, type: 'unknown' } });
errors.push({ type, id, meta: { title }, error: { ...errorObj, type: 'unknown' } });
} else if (errorObj?.statusCode === 409 && !ignoreRegularConflicts && !overwrite) {
const error = { type: 'conflict' as 'conflict', ...(destinationId && { destinationId }) };
errors.push({ type, id, title, meta: { title }, error });
errors.push({ type, id, meta: { title }, error });
} else {
filteredObjects.push(object);
if (errorObj?.statusCode === 409) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,6 @@ describe('#checkOriginConflicts', () => {
): SavedObjectsImportFailure => ({
type: object.type,
id: object.id,
title: object.attributes.title,
meta: { title: object.attributes.title },
error: {
type: 'ambiguous_conflict',
Expand All @@ -189,7 +188,6 @@ describe('#checkOriginConflicts', () => {
): SavedObjectsImportFailure => ({
type: object.type,
id: object.id,
title: object.attributes?.title,
meta: { title: object.attributes.title },
error: {
type: 'conflict',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,6 @@ export async function checkOriginConflicts({
errors.push({
type,
id,
title,
meta: { title },
error: {
type: 'conflict',
Expand All @@ -253,7 +252,6 @@ export async function checkOriginConflicts({
errors.push({
type,
id,
title,
meta: { title },
error: {
type: 'ambiguous_conflict',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ describe('collectSavedObjects()', () => {

const error = { type: 'unsupported_type' };
const { title } = obj1.attributes;
const errors = [{ error, type: obj1.type, id: obj1.id, title, meta: { title } }];
const errors = [{ error, type: obj1.type, id: obj1.id, meta: { title } }];
expect(result).toEqual({ collectedObjects: [], errors, importStateMap: new Map() });
});

Expand All @@ -174,7 +174,7 @@ describe('collectSavedObjects()', () => {
]);
const error = { type: 'unsupported_type' };
const { title } = obj2.attributes;
const errors = [{ error, type: obj2.type, id: obj2.id, title, meta: { title } }];
const errors = [{ error, type: obj2.type, id: obj2.id, meta: { title } }];
expect(result).toEqual({ collectedObjects, errors, importStateMap });
});

Expand All @@ -192,7 +192,7 @@ describe('collectSavedObjects()', () => {

const error = { type: 'unsupported_type' };
const { title } = obj1.attributes;
const errors = [{ error, type: obj1.type, id: obj1.id, title, meta: { title } }];
const errors = [{ error, type: obj1.type, id: obj1.id, meta: { title } }];
expect(result).toEqual({ collectedObjects: [], errors, importStateMap: new Map() });
});

Expand All @@ -215,7 +215,7 @@ describe('collectSavedObjects()', () => {
]);
const error = { type: 'unsupported_type' };
const { title } = obj1.attributes;
const errors = [{ error, type: obj1.type, id: obj1.id, title, meta: { title } }];
const errors = [{ error, type: obj1.type, id: obj1.id, meta: { title } }];
expect(result).toEqual({ collectedObjects, errors, importStateMap });
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ export async function collectSavedObjects({
errors.push({
id: obj.id,
type: obj.type,
title,
meta: { title },
error: {
type: 'unsupported_type',
Expand Down
77 changes: 37 additions & 40 deletions src/core/server/saved_objects/import/lib/extract_errors.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,45 +51,42 @@ describe('extractErrors()', () => {
];
const result = extractErrors(savedObjects, savedObjects);
expect(result).toMatchInlineSnapshot(`
Array [
Object {
"error": Object {
"type": "conflict",
},
"id": "2",
"meta": Object {
"title": "My Dashboard 2",
},
"title": "My Dashboard 2",
"type": "dashboard",
},
Object {
"error": Object {
"error": "Bad Request",
"message": "Bad Request",
"statusCode": 400,
"type": "unknown",
},
"id": "3",
"meta": Object {
"title": "My Dashboard 3",
},
"title": "My Dashboard 3",
"type": "dashboard",
},
Object {
"error": Object {
"destinationId": "foo",
"type": "conflict",
},
"id": "4",
"meta": Object {
"title": "My Dashboard 4",
},
"title": "My Dashboard 4",
"type": "dashboard",
},
]
`);
Array [
Object {
"error": Object {
"type": "conflict",
},
"id": "2",
"meta": Object {
"title": "My Dashboard 2",
},
"type": "dashboard",
},
Object {
"error": Object {
"error": "Bad Request",
"message": "Bad Request",
"statusCode": 400,
"type": "unknown",
},
"id": "3",
"meta": Object {
"title": "My Dashboard 3",
},
"type": "dashboard",
},
Object {
"error": Object {
"destinationId": "foo",
"type": "conflict",
},
"id": "4",
"meta": Object {
"title": "My Dashboard 4",
},
"type": "dashboard",
},
]
`);
});
});
2 changes: 0 additions & 2 deletions src/core/server/saved_objects/import/lib/extract_errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ export function extractErrors(
errors.push({
id: savedObject.id,
type: savedObject.type,
title,
meta: { title },
error: {
type: 'conflict',
Expand All @@ -42,7 +41,6 @@ export function extractErrors(
errors.push({
id: savedObject.id,
type: savedObject.type,
title,
meta: { title },
error: {
...savedObject.error,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ export async function validateReferences(params: ValidateReferencesParams) {
errorMap[`${type}:${id}`] = {
id,
type,
title,
meta: { title },
error: { type: 'missing_references', references: missingReferences },
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ describe('#importSavedObjectsFromStream', () => {
return {
type: 'foo-type',
id: uuidv4(),
title: 'some-title',
meta: { title },
error: { type: 'conflict' },
};
Expand Down
4 changes: 0 additions & 4 deletions src/core/server/saved_objects/import/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,6 @@ export interface SavedObjectsImportMissingReferencesError {
export interface SavedObjectsImportFailure {
id: string;
type: string;
/**
* @deprecated Use `meta.title` instead
*/
title?: string;
meta: { title?: string; icon?: string };
/**
* If `overwrite` is specified, an attempt was made to overwrite an existing object.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,6 @@ describe(`POST ${URL}`, () => {
{
id: mockIndexPattern.id,
type: mockIndexPattern.type,
title: mockIndexPattern.attributes.title,
meta: { title: mockIndexPattern.attributes.title, icon: 'index-pattern-icon' },
error: { type: 'conflict' },
},
Expand Down Expand Up @@ -322,7 +321,6 @@ describe(`POST ${URL}`, () => {
{
id: 'my-vis',
type: 'visualization',
title: 'my-vis',
meta: { title: 'my-vis', icon: 'visualization-icon' },
error: {
type: 'missing_references',
Expand Down Expand Up @@ -386,7 +384,6 @@ describe(`POST ${URL}`, () => {
{
id: 'my-vis',
type: 'visualization',
title: 'my-vis',
meta: { title: 'my-vis', icon: 'visualization-icon' },
error: {
type: 'missing_references',
Expand All @@ -396,7 +393,6 @@ describe(`POST ${URL}`, () => {
{
id: 'my-vis',
type: 'visualization',
title: 'my-vis',
meta: { title: 'my-vis', icon: 'visualization-icon' },
error: { type: 'conflict' },
},
Expand Down Expand Up @@ -457,7 +453,6 @@ describe(`POST ${URL}`, () => {
{
id: 'my-vis',
type: 'visualization',
title: 'my-vis',
meta: { title: 'my-vis', icon: 'visualization-icon' },
overwrite: true,
error: {
Expand Down
2 changes: 0 additions & 2 deletions src/core/server/server.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -2501,8 +2501,6 @@ export interface SavedObjectsImportFailure {
icon?: string;
};
overwrite?: boolean;
// @deprecated (undocumented)
title?: string;
// (undocumented)
type: string;
}
Expand Down
3 changes: 0 additions & 3 deletions test/api_integration/apis/saved_objects/import.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ const createConflictError = (
object: Omit<SavedObjectsImportFailure, 'error'>
): SavedObjectsImportFailure => ({
...object,
title: object.meta.title,
error: { type: 'conflict' },
});

Expand Down Expand Up @@ -123,7 +122,6 @@ export default function ({ getService }: FtrProviderContext) {
{
id: '1',
type: 'wigwags',
title: 'my title',
meta: { title: 'my title' },
error: { type: 'unsupported_type' },
},
Expand Down Expand Up @@ -221,7 +219,6 @@ export default function ({ getService }: FtrProviderContext) {
{
type: 'visualization',
id: '1',
title: 'My visualization',
meta: { title: 'My visualization', icon: 'visualizeApp' },
error: {
type: 'missing_references',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ export default function ({ getService }: PluginFunctionalProviderContext) {
{
id: 'some-id-1',
type: 'test-hidden-non-importable-exportable',
title: 'my title',
meta: {
title: 'my title',
},
Expand Down
Loading

0 comments on commit b9b4dc0

Please sign in to comment.