Interface ApiXUrlQueryParameterValidator

An interface for a validator of a URL query parameter.

// validates a search keywords parameter.
class KeywordsUrlQueryParameterValidator implements ApiXUrlQueryParameterValidator {
isValid(name: string, value: string): boolean {
// keyword are only alphanumeric with limited punctuation. Example only.
const regex = /^[a-zA-Z0-9.,'" ]+$/;
return regex.test(value);
}
}
interface ApiXUrlQueryParameterValidator {
    isValid(name: string, value: string): boolean;
}

Methods

Methods

  • Determines whether the value for the parameter is valid.

    Parameters

    • name: string

      The name of the parameter to validate.

    • value: string

      The value of the parameter to validate.

    Returns boolean

    true if the parameter is valid and false otherwise.