@@ -39,6 +39,174 @@ function obj0(path, value, context) {
39
39
} "
40
40
` ;
41
41
42
+ exports [` Number maximum 1` ] = `
43
+ "/**
44
+ Validate a request against the OpenAPI spec
45
+ @param { { method: string ; path : string ; body ?: any ; query : Record < string , string>; headers: Record < string , string>; }} request - Input request to validate
46
+ @param { { stringFormats?: { [format : string ]: (value : string , path : string []) => ValidationError | null } } } [context] - Context object to pass to validation functions
47
+ @returns { { operationId?: string; params: Record < string , string>; query: Record < string , string>; body?: any; headers: Record < string , string>; }}
48
+ */
49
+ export function validateRequest(request, context) {
50
+ return new RequestError (404 , ' no operation match path' );
51
+ }
52
+ export class RequestError extends Error {
53
+ /** @param {number} code HTTP code for the error
54
+ @param {string} message The error message*/
55
+ constructor (code , message ) {
56
+ super(message );
57
+ /** @type {number} HTTP code for the error*/
58
+ this.code = code;
59
+ }
60
+ }
61
+ export class ValidationError extends RequestError {
62
+ /** @param {string[]} path The path that failed validation
63
+ @param {string} message The error message*/
64
+ constructor (path , message ) {
65
+ super(409, message );
66
+ /** @type {string[]} The path that failed validation*/
67
+ this.path = path;
68
+ }
69
+ }
70
+ function obj0(path, value, context) {
71
+ if (typeof value === ' string' ) {
72
+ value = Number(value );
73
+ }
74
+ if (typeof value !== ' number' || Number .isNaN (value )) {
75
+ return new ValidationError(path , 'expected a number ');
76
+ }
77
+ if (value > 10 ) {
78
+ return new ValidationError(path , 'value greater than maximum ');
79
+ }
80
+ return value ;
81
+ } "
82
+ ` ;
83
+
84
+ exports [` Number maximum exclusiveMaximum 1` ] = `
85
+ "/**
86
+ Validate a request against the OpenAPI spec
87
+ @param { { method: string ; path : string ; body ?: any ; query : Record < string , string>; headers: Record < string , string>; }} request - Input request to validate
88
+ @param { { stringFormats?: { [format : string ]: (value : string , path : string []) => ValidationError | null } } } [context] - Context object to pass to validation functions
89
+ @returns { { operationId?: string; params: Record < string , string>; query: Record < string , string>; body?: any; headers: Record < string , string>; }}
90
+ */
91
+ export function validateRequest(request, context) {
92
+ return new RequestError (404 , ' no operation match path' );
93
+ }
94
+ export class RequestError extends Error {
95
+ /** @param {number} code HTTP code for the error
96
+ @param {string} message The error message*/
97
+ constructor (code , message ) {
98
+ super(message );
99
+ /** @type {number} HTTP code for the error*/
100
+ this.code = code;
101
+ }
102
+ }
103
+ export class ValidationError extends RequestError {
104
+ /** @param {string[]} path The path that failed validation
105
+ @param {string} message The error message*/
106
+ constructor (path , message ) {
107
+ super(409, message );
108
+ /** @type {string[]} The path that failed validation*/
109
+ this.path = path;
110
+ }
111
+ }
112
+ function obj0(path, value, context) {
113
+ if (typeof value === ' string' ) {
114
+ value = Number(value );
115
+ }
116
+ if (typeof value !== ' number' || Number .isNaN (value )) {
117
+ return new ValidationError(path , 'expected a number ');
118
+ }
119
+ if (value >= 10 ) {
120
+ return new ValidationError(path , 'value greater than maximum ');
121
+ }
122
+ return value ;
123
+ } "
124
+ ` ;
125
+
126
+ exports [` Number minimum 1` ] = `
127
+ "/**
128
+ Validate a request against the OpenAPI spec
129
+ @param { { method: string ; path : string ; body ?: any ; query : Record < string , string>; headers: Record < string , string>; }} request - Input request to validate
130
+ @param { { stringFormats?: { [format : string ]: (value : string , path : string []) => ValidationError | null } } } [context] - Context object to pass to validation functions
131
+ @returns { { operationId?: string; params: Record < string , string>; query: Record < string , string>; body?: any; headers: Record < string , string>; }}
132
+ */
133
+ export function validateRequest(request, context) {
134
+ return new RequestError (404 , ' no operation match path' );
135
+ }
136
+ export class RequestError extends Error {
137
+ /** @param {number} code HTTP code for the error
138
+ @param {string} message The error message*/
139
+ constructor (code , message ) {
140
+ super(message );
141
+ /** @type {number} HTTP code for the error*/
142
+ this.code = code;
143
+ }
144
+ }
145
+ export class ValidationError extends RequestError {
146
+ /** @param {string[]} path The path that failed validation
147
+ @param {string} message The error message*/
148
+ constructor (path , message ) {
149
+ super(409, message );
150
+ /** @type {string[]} The path that failed validation*/
151
+ this.path = path;
152
+ }
153
+ }
154
+ function obj0(path, value, context) {
155
+ if (typeof value === ' string' ) {
156
+ value = Number(value );
157
+ }
158
+ if (typeof value !== ' number' || Number .isNaN (value )) {
159
+ return new ValidationError(path , 'expected a number ');
160
+ }
161
+ if (value < 10 ) {
162
+ return new ValidationError(path , 'value less than minimum ');
163
+ }
164
+ return value ;
165
+ } "
166
+ ` ;
167
+
168
+ exports [` Number minimim exclusiveMinimum 1` ] = `
169
+ "/**
170
+ Validate a request against the OpenAPI spec
171
+ @param { { method: string ; path : string ; body ?: any ; query : Record < string , string>; headers: Record < string , string>; }} request - Input request to validate
172
+ @param { { stringFormats?: { [format : string ]: (value : string , path : string []) => ValidationError | null } } } [context] - Context object to pass to validation functions
173
+ @returns { { operationId?: string; params: Record < string , string>; query: Record < string , string>; body?: any; headers: Record < string , string>; }}
174
+ */
175
+ export function validateRequest(request, context) {
176
+ return new RequestError (404 , ' no operation match path' );
177
+ }
178
+ export class RequestError extends Error {
179
+ /** @param {number} code HTTP code for the error
180
+ @param {string} message The error message*/
181
+ constructor (code , message ) {
182
+ super(message );
183
+ /** @type {number} HTTP code for the error*/
184
+ this.code = code;
185
+ }
186
+ }
187
+ export class ValidationError extends RequestError {
188
+ /** @param {string[]} path The path that failed validation
189
+ @param {string} message The error message*/
190
+ constructor (path , message ) {
191
+ super(409, message );
192
+ /** @type {string[]} The path that failed validation*/
193
+ this.path = path;
194
+ }
195
+ }
196
+ function obj0(path, value, context) {
197
+ if (typeof value === ' string' ) {
198
+ value = Number(value );
199
+ }
200
+ if (typeof value !== ' number' || Number .isNaN (value )) {
201
+ return new ValidationError(path , 'expected a number ');
202
+ }
203
+ if (value <= 10 ) {
204
+ return new ValidationError(path , 'value less than minimum ');
205
+ }
206
+ return value ;
207
+ } "
208
+ ` ;
209
+
42
210
exports [` Integer basic 1` ] = `
43
211
"/**
44
212
Validate a request against the OpenAPI spec
0 commit comments