Skip to content

Commit

Permalink
Simplify id fields @default check
Browse files Browse the repository at this point in the history
  • Loading branch information
thomassnielsen committed Nov 16, 2024
1 parent 4d95306 commit de8aefa
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/plugins/openapi/src/rest-generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
Expand Down

0 comments on commit de8aefa

Please sign in to comment.