From de8aefab125e375e80de7745201ab062aee4e52e Mon Sep 17 00:00:00 2001 From: Thomas Sunde Nielsen Date: Sat, 16 Nov 2024 21:08:25 +0100 Subject: [PATCH] Simplify id fields @default check --- packages/plugins/openapi/src/rest-generator.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/plugins/openapi/src/rest-generator.ts b/packages/plugins/openapi/src/rest-generator.ts index d6fb4859..1434edc2 100644 --- a/packages/plugins/openapi/src/rest-generator.ts +++ b/packages/plugins/openapi/src/rest-generator.ts @@ -905,7 +905,7 @@ export class RESTfulOpenAPIGenerator extends OpenAPIGeneratorBase { if (mode === 'create') { // 'id' is required if there's no default value const idFields = model.fields.filter((f) => isIdField(f)); - if (idFields.length === 1 && idFields.every((f) => !hasAttribute(f, '@default'))) { + if (idFields.length === 1 && !hasAttribute(idFields[0], '@default')) { properties = { id: { type: 'string' }, ...properties }; toplevelRequired.unshift('id'); }