Skip to content

Commit 77a09f2

Browse files
committed
Refactor type fetching logic to process original schema before modifications
1 parent 5f6d275 commit 77a09f2

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

libV2/schemaUtils.js

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1523,6 +1523,18 @@ let QUERYPARAM = 'query',
15231523
return [{ [bodyKey]: bodyData }];
15241524
}
15251525

1526+
// For type fetching, process the original schema before any modifications
1527+
if (context.enableTypeFetching && requestBodySchema) {
1528+
// Get the actual schema - it might be nested under .schema or be direct
1529+
const originalSchema = requestBodySchema.schema || requestBodySchema,
1530+
resolvedSchema = resolveSchema(
1531+
context,
1532+
originalSchema,
1533+
{ resolveFor: 'PROCESSING' }),
1534+
requestBodySchemaTypes = processSchema(resolvedSchema);
1535+
requestBodySchemaTypes && resolvedSchemaTypes.push(requestBodySchemaTypes);
1536+
}
1537+
15261538
if (requestBodySchema.$ref) {
15271539
requestBodySchema = resolveSchema(
15281540
context,
@@ -1531,14 +1543,6 @@ let QUERYPARAM = 'query',
15311543
);
15321544
}
15331545

1534-
// For type fetching, process the original schema before any modifications
1535-
if (context.enableTypeFetching && requestBodySchema) {
1536-
// Get the actual schema - it might be nested under .schema or be direct
1537-
const originalSchema = requestBodySchema.schema || requestBodySchema,
1538-
requestBodySchemaTypes = processSchema(originalSchema);
1539-
resolvedSchemaTypes.push(requestBodySchemaTypes);
1540-
}
1541-
15421546
/**
15431547
* We'll be picking up example data from `value` only if
15441548
* `value` is the only key present at the root level;

0 commit comments

Comments
 (0)