feat: generate fields validation and use it when sending requests to API (#7)

* feat: generate fields validation and use it when issuing requests to API with soft (default) or hard modes

* chore: apply linter fixes

* feat: enable field validation on int fields

* feat: add validation for ^[\w]+$ fields

* feat: add validation for MAC address fields

* fix: trim wrappers for all comments

* feat: add validation for IPv4, IPv6 and IP(IPv4/IPv6) fields

* feat: add validation for numeric, non-zero based fields

* fix: one of validation can contain dot (.) sign in values

* feat: add second notation of MAC address validation

* fix: one of validation can start with ^( and end with )$

* feat: add option to disable validation and use soft validation by default

* chore: fix test

* docs: add readme about client-side validation
This commit is contained in:
Mateusz Filipowicz
2025-02-09 21:08:21 +01:00
committed by GitHub
parent 9f4fe33d07
commit 53bb1a13b9
55 changed files with 1326 additions and 588 deletions

View File

@@ -69,8 +69,8 @@ func (dst *SettingEtherLightingNetworkOverrides) UnmarshalJSON(b []byte) error {
}
type SettingEtherLightingSpeedOverrides struct {
Key string `json:"key,omitempty"` // FE|GbE|2.5GbE|5GbE|10GbE|25GbE|40GbE|100GbE
RawColorHex string `json:"raw_color_hex,omitempty"` // [0-9A-Fa-f]{6}
Key string `json:"key,omitempty" validate:"omitempty,oneof=FE GbE 2.5GbE 5GbE 10GbE 25GbE 40GbE 100GbE"` // FE|GbE|2.5GbE|5GbE|10GbE|25GbE|40GbE|100GbE
RawColorHex string `json:"raw_color_hex,omitempty"` // [0-9A-Fa-f]{6}
}
func (dst *SettingEtherLightingSpeedOverrides) UnmarshalJSON(b []byte) error {