Skip to content
Snippets Groups Projects
Unverified Commit d04da99c authored by dlorenc's avatar dlorenc Committed by GitHub
Browse files

Merge pull request #264 from asraa/add-max-on-content

[api] Add max 32 mb on content data
parents 236a8722 85075cd3
No related branches found
No related tags found
No related merge requests found
......@@ -175,6 +175,7 @@ func (m *RekordV001Schema) UnmarshalBinary(b []byte) error {
type RekordV001SchemaData struct {
// Specifies the content inline within the document
// Max Length: 32000000
// Format: byte
Content strfmt.Base64 `json:"content,omitempty"`
......@@ -190,6 +191,10 @@ type RekordV001SchemaData struct {
func (m *RekordV001SchemaData) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateContent(formats); err != nil {
res = append(res, err)
}
if err := m.validateHash(formats); err != nil {
res = append(res, err)
}
......@@ -204,6 +209,18 @@ func (m *RekordV001SchemaData) Validate(formats strfmt.Registry) error {
return nil
}
func (m *RekordV001SchemaData) validateContent(formats strfmt.Registry) error {
if swag.IsZero(m.Content) { // not required
return nil
}
if err := validate.MaxLength("data"+"."+"content", "body", m.Content.String(), 32000000); err != nil {
return err
}
return nil
}
func (m *RekordV001SchemaData) validateHash(formats strfmt.Registry) error {
if swag.IsZero(m.Hash) { // not required
return nil
......
......@@ -175,6 +175,7 @@ func (m *RpmV001Schema) UnmarshalBinary(b []byte) error {
type RpmV001SchemaPackage struct {
// Specifies the package inline within the document
// Max Length: 32000000
// Format: byte
Content strfmt.Base64 `json:"content,omitempty"`
......@@ -193,6 +194,10 @@ type RpmV001SchemaPackage struct {
func (m *RpmV001SchemaPackage) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateContent(formats); err != nil {
res = append(res, err)
}
if err := m.validateHash(formats); err != nil {
res = append(res, err)
}
......@@ -207,6 +212,18 @@ func (m *RpmV001SchemaPackage) Validate(formats strfmt.Registry) error {
return nil
}
func (m *RpmV001SchemaPackage) validateContent(formats strfmt.Registry) error {
if swag.IsZero(m.Content) { // not required
return nil
}
if err := validate.MaxLength("package"+"."+"content", "body", m.Content.String(), 32000000); err != nil {
return err
}
return nil
}
func (m *RpmV001SchemaPackage) validateHash(formats strfmt.Registry) error {
if swag.IsZero(m.Hash) { // not required
return nil
......
......@@ -1164,7 +1164,8 @@ func init() {
"content": {
"description": "Specifies the content inline within the document",
"type": "string",
"format": "byte"
"format": "byte",
"maxLength": 32000000
},
"hash": {
"description": "Specifies the hash algorithm and value for the content",
......@@ -1332,7 +1333,8 @@ func init() {
"content": {
"description": "Specifies the package inline within the document",
"type": "string",
"format": "byte"
"format": "byte",
"maxLength": 32000000
},
"hash": {
"description": "Specifies the hash algorithm and value for the package",
......@@ -1568,7 +1570,8 @@ func init() {
"content": {
"description": "Specifies the content inline within the document",
"type": "string",
"format": "byte"
"format": "byte",
"maxLength": 32000000
},
"hash": {
"description": "Specifies the hash algorithm and value for the content",
......@@ -1747,7 +1750,8 @@ func init() {
"content": {
"description": "Specifies the package inline within the document",
"type": "string",
"format": "byte"
"format": "byte",
"maxLength": 32000000
},
"hash": {
"description": "Specifies the hash algorithm and value for the package",
......
......@@ -86,7 +86,8 @@
"content": {
"description": "Specifies the content inline within the document",
"type": "string",
"format": "byte"
"format": "byte",
"maxLength" : 32000000
}
},
"oneOf": [
......
......@@ -64,7 +64,8 @@
"content": {
"description": "Specifies the package inline within the document",
"type": "string",
"format": "byte"
"format": "byte",
"maxLength" : 32000000
}
},
"oneOf": [
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment