Skip to content

fix(schema): place x-enumNames on enum schema instead of DTO property#3801

Open
maruthang wants to merge 1 commit intonestjs:masterfrom
maruthang:fix/issue-3391-x-enumnames-placement
Open

fix(schema): place x-enumNames on enum schema instead of DTO property#3801
maruthang wants to merge 1 commit intonestjs:masterfrom
maruthang:fix/issue-3391-x-enumnames-placement

Conversation

@maruthang
Copy link
Copy Markdown

Summary

Fixes #3391

Bug: x-enumNames (and description) were incorrectly placed on the shared enum schema object rather than staying on the DTO property reference.

Root Cause: createEnumSchemaType() in SchemaObjectFactory copied description from DTO property metadata onto the shared enum schema object. Since description is per-property, not per-type, it caused x-enumNames and description to bleed onto the wrong schema.

Fix: Removed the single line description: metadata.description ?? undefined from the enum schema creation block in createEnumSchemaType().

Changes

  • lib/services/schema-object-factory.ts: Removed erroneous description copy from DTO property metadata into the shared enum schema object
  • e2e/api-spec.json: Updated E2E snapshot to reflect corrected schema (description no longer appears on enum schema)
  • test/services/schema-object-factory.spec.ts: Added 3 regression tests verifying correct placement of x-enumNames, that description is not copied to enum schema, and that x-enumNames is placed correctly on a pre-existing enum schema

Testing

  • Added 3 regression tests in test/services/schema-object-factory.spec.ts that verify correct x-enumNames placement and that description is not copied to the enum schema
  • All existing tests pass (161 passing)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incorrent enum with 'x-enumNames' generation

1 participant