Skip to content

Commit

Permalink
Use @kbn/config-schema (not validate: false) on routes!
Browse files Browse the repository at this point in the history
  • Loading branch information
jloleysens committed Dec 10, 2019
1 parent c47884c commit 61078aa
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/

import { schema } from '@kbn/config-schema';
import { RequestHandler } from 'src/core/server';
import { reduce, size } from 'lodash';
import { callWithRequestFactory } from '../../../lib/call_with_request_factory';
Expand Down Expand Up @@ -82,7 +83,9 @@ export function registerGetRoute(deps: RouteDependencies, legacy: ServerShim) {
deps.router.post(
{
path: '/api/watcher/indices',
validate: false,
validate: {
body: schema.object({}, { allowUnknowns: true }),
},
},
licensePreRoutingFactory(legacy, handler)
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/

import { schema } from '@kbn/config-schema';
import { RequestHandler } from 'src/core/server';
import { callWithRequestFactory } from '../../lib/call_with_request_factory';
import { isEsError } from '../../lib/is_es_error';
Expand Down Expand Up @@ -53,7 +54,11 @@ export function registerListFieldsRoute(deps: RouteDependencies, legacy: ServerS
deps.router.post(
{
path: '/api/watcher/fields',
validate: false,
validate: {
body: schema.object({
indexes: schema.arrayOf(schema.string()),
}),
},
},
licensePreRoutingFactory(legacy, handler)
);
Expand Down

0 comments on commit 61078aa

Please sign in to comment.