Skip to content

Conversation

vkarpov15
Copy link
Collaborator

Fix #15556

Summary

We allow discriminator schemas to set methods and virtuals options with #12246, I think statics should also be allowed.

Examples

@vkarpov15 vkarpov15 added this to the 8.17.1 milestone Aug 4, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes an issue (#15556) where discriminator schemas were not allowed to set the statics option, despite being able to set methods and virtuals options. The change enables discriminator schemas to customize their static methods by adding statics to the list of customizable discriminator options.

  • Added statics to the CUSTOMIZABLE_DISCRIMINATOR_OPTIONS object
  • Updated the error message to include statics in the list of allowed customizable options

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
lib/helpers/model/discriminator.js Added statics: true to the CUSTOMIZABLE_DISCRIMINATOR_OPTIONS object
test/model.discriminator.test.js Updated error message test to include statics in the list of allowed options

Copy link
Collaborator

@hasezoey hasezoey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, though wouldnt a test to actually test having a static in a discriminator be good?

@vkarpov15 vkarpov15 merged commit 69f9c7a into master Aug 5, 2025
71 checks passed
@hasezoey hasezoey deleted the vkarpov15/gh-15556 branch August 6, 2025 09:08
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.

Allow discriminator models to add new statics
2 participants