From 9c32a2859710cc63438f3b45cc1d12954879a666 Mon Sep 17 00:00:00 2001 From: ivaosthu Date: Fri, 10 May 2019 13:47:56 +0200 Subject: [PATCH] fix: Application fields should be optional. --- CHANGELOG.md | 1 + lib/routes/admin-api/metrics-schema.js | 22 +++++++++++++++++----- lib/routes/admin-api/metrics.test.js | 12 ++++++++++++ 3 files changed, 30 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e78455bd90..94d273c529 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## 3.2.10 +- fix: Strategies should not be required for updateding application details - feat: boolean strategy paramters ## 3.2.9 diff --git a/lib/routes/admin-api/metrics-schema.js b/lib/routes/admin-api/metrics-schema.js index d020716853..e6ca5b57f7 100644 --- a/lib/routes/admin-api/metrics-schema.js +++ b/lib/routes/admin-api/metrics-schema.js @@ -11,12 +11,24 @@ const applicationSchema = joi sdkVersion: joi.string().optional(), strategies: joi .array() - .required() + .optional() .items(joi.string(), joi.any().strip()), - description: joi.string().optional(), - url: joi.string().optional(), - color: joi.string().optional(), - icon: joi.string().optional(), + description: joi + .string() + .allow('') + .optional(), + url: joi + .string() + .allow('') + .optional(), + color: joi + .string() + .allow('') + .optional(), + icon: joi + .string() + .allow('') + .optional(), }); module.exports = applicationSchema; diff --git a/lib/routes/admin-api/metrics.test.js b/lib/routes/admin-api/metrics.test.js index c68590b785..08bb6603da 100644 --- a/lib/routes/admin-api/metrics.test.js +++ b/lib/routes/admin-api/metrics.test.js @@ -142,3 +142,15 @@ test('should store application', t => { .send({ appName, strategies: ['default'] }) .expect(202); }); + +test('should store application details wihtout strategies', t => { + t.plan(0); + const { request, perms } = getSetup(); + const appName = '123!23'; + perms.withPermissions(UPDATE_APPLICATION); + + return request + .post(`/api/admin/metrics/applications/${appName}`) + .send({ appName, url: 'htto://asd.com' }) + .expect(202); +});