Skip to content

Commit

Permalink
allow unknow query paramters for ui settings route (opensearch-projec…
Browse files Browse the repository at this point in the history
…t#8152)

Signed-off-by: Hailong Cui <[email protected]>
  • Loading branch information
Hailong-am authored Sep 12, 2024
1 parent 8f8ecfd commit ba8c50b
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 ba8c50b

Please sign in to comment.