diff --git a/plugins/catalog-backend/src/service/request/common.ts b/plugins/catalog-backend/src/service/request/common.ts index 3e028349f1..5e3da47182 100644 --- a/plugins/catalog-backend/src/service/request/common.ts +++ b/plugins/catalog-backend/src/service/request/common.ts @@ -16,48 +16,6 @@ import { InputError } from '@backstage/errors'; -/** - * Takes a single unknown parameter and makes sure that it's a string that can - * be parsed as an integer. - */ -export function parseIntegerParam( - param: unknown, - ctx: string, -): number | undefined { - if (param === undefined) { - return undefined; - } - - if (typeof param !== 'string') { - throw new InputError(`Invalid ${ctx}, not an integer on string form`); - } - - const parsed = parseInt(param, 10); - if (!Number.isInteger(parsed) || String(parsed) !== param) { - throw new InputError(`Invalid ${ctx}, not an integer`); - } - - return parsed; -} - -/** - * Takes a single unknown parameter and makes sure that it's a string. - */ -export function parseStringParam( - param: unknown, - ctx: string, -): string | undefined { - if (param === undefined) { - return undefined; - } - - if (typeof param !== 'string') { - throw new InputError(`Invalid ${ctx}, not a string`); - } - - return param; -} - /** * Takes a single unknown parameter and makes sure that it's a single string or * an array of strings, and returns as an array.