Skip to content

Commit

Permalink
allow unknow query paramters for ui settings route (#8152) (#8158)
Browse files Browse the repository at this point in the history
(cherry picked from commit ba8c50b)

Signed-off-by: Hailong Cui <ihailong@amazon.com>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
1 parent a87ce21 commit 30a49b2
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 20 deletions.
13 changes: 8 additions & 5 deletions src/core/server/ui_settings/routes/delete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,14 @@ const validate = {
params: schema.object({
key: schema.string(),
}),
query: schema.object({
scope: schema.maybe(
schema.oneOf([schema.literal(UiSettingScope.GLOBAL), schema.literal(UiSettingScope.USER)])
),
}),
query: schema.object(
{
scope: schema.maybe(
schema.oneOf([schema.literal(UiSettingScope.GLOBAL), schema.literal(UiSettingScope.USER)])
),
},
{ unknowns: 'allow' }
),
};

export function registerDeleteRoute(router: IRouter) {
Expand Down
13 changes: 8 additions & 5 deletions src/core/server/ui_settings/routes/get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,14 @@ import { SavedObjectsErrorHelpers } from '../../saved_objects';
import { UiSettingScope } from '../types';

const validate = {
query: schema.object({
scope: schema.maybe(
schema.oneOf([schema.literal(UiSettingScope.GLOBAL), schema.literal(UiSettingScope.USER)])
),
}),
query: schema.object(
{
scope: schema.maybe(
schema.oneOf([schema.literal(UiSettingScope.GLOBAL), schema.literal(UiSettingScope.USER)])
),
},
{ unknowns: 'allow' }
),
};

export function registerGetRoute(router: IRouter) {
Expand Down
13 changes: 8 additions & 5 deletions src/core/server/ui_settings/routes/set.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,14 @@ const validate = {
body: schema.object({
value: schema.any(),
}),
query: schema.object({
scope: schema.maybe(
schema.oneOf([schema.literal(UiSettingScope.GLOBAL), schema.literal(UiSettingScope.USER)])
),
}),
query: schema.object(
{
scope: schema.maybe(
schema.oneOf([schema.literal(UiSettingScope.GLOBAL), schema.literal(UiSettingScope.USER)])
),
},
{ unknowns: 'allow' }
),
};

export function registerSetRoute(router: IRouter) {
Expand Down
13 changes: 8 additions & 5 deletions src/core/server/ui_settings/routes/set_many.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,14 @@ const validate = {
body: schema.object({
changes: schema.object({}, { unknowns: 'allow' }),
}),
query: schema.object({
scope: schema.maybe(
schema.oneOf([schema.literal(UiSettingScope.GLOBAL), schema.literal(UiSettingScope.USER)])
),
}),
query: schema.object(
{
scope: schema.maybe(
schema.oneOf([schema.literal(UiSettingScope.GLOBAL), schema.literal(UiSettingScope.USER)])
),
},
{ unknowns: 'allow' }
),
};

export function registerSetManyRoute(router: IRouter) {
Expand Down

0 comments on commit 30a49b2

Please sign in to comment.