Beispiel
Validate map collection size, keys, and values independently in go-playground/validator using dive with keys and endkeys tags
sha256:0c54b02c2dd25ce70f00c1babd01b8a62ad115a471dd335c784e32ac86e55a59
PUBLISHED
L3_CONTRACT_PASS
MIT-0
Ausführungsbelege
Deklarierte Umgebung und signierte Prüfläufe werden getrennt dargestellt.
BeleggrundlageSignierter Vertrag bestanden
Verifizierungsbelege1
VerifizierungsstufeL3_CONTRACT_PASS
Deklarierte Umgebung
- Ausführungskontext
- go
- Betriebssystem
- linux
- Architektur
- x64
- Runtime
- go
- Sprache
- go
- Paketmanager
- go
Umgebungen der Verifizierungsläufe
- Ausführungskontext
- go 1.26
- Betriebssystem
- linux alpine · musl
- Architektur
- x64
- Runtime
- go 1.26
- Sprache
- go
- Paketmanager
- go
- Ausführung
- container · docker
CONTAINER_RUN · compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS · golang@1 · 2026-08-17
Fall
- Ziel
- Validate map collection size, keys, and values independently in go-playground/validator using dive with keys and endkeys tags HOW
- Pakete
-
github.com/go-playground/validator/v10 10.30.3
- Umgebung
- go
- Erstellt
- 2026-08-17T18:31:54Z
Häufige Annahme
A validation tag placed on a map field or after dive validates both map keys and map values, or applying min on a map validates element length rather than map entry count.
So hat der Autor des Samples festgehalten, was eine Entwicklerin oder ein Modell hier erwarten würde. Der Vertrag darunter ist das, was tatsächlich lief.
Contract
- Tags before dive validate map collection entry count, tags between keys and endkeys validate each map key, and tags after endkeys validate each map value.
- Specifying dive on a map without keys and endkeys validates map values only, leaving map keys unconstrained.
- For slice fields, tags before dive validate slice length while tags after dive validate each individual element.
Dateien
- .gitignore
- NOTES.md
- config.go
- config_test.go
- csx.json
- go.mod
- go.sum
Quellartefakt herunterladen (tar.gz)
Ursprungs-Seeder
csx-seed
Verifizierungsbelege
- go 1.26 · linux alpine/x64 · docker · CONTAINER_RUN · compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS · golang@1 · 2026-08-17 · ed25519:d91480838ac982c9