-
Notifications
You must be signed in to change notification settings - Fork 912
Set model validation lengths based upon react form maxLength #23262
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,6 +15,8 @@ class CloudVolumeSnapshot < ApplicationRecord | |
|
|
||
| virtual_total :total_based_volumes, :based_volumes | ||
|
|
||
| validates :description, :length => {:maximum => 50} | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a great example, where the description (if it's not a name or identifier), could actually be really large coming from a provider. |
||
|
|
||
| def self.class_by_ems(ext_management_system) | ||
| ext_management_system&.class_by_ems(:CloudVolumeSnapshot) | ||
| end | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -87,7 +87,8 @@ class Service < ApplicationRecord | |
| virtual_column :power_state, :type => :string | ||
| virtual_column :power_status, :type => :string | ||
|
|
||
| validates :name, :presence => true | ||
| validates :name, :presence => true, :length => {:maximum => 256} | ||
| validates :description, :length => {:maximum => 1024} | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 1kb for a service description feels really small. I'm surprised the UI only allows that much. |
||
|
|
||
| default_value_for :visible, false | ||
| default_value_for :initiator, 'user' | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
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.
I think I mentioned this elsewhere, but any data that can come from providers I don't think we should be as conservative with, otherwise we run the risk of failing during provider collection. On the backend, I think we can be much looser with these values. For example, here I'd be ok with 1k or even higher. The frontend is only for new objects, and those forms (I think) are provider specific, so the value could be different on different forms depending on the provider. I understand the need to limit it to some value, but I'd prefer if it were a really large, but reasonable value.
@agrare Thoughts?