Skip to content

feat(common): allow injecting global serializer options#16966

Open
Nosfistis wants to merge 1 commit into
nestjs:masterfrom
Nosfistis:bugfix/serializer-global-options
Open

feat(common): allow injecting global serializer options#16966
Nosfistis wants to merge 1 commit into
nestjs:masterfrom
Nosfistis:bugfix/serializer-global-options

Conversation

@Nosfistis
Copy link
Copy Markdown
Contributor

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: #16963

What is the new behavior?

It is now possible to use ClassSerializerInterceptorOptions to inject options for class-serializer interceptor globally.

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

@Nosfistis
Copy link
Copy Markdown
Contributor Author

Transforming ClassSerializerInterceptorOptions to class required a member implementation. In order to avoid that I would have to create a new string injection token.

@coveralls
Copy link
Copy Markdown

Coverage Report for CI Build 31

Coverage remained the same at 89.903%

Details

  • Coverage remained the same as the base build.
  • Patch coverage: No coverable lines changed in this PR.
  • No coverage regressions found.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 8567
Covered Lines: 7702
Line Coverage: 89.9%
Relevant Branches: 2925
Covered Branches: 2372
Branch Coverage: 81.09%
Branches in Coverage %: No
Coverage Strength: 56.5 hits per line

💛 - Coveralls

@QusaiAlbonni
Copy link
Copy Markdown
Contributor

Hi thanks for the PR @Nosfistis!
While I understand the point of this change
This could encourage a bad pattern of having settings anywhere in the dependency graph
Looking at the interceptor you'd have no way of knowing right away it's settings or tracing it you'd have to hunt down the place where the options were registered as a provider
Curious to know the maintainers thoughts about whether this is something tha fits in the direction nest is heading to or it's philosophy

@micalevisk
Copy link
Copy Markdown
Member

btw this is not a 'fix' but a 'feat'

@Nosfistis
Copy link
Copy Markdown
Contributor Author

@micalevisk Indeed, it is a typo.

@Nosfistis Nosfistis changed the title fix(common): allow injecting global serializer options feat(common): allow injecting global serializer options May 25, 2026
@Nosfistis Nosfistis force-pushed the bugfix/serializer-global-options branch from 1959b03 to 8933e9e Compare May 25, 2026 07:21
@Nosfistis
Copy link
Copy Markdown
Contributor Author

I have amended the commit message, if that was the blocking part. Unless the whole reasoning of this PR is out of scope, let's discuss what else is needed.

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.

4 participants