From 4d9530650bd264bf36f8c14485d6b05f3e2d6288 Mon Sep 17 00:00:00 2001 From: Thomas Sunde Nielsen Date: Fri, 15 Nov 2024 10:40:55 +0100 Subject: [PATCH] Expose compound id as separate fields always --- packages/plugins/openapi/src/rest-generator.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/packages/plugins/openapi/src/rest-generator.ts b/packages/plugins/openapi/src/rest-generator.ts index c0447763..d6fb4859 100644 --- a/packages/plugins/openapi/src/rest-generator.ts +++ b/packages/plugins/openapi/src/rest-generator.ts @@ -857,10 +857,8 @@ export class RESTfulOpenAPIGenerator extends OpenAPIGeneratorBase { private generateModelEntity(model: DataModel, mode: 'read' | 'create' | 'update'): OAPI.SchemaObject { const idFields = model.fields.filter((f) => isIdField(f)); - // For compound ids each component is also exposed as a separate fields for read operations, - // but not required for write operations - const fields = - idFields.length > 1 && mode !== 'update' ? model.fields : model.fields.filter((f) => !isIdField(f)); + // For compound ids each component is also exposed as a separate fields. + const fields = idFields.length > 1 ? model.fields : model.fields.filter((f) => !isIdField(f)); const attributes: Record = {}; const relationships: Record = {};