Skip to content

Commit

Permalink
Saved Objects export API stable type order (#42310)
Browse files Browse the repository at this point in the history
* Sorting export's valid types

* Updating the saved object api integration export test

* Fixing OSS also
  • Loading branch information
kobelb authored Jul 31, 2019
1 parent 305e4a2 commit f2f941f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/legacy/server/saved_objects/routes/export.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,13 @@ export const createExportRoute = (
payload: Joi.object()
.keys({
type: Joi.array()
.items(Joi.string().valid(supportedTypes))
.items(Joi.string().valid(supportedTypes.sort()))
.single()
.optional(),
objects: Joi.array()
.items({
type: Joi.string()
.valid(supportedTypes)
.valid(supportedTypes.sort())
.required(),
id: Joi.string().required(),
})
Expand Down
2 changes: 1 addition & 1 deletion test/api_integration/apis/saved_objects/export.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ export default function ({ getService }) {
statusCode: 400,
error: 'Bad Request',
message: 'child "type" fails because ["type" at position 0 fails because ' +
'["0" must be one of [config, index-pattern, visualization, search, dashboard, url]]]',
'["0" must be one of [config, dashboard, index-pattern, search, url, visualization]]]',
validation: {
source: 'payload',
keys: ['type.0'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export function exportTestSuiteFactory(esArchiver: any, supertest: SuperTest<any
expect(resp.body).to.eql({
statusCode: 400,
error: 'Bad Request',
message: `child \"objects\" fails because [\"objects\" at position 0 fails because [child \"type\" fails because [\"type\" must be one of [config, globaltype, map, canvas-workpad, canvas-element, index-pattern, visualization, search, dashboard, url]]]]`,
message: `child \"objects\" fails because [\"objects\" at position 0 fails because [child \"type\" fails because [\"type\" must be one of [canvas-element, canvas-workpad, config, dashboard, globaltype, index-pattern, map, search, url, visualization]]]]`,
validation: {
source: 'payload',
keys: ['objects.0.type'],
Expand Down

0 comments on commit f2f941f

Please sign in to comment.