Remove old, broken Validation

This commit is contained in:
Samuel Lorch 2023-10-09 23:37:40 +02:00
parent e12a1fe16f
commit f67ec52fae
13 changed files with 39 additions and 64 deletions

View file

@ -8,11 +8,11 @@ import (
)
type Address struct {
Type AddressType `json:"type" validate:"min=0,max=3"`
Type AddressType `json:"type"`
Comment string `json:"comment,omitempty"`
Host *netip.Addr `json:"host,omitempty" validate:"excluded_unless=Type 0"`
Range *netipx.IPRange `json:"range,omitempty" validate:"excluded_unless=Type 1"`
NetworkAddress *netip.Prefix `json:"network,omitempty" validate:"excluded_unless=Type 2"`
Host *netip.Addr `json:"host,omitempty"`
Range *netipx.IPRange `json:"range,omitempty"`
NetworkAddress *netip.Prefix `json:"network,omitempty"`
Children *[]string `json:"children,omitempty"`
}

View file

@ -1,6 +1,6 @@
package object
type Object struct {
Addresses map[string]Address `json:"addresses" validate:"required,dive"`
Services map[string]Service `json:"services" validate:"required,dive"`
Addresses map[string]Address `json:"addresses"`
Services map[string]Service `json:"services"`
}

View file

@ -6,13 +6,13 @@ import (
)
type Service struct {
Type ServiceType `json:"type" validate:"min=0,max=3"`
Type ServiceType `json:"type"`
Comment string `json:"comment,omitempty"`
SPortStart *uint32 `json:"sport_start,omitempty" validate:"excluded_unless=Type 0|excluded_unless=Type 1"`
SPortStart *uint32 `json:"sport_start,omitempty"`
SPortEnd *uint32 `json:"sport_end,omitempty"`
DPortStart *uint32 `json:"dport_start,omitempty" validate:"excluded_unless=Type 0|excluded_unless=Type 1"`
DPortStart *uint32 `json:"dport_start,omitempty"`
DPortEnd *uint32 `json:"dport_end,omitempty"`
ICMPCode *uint32 `json:"icmp_code,omitempty" validate:"excluded_unless=Type 2"`
ICMPCode *uint32 `json:"icmp_code,omitempty"`
Children *[]string `json:"children,omitempty"`
}