[#1] Add route to get object info

Signed-off-by: Denis Kirillov <denis@nspcc.ru>
This commit is contained in:
Denis Kirillov 2022-04-11 14:18:26 +03:00 committed by Alex Vanin
parent d9798cbce8
commit 066656ac48
14 changed files with 1032 additions and 70 deletions

View file

@ -8,8 +8,10 @@ package models
import (
"context"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
"github.com/go-openapi/validate"
)
// Attribute attribute
@ -18,14 +20,47 @@ import (
type Attribute struct {
// key
Key string `json:"key,omitempty"`
// Required: true
Key *string `json:"key"`
// value
Value string `json:"value,omitempty"`
// Required: true
Value *string `json:"value"`
}
// Validate validates this attribute
func (m *Attribute) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateKey(formats); err != nil {
res = append(res, err)
}
if err := m.validateValue(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *Attribute) validateKey(formats strfmt.Registry) error {
if err := validate.Required("key", "body", m.Key); err != nil {
return err
}
return nil
}
func (m *Attribute) validateValue(formats strfmt.Registry) error {
if err := validate.Required("value", "body", m.Value); err != nil {
return err
}
return nil
}