This repository has been archived by the owner on Feb 4, 2025. It is now read-only.
fix: localize the class and pass the external validator AdminUpdateUserRequest to register it to be used #31
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR fixes the issue where the custom validator for
AdminUpdateUserRequest
was not being properly registered, which caused validation errors when updating user statuses in the admin UI. The fix involves correctly registering the overridden validator to ensure thestatus
field is recognized and validated. The issue was mentioned in #30. The fix was to register theAdminUpdateUserRequest
usingregisterOverriddenValidators
to replace the core validator.Without registering the custom
AdminUpdateUserRequest
, Medusa's default validation kicks in and fails to recognize the customstatus
field. This results in errors like:So to fix this, we have to register the custom validator as documented here. This will ensure that our extended request (with the
status
field) is properly validated. I tested it and the status field is now validated correctly when updating a user. Further information on extending and registering custom validators can be found in the Medusa docs.Example Demonstration
25af840d-8aba-4972-a0ef-2fa097c5d249.webm
a33ea09f-368a-493a-aa02-02274c4ae79b.webm