Skip to content

Commit

Permalink
remove query validation
Browse files Browse the repository at this point in the history
Signed-off-by: Hailong Cui <[email protected]>
  • Loading branch information
Hailong-am committed Sep 12, 2024
1 parent 6bb95a5 commit 14002d7
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 34 deletions.
7 changes: 0 additions & 7 deletions src/core/server/ui_settings/routes/delete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,11 @@ import { schema } from '@osd/config-schema';
import { IRouter } from '../../http';
import { SavedObjectsErrorHelpers } from '../../saved_objects';
import { CannotOverrideError } from '../ui_settings_errors';
import { UiSettingScope } from '../types';

const validate = {
params: schema.object({
key: schema.string(),
}),
query: schema.object({
scope: schema.maybe(
schema.oneOf([schema.literal(UiSettingScope.GLOBAL), schema.literal(UiSettingScope.USER)])
),
security_tenant: schema.maybe(schema.any()),
}),
};

export function registerDeleteRoute(router: IRouter) {
Expand Down
14 changes: 1 addition & 13 deletions src/core/server/ui_settings/routes/get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,24 +28,12 @@
* under the License.
*/

import { schema } from '@osd/config-schema';

import { IRouter } from '../../http';
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)])
),
security_tenant: schema.maybe(schema.any()),
}),
};

export function registerGetRoute(router: IRouter) {
router.get(
{ path: '/api/opensearch-dashboards/settings', validate },
{ path: '/api/opensearch-dashboards/settings', validate: false },
async (context, request, response) => {
try {
const uiSettingsClient = context.core.uiSettings.client;
Expand Down
7 changes: 0 additions & 7 deletions src/core/server/ui_settings/routes/set.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ import { schema, ValidationError } from '@osd/config-schema';
import { IRouter } from '../../http';
import { SavedObjectsErrorHelpers } from '../../saved_objects';
import { CannotOverrideError } from '../ui_settings_errors';
import { UiSettingScope } from '../types';

const validate = {
params: schema.object({
Expand All @@ -42,12 +41,6 @@ const validate = {
body: schema.object({
value: schema.any(),
}),
query: schema.object({
scope: schema.maybe(
schema.oneOf([schema.literal(UiSettingScope.GLOBAL), schema.literal(UiSettingScope.USER)])
),
security_tenant: schema.maybe(schema.any()),
}),
};

export function registerSetRoute(router: IRouter) {
Expand Down
7 changes: 0 additions & 7 deletions src/core/server/ui_settings/routes/set_many.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,11 @@ import { schema, ValidationError } from '@osd/config-schema';
import { IRouter } from '../../http';
import { SavedObjectsErrorHelpers } from '../../saved_objects';
import { CannotOverrideError } from '../ui_settings_errors';
import { UiSettingScope } from '../types';

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)])
),
security_tenant: schema.maybe(schema.any()),
}),
};

export function registerSetManyRoute(router: IRouter) {
Expand Down

0 comments on commit 14002d7

Please sign in to comment.