u
This commit is contained in:
@@ -531,7 +531,7 @@ function summarizeSchema(
|
||||
skipRootAlias = false,
|
||||
) {
|
||||
if (!schema) return '';
|
||||
if (depth > 6) return aliases?.compactTypes ? 'obj' : 'object';
|
||||
if (depth > 6) return aliases?.compactTypes ? '{}' : 'object';
|
||||
|
||||
const resolved = resolveSchema(schema, components);
|
||||
if (!resolved) return schemaRefName(schema) || '';
|
||||
@@ -549,7 +549,13 @@ function summarizeSchema(
|
||||
|
||||
const required = new Set(resolved.required || []);
|
||||
let entries = Object.entries(resolved.properties || {});
|
||||
if (entries.length === 0) return aliases?.compactTypes ? 'obj' : 'object';
|
||||
if (entries.length === 0) {
|
||||
if (resolved.additionalProperties && typeof resolved.additionalProperties === 'object') {
|
||||
const valType = summarizeSchema(resolved.additionalProperties, components, depth + 1, markOptional, aliases) || 'any';
|
||||
return `{ [k]: ${valType} }`;
|
||||
}
|
||||
return aliases?.compactTypes ? '{}' : 'object';
|
||||
}
|
||||
|
||||
// Required props first, then optional ones (stable within each group).
|
||||
if (markOptional) {
|
||||
@@ -574,7 +580,7 @@ function summarizeSchema(
|
||||
integer: 'int',
|
||||
number: 'num',
|
||||
boolean: 'bool',
|
||||
object: 'obj',
|
||||
object: '{}',
|
||||
}[resolved.type] || resolved.type;
|
||||
}
|
||||
return resolved.type;
|
||||
@@ -741,7 +747,7 @@ function renderRoutesOverview(operations, title = 'Dash API Routes Overview') {
|
||||
lines.push('');
|
||||
lines.push('### Notation');
|
||||
lines.push('');
|
||||
lines.push('Types: `str` string, `int` integer, `num` number, `bool` boolean, `obj` object; `T[]` array; `?` optional.');
|
||||
lines.push('Types: `str` string, `int` integer, `num` number, `bool` boolean, `{}` object; `T[]` array; `?` optional.');
|
||||
lines.push('Params: path values first, then `query:` and `body:` (`body?` = optional body). Responses: status code + JSON shape; `Tn` refers to a reusable type below.');
|
||||
if (definitions.length) {
|
||||
lines.push('');
|
||||
|
||||
Reference in New Issue
Block a user