Skip to content

fix(plugin): respect IsIn each option for array properties#3790

Open
y-hsgw wants to merge 2 commits intonestjs:masterfrom
y-hsgw:fix/is-in-each
Open

fix(plugin): respect IsIn each option for array properties#3790
y-hsgw wants to merge 2 commits intonestjs:masterfrom
y-hsgw:fix/is-in-each

Conversation

@y-hsgw
Copy link
Copy Markdown

@y-hsgw y-hsgw commented Mar 31, 2026

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Other... Please describe:

What is the current behavior?

Issue Number: #2027

When using class-validator @IsIn([...], { each: true }) on an array property, the CLI plugin emits OpenAPI metadata with enum but without isArray: true.
As a result, the generated OpenAPI schema can treat the property as a scalar enum instead of an array of enum items.

What is the new behavior?

The CLI plugin now sets isArray: true when it detects @IsIn(..., { each: true }), so the emitted OpenAPI metadata correctly represents an array of enum items.

Regression tests were added/updated to cover this behavior.

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

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.

1 participant