Docs include field description (#3973)

- include field description
This commit is contained in:
brendanlaschke
2024-02-16 14:38:39 +01:00
committed by GitHub
parent b90b3e762e
commit 547145389c

View File

@ -73,6 +73,10 @@ const getSchemaComponentsProperties = (
break; break;
} }
if (field.description) {
itemProperty.description = field.description;
}
if (Object.keys(itemProperty).length) { if (Object.keys(itemProperty).length) {
node[field.name] = itemProperty; node[field.name] = itemProperty;
} }
@ -98,6 +102,7 @@ const computeSchemaComponent = (
): OpenAPIV3.SchemaObject => { ): OpenAPIV3.SchemaObject => {
const result = { const result = {
type: 'object', type: 'object',
description: item.description,
properties: getSchemaComponentsProperties(item), properties: getSchemaComponentsProperties(item),
example: {}, example: {},
} as OpenAPIV3.SchemaObject; } as OpenAPIV3.SchemaObject;