Skip to content

Commit a67b383

Browse files
committed
feat(code-gen): include docs & infer object type in openapi importer
1 parent f01e64f commit a67b383

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

packages/code-gen/src/open-api-importer.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,11 +415,14 @@ function convertSchema(context, schema, options = {}) {
415415
break;
416416
}
417417
Object.assign(result, data);
418+
419+
result.docString = schema?.description ?? "";
418420
};
419421

420422
if (
421423
!schema ||
422424
(!schema.type &&
425+
!schema.properties &&
423426
!schema.$ref &&
424427
!schema.oneOf &&
425428
!schema.anyOf &&
@@ -440,7 +443,7 @@ function convertSchema(context, schema, options = {}) {
440443
if (schema.maxItems !== undefined) {
441444
result.validator.max = schema.maxItems;
442445
}
443-
} else if (schema.type === "object") {
446+
} else if (schema.type === "object" || schema.properties) {
444447
result.type = "object";
445448

446449
const freeForm = schema.properties === undefined;

0 commit comments

Comments
 (0)