Skip to content

Commit

Permalink
fix: Make nested objects show in typescript .d.ts file and in the doc…
Browse files Browse the repository at this point in the history
…umentation
  • Loading branch information
kpears201 committed Nov 18, 2024
1 parent d6d634a commit 2ca527f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/macrofier/types.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,8 @@ const insertObjectMacros = (content, schema, module, title, property, options) =
options2.required = schema.required && schema.required.includes(name)
}
const schemaShape = indent + getSchemaShape(localizedProp, module, options2).replace(/\n/gms, '\n' + indent)
const type = getSchemaType(localizedProp, module, options2)

const type = localizedProp.type === 'object' ? getSchemaShape(localizedProp, module, { ...options2, type: true }): getSchemaType(localizedProp, module, options2)
// don't push properties w/ unsupported types
if (type) {
const description = getSchemaDescription(prop, module)
Expand Down Expand Up @@ -549,7 +550,7 @@ function getSchemaShape(schema = {}, module = {}, { templateDir = 'types', paren
const suffix = destination && ('.' + destination.split('.').pop()) || ''
const theTitle = insertSchemaMacros(getTemplate(path.join(templateDir, 'title' + suffix)), schema, module, { name: schema.title, parent, property, required, recursive: false })

let result = getTemplate(path.join(templateDir, 'default' + suffix)) || '${shape}'
let result = !type && getTemplate(path.join(templateDir, 'default' + suffix)) || '${shape}'

let genericTemplate = getTemplate(path.join(templateDir, 'generic' + suffix))
if (enums && level === 0 && Array.isArray(schema.enum) && ((schema.type === "string") || (schema.type[0] === "string"))) {
Expand Down

0 comments on commit 2ca527f

Please sign in to comment.