Skip to content

Commit 652f21f

Browse files
committed
Fix format for strings and fix context not being passed when parsing body
1 parent 35f6f86 commit 652f21f

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

src/compileOperation.ts

+1
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,7 @@ export function compileOperation(
231231
requestIdentifier,
232232
builders.identifier('body'),
233233
),
234+
contextIdentifier,
234235
]),
235236
),
236237
]),

src/compileValueSchema.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -696,7 +696,7 @@ function compileStringSchema(compiler: Compiler, schema: OpenAPIStringSchema) {
696696
callee: builders.memberExpression.from({
697697
object: builders.memberExpression.from({
698698
object: context,
699-
property: builders.identifier('formatString'),
699+
property: builders.identifier('stringFormats'),
700700
optional: true,
701701
}),
702702
property: builders.literal(schema.format),

src/tests/__snapshots__/compileValueSchema.test.ts.snap

+1-1
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ function obj0(path, value, context) {
228228
if (typeof value !== 'string') {
229229
return new ValidationError(path, 'expected a string');
230230
}
231-
const formatResult = context?.formatString?.['uri']?.(value, path);
231+
const formatResult = context?.stringFormats?.['uri']?.(value, path);
232232
if (formatResult instanceof ValidationError) {
233233
return formatResult;
234234
}

0 commit comments

Comments
 (0)