[#3790] added MaxSize json field option

This commit is contained in:
Gani Georgiev
2023-12-09 22:30:37 +02:00
parent b9f391cf85
commit fb2eafe860
42 changed files with 247 additions and 134 deletions

View File

@@ -612,10 +612,13 @@ func (o SelectOptions) IsMultiple() bool {
// -------------------------------------------------------------------
type JsonOptions struct {
MaxSize int `form:"maxSize" json:"maxSize"`
}
func (o JsonOptions) Validate() error {
return nil
return validation.ValidateStruct(&o,
validation.Field(&o.MaxSize, validation.Required, validation.Min(1)),
)
}
// -------------------------------------------------------------------
@@ -623,10 +626,10 @@ func (o JsonOptions) Validate() error {
var _ MultiValuer = (*FileOptions)(nil)
type FileOptions struct {
MaxSelect int `form:"maxSelect" json:"maxSelect"`
MaxSize int `form:"maxSize" json:"maxSize"` // in bytes
MimeTypes []string `form:"mimeTypes" json:"mimeTypes"`
Thumbs []string `form:"thumbs" json:"thumbs"`
MaxSelect int `form:"maxSelect" json:"maxSelect"`
MaxSize int `form:"maxSize" json:"maxSize"`
Protected bool `form:"protected" json:"protected"`
}