Skip to content

Commit

Permalink
Expose compound id as separate fields always
Browse files Browse the repository at this point in the history
  • Loading branch information
thomassnielsen committed Nov 15, 2024
1 parent 040d1bd commit 4d95306
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions packages/plugins/openapi/src/rest-generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<string, OAPI.SchemaObject> = {};
const relationships: Record<string, OAPI.ReferenceObject | OAPI.SchemaObject> = {};
Expand Down

0 comments on commit 4d95306

Please sign in to comment.