You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
A custom field can have a validate function which contains the current value plus an injector. However, what it's missing is a reference to the parent model instance.
E.g. I added originalPrice to a product variant. This allows me to show a non coupon related discount. This value should be higher than the current price and if it's not, and I don't account for negative discounts in the front end, I will get exactly that, a negative discount.
Describe the solution you'd like
IMHO, a parent reference would help in many cases to implement common validation scenario's. It would be a reference to the instance of the model that the form is for that the custom field is on.
Describe alternatives you've considered
Fix it in the frontend. This is more of a workaround, bc the data in this scenario is already bad.
I guess you can write a plugin to deal with this scenario
Additional context
The text was updated successfully, but these errors were encountered:
I think the most workable solution to this would be to pass the RequestContext ctx object into the function. From that, you can get the Express req object and inspect the current operation to find the variables passed in to the current GraphQL mutation.
Is your feature request related to a problem? Please describe.
A custom field can have a validate function which contains the current value plus an injector. However, what it's missing is a reference to the parent model instance.
E.g. I added
originalPrice
to a product variant. This allows me to show a non coupon related discount. This value should be higher than the current price and if it's not, and I don't account for negative discounts in the front end, I will get exactly that, a negative discount.Describe the solution you'd like
IMHO, a parent reference would help in many cases to implement common validation scenario's. It would be a reference to the instance of the model that the form is for that the custom field is on.
Describe alternatives you've considered
Fix it in the frontend. This is more of a workaround, bc the data in this scenario is already bad.
I guess you can write a plugin to deal with this scenario
Additional context
The text was updated successfully, but these errors were encountered: