fix: json tags for label mappings
Signed-off-by: Leonardo Di Donato <leodidonato@gmail.com>pull/11602/head
parent
bd8bb5cb52
commit
4d5f39334e
15
label.go
15
label.go
|
@ -68,19 +68,22 @@ func (l *Label) Validate() error {
|
||||||
// It should not be shared directly over the HTTP API.
|
// It should not be shared directly over the HTTP API.
|
||||||
type LabelMapping struct {
|
type LabelMapping struct {
|
||||||
LabelID ID `json:"labelID"`
|
LabelID ID `json:"labelID"`
|
||||||
ResourceID ID
|
ResourceID ID `json:"resourceID"`
|
||||||
ResourceType
|
ResourceType `json:"resourceType"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Validate returns an error if the mapping is invalid.
|
// Validate returns an error if the mapping is invalid.
|
||||||
func (l *LabelMapping) Validate() error {
|
func (l *LabelMapping) Validate() error {
|
||||||
|
if !l.LabelID.Valid() {
|
||||||
// todo(leodido) > check LabelID is valid too?
|
return &Error{
|
||||||
|
Code: EInvalid,
|
||||||
|
Msg: "label id is required",
|
||||||
|
}
|
||||||
|
}
|
||||||
if !l.ResourceID.Valid() {
|
if !l.ResourceID.Valid() {
|
||||||
return &Error{
|
return &Error{
|
||||||
Code: EInvalid,
|
Code: EInvalid,
|
||||||
Msg: "resourceID is required",
|
Msg: "resource id is required",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if err := l.ResourceType.Valid(); err != nil {
|
if err := l.ResourceType.Valid(); err != nil {
|
||||||
|
|
Loading…
Reference in New Issue