Skip to content

Commit

Permalink
fix: avoid unnecessarily creating object every time calling schema.di…
Browse files Browse the repository at this point in the history
…scriminator() re: #11855
  • Loading branch information
vkarpov15 committed Jun 7, 2022
1 parent f82f7df commit 3c46ed0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ Schema.prototype.defaultOptions = function(options) {
*/

Schema.prototype.discriminator = function(name, schema) {
this._applyDiscriminators = Object.assign({}, this._applyDiscriminators, { [name]: schema });
this._applyDiscriminators = Object.assign(this._applyDiscriminators || {}, { [name]: schema });

return this;
};
Expand Down

0 comments on commit 3c46ed0

Please sign in to comment.