1 | import { ParameterObject } from '@loopback/openapi-v3';
|
2 |
|
3 |
|
4 |
|
5 | export type ValidationOptions = {
|
6 | required?: boolean;
|
7 | };
|
8 |
|
9 |
|
10 |
|
11 | export type ValidationContext = {
|
12 | parameterSpec: ParameterObject;
|
13 | };
|
14 |
|
15 |
|
16 |
|
17 |
|
18 | export declare class Validator {
|
19 | ctx: ValidationContext;
|
20 | constructor(ctx: ValidationContext);
|
21 | /**
|
22 | * The validation executed before type coercion. Like
|
23 | * checking absence.
|
24 | *
|
25 | * @param type - A parameter's type.
|
26 | * @param value - A parameter's raw value from http request.
|
27 | * @param opts - options
|
28 | */
|
29 | validateParamBeforeCoercion(value: string | object | undefined, opts?: ValidationOptions): void;
|
30 | /**
|
31 | * Check is a parameter required or not.
|
32 | *
|
33 | * @param opts
|
34 | */
|
35 | isRequired(opts?: ValidationOptions): boolean;
|
36 | /**
|
37 | * Return `true` if the value is empty, return `false` otherwise.
|
38 | *
|
39 | * @param value
|
40 | */
|
41 | isAbsent(value: any): boolean;
|
42 | /**
|
43 | * Return `true` if defined specification is for a url encoded Json object query parameter
|
44 | *
|
45 | * for url encoded Json object query parameters,
|
46 | * schema is defined under content['application/json']
|
47 | */
|
48 | isUrlEncodedJsonParam(): boolean;
|
49 | }
|