Skip to content

Commit

Permalink
fix(core): Fix custom field validation when updating ProductVariants
Browse files Browse the repository at this point in the history
Fixes #1014
  • Loading branch information
michaelbromley committed Aug 5, 2021
1 parent 35f47c4 commit 372b4af
Showing 1 changed file with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,15 @@ export class ValidateCustomFieldsInterceptor implements NestInterceptor {
for (const [inputName, typeName] of Object.entries(inputTypeNames)) {
if (this.inputsWithCustomFields.has(typeName)) {
if (variables[inputName]) {
await this.validateInput(
typeName,
ctx.languageCode,
injector,
const inputVariables: Array<Record<string, any>> = Array.isArray(
variables[inputName],
);
)
? variables[inputName]
: [variables[inputName]];

for (const inputVariable of inputVariables) {
await this.validateInput(typeName, ctx.languageCode, injector, inputVariable);
}
}
}
}
Expand Down

0 comments on commit 372b4af

Please sign in to comment.