-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix required fields usage #2214
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7478a3a
to
4b40f84
Compare
arbulu89
commented
Jan 23, 2024
@@ -278,6 +278,8 @@ defmodule Trento.Discovery.Policies.ClusterPolicy do | |||
end) | |||
end | |||
|
|||
defp parse_sbd_devices(_), do: [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Enable empty sbd data coming, for future non sbd scenario.
PD: without this, we were having a nasty error
3b3bc58
to
8be6592
Compare
CDimonaco
approved these changes
Jan 24, 2024
nelsonkopliku
approved these changes
Jan 24, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👀
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
Fix
validate_required_fields
usage. We were using this function incorrectly in many places.When we have an explicit
changeset
implemented for theType
, thevalidate_required_fields
only works for the type itself. If there are other inline types with their ownchangeset
functions, we cannot use it, as it would expand thefields
of the main module, and not run the proper validation.Together with this, in other to check if embedded fields are required or not, we cannot use
validate_required_fields
, we need to set therequired: true
in theembed_cast
itself.Using the macro
changeset
all of this is done there.PD: I have tried to put the required values in the places where it makes sense. Until now, any of them on the
embeds_*
was working, so it was like there were not required. Many of them actually shouldn't be required...As a bonus, I have removed the
sbd
from the required list (even though it was not really working) to avoid an error we were having when the cluster doesn't have sbd configured. FYI @abravosuseRef: https://github.com/trento-project/web/pull/1422/files#r1196297634
How was this tested?
Current tests passing