@@ -1254,3 +1254,44 @@ function obj0(path, value, context) {
1254
1254
return result ;
1255
1255
} "
1256
1256
` ;
1257
+
1258
+ exports [` Integer negative 1` ] = `
1259
+ "/**
1260
+ Validate a request against the OpenAPI spec
1261
+ @param { { method: string ; path : string ; body ?: any ; query : Record < string , string | string[]>; headers: Record < string , string>; }} request - Input request to validate
1262
+ @param { { stringFormats?: { [format : string ]: (value : string , path : string []) => ValidationError | string | null } } } [context] - Context object to pass to validation functions
1263
+ @returns { { operationId?: string; params: Record < string , string>; query: Record < string , string | string[]>; body?: any; headers: Record < string , string>; }}
1264
+ */
1265
+ export function validateRequest(request, context) {
1266
+ return new RequestError (404 , ' no operation match path' );
1267
+ }
1268
+ /**
1269
+ Map of all components defined in the spec to their validation functions.
1270
+ { Object .< string , <T >(path : string [], value : T , context : any ) => (T | ValidationError )> }
1271
+ */
1272
+ export const componentSchemas = { } ;
1273
+ export class RequestError extends Error {
1274
+ /** @param {number} code HTTP code for the error
1275
+ @param {string} message The error message*/
1276
+ constructor (code , message ) {
1277
+ super(message );
1278
+ /** @type {number} HTTP code for the error*/
1279
+ this.code = code;
1280
+ }
1281
+ }
1282
+ export class ValidationError extends RequestError {
1283
+ /** @param {string[]} path The path that failed validation
1284
+ @param {string} message The error message*/
1285
+ constructor (path , message ) {
1286
+ super(409, message );
1287
+ /** @type {string[]} The path that failed validation*/
1288
+ this.path = path;
1289
+ }
1290
+ }
1291
+ function obj0(path, value, context) {
1292
+ if (value !== - 1 && value !== 0 && value !== 1 ) {
1293
+ return new ValidationError(path , 'expected one of the enum value ');
1294
+ }
1295
+ return value ;
1296
+ } "
1297
+ ` ;
0 commit comments