diff --git a/VERSION b/VERSION index b3a8c61e..3a76d1e7 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.79.0 +1.79.1 diff --git a/examples/service/go.mod b/examples/service/go.mod index 7654bee7..f518b326 100644 --- a/examples/service/go.mod +++ b/examples/service/go.mod @@ -5,7 +5,7 @@ go 1.21 replace github.com/Vonage/gosrvlib => ../.. require ( - github.com/Vonage/gosrvlib v1.79.0 + github.com/Vonage/gosrvlib v1.79.1 github.com/golang/mock v1.6.0 github.com/jstemmer/go-junit-report v0.9.1 github.com/prometheus/client_golang v1.16.0 diff --git a/examples/service/go.sum b/examples/service/go.sum index 4020542c..b3b08671 100644 --- a/examples/service/go.sum +++ b/examples/service/go.sum @@ -304,10 +304,10 @@ github.com/aws/aws-sdk-go-v2 v1.21.0 h1:gMT0IW+03wtYJhRqTVYn0wLzwdnK9sRMcxmtfGzR github.com/aws/aws-sdk-go-v2 v1.21.0/go.mod h1:/RfNgGmRxI+iFOB1OeJUyxiU+9s88k3pfHvDagGEp0M= github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.4.13 h1:OPLEkmhXf6xFPiz0bLeDArZIDx1NNS4oJyG4nv3Gct0= github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.4.13/go.mod h1:gpAbvyDGQFozTEmlTFO8XcQKHzubdq0LzRyJpG6MiXM= -github.com/aws/aws-sdk-go-v2/config v1.18.37 h1:RNAfbPqw1CstCooHaTPhScz7z1PyocQj0UL+l95CgzI= -github.com/aws/aws-sdk-go-v2/config v1.18.37/go.mod h1:8AnEFxW9/XGKCbjYDCJy7iltVNyEI9Iu9qC21UzhhgQ= -github.com/aws/aws-sdk-go-v2/credentials v1.13.35 h1:QpsNitYJu0GgvMBLUIYu9H4yryA5kMksjeIVQfgXrt8= -github.com/aws/aws-sdk-go-v2/credentials v1.13.35/go.mod h1:o7rCaLtvK0hUggAGclf76mNGGkaG5a9KWlp+d9IpcV8= +github.com/aws/aws-sdk-go-v2/config v1.18.38 h1:CByQCELMgm2tM1lAehx3XNg0R/pfeXsYzqn0Aq2chJQ= +github.com/aws/aws-sdk-go-v2/config v1.18.38/go.mod h1:vNm9Hf5VgG2fSUWhT3zFrqN/RosGcabFMYgiSoxKFU8= +github.com/aws/aws-sdk-go-v2/credentials v1.13.36 h1:ps0cPswZjpsOk6sLwG6fdXTzrYjCplgPEyG3OUbbdqE= +github.com/aws/aws-sdk-go-v2/credentials v1.13.36/go.mod h1:sY2phUzxbygoyDtTXhqi7GjGjCQ1S5a5Rj8u3ksBxCg= github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.13.11 h1:uDZJF1hu0EVT/4bogChk8DyjSF6fof6uL/0Y26Ma7Fg= github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.13.11/go.mod h1:TEPP4tENqBGO99KwVpV9MlOX4NSrSLP8u3KRy2CDwA8= github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.41 h1:22dGT7PneFMx4+b3pz7lMTRyN8ZKH7M2cW4GP9yUS2g= @@ -330,8 +330,8 @@ github.com/aws/aws-sdk-go-v2/service/s3 v1.38.5 h1:A42xdtStObqy7NGvzZKpnyNXvoOmm github.com/aws/aws-sdk-go-v2/service/s3 v1.38.5/go.mod h1:rDGMZA7f4pbmTtPOk5v5UM2lmX6UAbRnMDJeDvnH7AM= github.com/aws/aws-sdk-go-v2/service/sqs v1.24.5 h1:RyDpTOMEJO6ycxw1vU/6s0KLFaH3M0z/z9gXHSndPTk= github.com/aws/aws-sdk-go-v2/service/sqs v1.24.5/go.mod h1:RZBu4jmYz3Nikzpu/VuVvRnTEJ5a+kf36WT2fcl5Q+Q= -github.com/aws/aws-sdk-go-v2/service/sso v1.13.5 h1:oCvTFSDi67AX0pOX3PuPdGFewvLRU2zzFSrTsgURNo0= -github.com/aws/aws-sdk-go-v2/service/sso v1.13.5/go.mod h1:fIAwKQKBFu90pBxx07BFOMJLpRUGu8VOzLJakeY+0K4= +github.com/aws/aws-sdk-go-v2/service/sso v1.13.6 h1:2PylFCfKCEDv6PeSN09pC/VUiRd10wi1VfHG5FrW0/g= +github.com/aws/aws-sdk-go-v2/service/sso v1.13.6/go.mod h1:fIAwKQKBFu90pBxx07BFOMJLpRUGu8VOzLJakeY+0K4= github.com/aws/aws-sdk-go-v2/service/ssooidc v1.15.5 h1:dnInJb4S0oy8aQuri1mV6ipLlnZPfnsDNB9BGO9PDNY= github.com/aws/aws-sdk-go-v2/service/ssooidc v1.15.5/go.mod h1:yygr8ACQRY2PrEcy3xsUI357stq2AxnFM6DIsR9lij4= github.com/aws/aws-sdk-go-v2/service/sts v1.21.5 h1:CQBFElb0LS8RojMJlxRSo/HXipvTZW2S44Lt9Mk2aYQ= diff --git a/go.mod b/go.mod index 7cb12774..f397286f 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.21 require ( github.com/DATA-DOG/go-sqlmock v1.5.0 github.com/aws/aws-sdk-go-v2 v1.21.0 - github.com/aws/aws-sdk-go-v2/config v1.18.37 + github.com/aws/aws-sdk-go-v2/config v1.18.38 github.com/aws/aws-sdk-go-v2/service/s3 v1.38.5 github.com/aws/aws-sdk-go-v2/service/sqs v1.24.5 github.com/confluentinc/confluent-kafka-go v1.9.2 @@ -39,7 +39,7 @@ require ( cloud.google.com/go/longrunning v0.5.1 // indirect github.com/armon/go-metrics v0.4.1 // indirect github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.4.13 // indirect - github.com/aws/aws-sdk-go-v2/credentials v1.13.35 // indirect + github.com/aws/aws-sdk-go-v2/credentials v1.13.36 // indirect github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.13.11 // indirect github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.41 // indirect github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.35 // indirect @@ -49,7 +49,7 @@ require ( github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.1.36 // indirect github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.35 // indirect github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.15.4 // indirect - github.com/aws/aws-sdk-go-v2/service/sso v1.13.5 // indirect + github.com/aws/aws-sdk-go-v2/service/sso v1.13.6 // indirect github.com/aws/aws-sdk-go-v2/service/ssooidc v1.15.5 // indirect github.com/aws/aws-sdk-go-v2/service/sts v1.21.5 // indirect github.com/aws/smithy-go v1.14.2 // indirect diff --git a/go.sum b/go.sum index 7b993a94..b5271ee3 100644 --- a/go.sum +++ b/go.sum @@ -309,10 +309,10 @@ github.com/aws/aws-sdk-go-v2 v1.21.0 h1:gMT0IW+03wtYJhRqTVYn0wLzwdnK9sRMcxmtfGzR github.com/aws/aws-sdk-go-v2 v1.21.0/go.mod h1:/RfNgGmRxI+iFOB1OeJUyxiU+9s88k3pfHvDagGEp0M= github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.4.13 h1:OPLEkmhXf6xFPiz0bLeDArZIDx1NNS4oJyG4nv3Gct0= github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.4.13/go.mod h1:gpAbvyDGQFozTEmlTFO8XcQKHzubdq0LzRyJpG6MiXM= -github.com/aws/aws-sdk-go-v2/config v1.18.37 h1:RNAfbPqw1CstCooHaTPhScz7z1PyocQj0UL+l95CgzI= -github.com/aws/aws-sdk-go-v2/config v1.18.37/go.mod h1:8AnEFxW9/XGKCbjYDCJy7iltVNyEI9Iu9qC21UzhhgQ= -github.com/aws/aws-sdk-go-v2/credentials v1.13.35 h1:QpsNitYJu0GgvMBLUIYu9H4yryA5kMksjeIVQfgXrt8= -github.com/aws/aws-sdk-go-v2/credentials v1.13.35/go.mod h1:o7rCaLtvK0hUggAGclf76mNGGkaG5a9KWlp+d9IpcV8= +github.com/aws/aws-sdk-go-v2/config v1.18.38 h1:CByQCELMgm2tM1lAehx3XNg0R/pfeXsYzqn0Aq2chJQ= +github.com/aws/aws-sdk-go-v2/config v1.18.38/go.mod h1:vNm9Hf5VgG2fSUWhT3zFrqN/RosGcabFMYgiSoxKFU8= +github.com/aws/aws-sdk-go-v2/credentials v1.13.36 h1:ps0cPswZjpsOk6sLwG6fdXTzrYjCplgPEyG3OUbbdqE= +github.com/aws/aws-sdk-go-v2/credentials v1.13.36/go.mod h1:sY2phUzxbygoyDtTXhqi7GjGjCQ1S5a5Rj8u3ksBxCg= github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.13.11 h1:uDZJF1hu0EVT/4bogChk8DyjSF6fof6uL/0Y26Ma7Fg= github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.13.11/go.mod h1:TEPP4tENqBGO99KwVpV9MlOX4NSrSLP8u3KRy2CDwA8= github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.41 h1:22dGT7PneFMx4+b3pz7lMTRyN8ZKH7M2cW4GP9yUS2g= @@ -335,8 +335,8 @@ github.com/aws/aws-sdk-go-v2/service/s3 v1.38.5 h1:A42xdtStObqy7NGvzZKpnyNXvoOmm github.com/aws/aws-sdk-go-v2/service/s3 v1.38.5/go.mod h1:rDGMZA7f4pbmTtPOk5v5UM2lmX6UAbRnMDJeDvnH7AM= github.com/aws/aws-sdk-go-v2/service/sqs v1.24.5 h1:RyDpTOMEJO6ycxw1vU/6s0KLFaH3M0z/z9gXHSndPTk= github.com/aws/aws-sdk-go-v2/service/sqs v1.24.5/go.mod h1:RZBu4jmYz3Nikzpu/VuVvRnTEJ5a+kf36WT2fcl5Q+Q= -github.com/aws/aws-sdk-go-v2/service/sso v1.13.5 h1:oCvTFSDi67AX0pOX3PuPdGFewvLRU2zzFSrTsgURNo0= -github.com/aws/aws-sdk-go-v2/service/sso v1.13.5/go.mod h1:fIAwKQKBFu90pBxx07BFOMJLpRUGu8VOzLJakeY+0K4= +github.com/aws/aws-sdk-go-v2/service/sso v1.13.6 h1:2PylFCfKCEDv6PeSN09pC/VUiRd10wi1VfHG5FrW0/g= +github.com/aws/aws-sdk-go-v2/service/sso v1.13.6/go.mod h1:fIAwKQKBFu90pBxx07BFOMJLpRUGu8VOzLJakeY+0K4= github.com/aws/aws-sdk-go-v2/service/ssooidc v1.15.5 h1:dnInJb4S0oy8aQuri1mV6ipLlnZPfnsDNB9BGO9PDNY= github.com/aws/aws-sdk-go-v2/service/ssooidc v1.15.5/go.mod h1:yygr8ACQRY2PrEcy3xsUI357stq2AxnFM6DIsR9lij4= github.com/aws/aws-sdk-go-v2/service/sts v1.21.5 h1:CQBFElb0LS8RojMJlxRSo/HXipvTZW2S44Lt9Mk2aYQ= diff --git a/pkg/validator/templates.go b/pkg/validator/templates.go index c50bcc27..75f3ca20 100644 --- a/pkg/validator/templates.go +++ b/pkg/validator/templates.go @@ -9,6 +9,7 @@ func ErrorTemplates() map[string]string { "alphaunicode": `{{.Namespace}} can only contain unicode alphabetic characters`, "ascii": `{{.Namespace}} must contain only ascii characters`, "base64": `{{.Namespace}} must be a valid Base64 string`, + "base64rawurl": `{{.Namespace}} must be a valid Base64 URL safe string without '=' padding`, "base64url": `{{.Namespace}} must be a valid Base64 URL string`, "bcp47_language_tag": `{{.Namespace}} must be a valid BCP 47 language tag`, "bic": `{{.Namespace}} must be a valid ISO 9362 Business Identifier Code (SWIFT code)`, @@ -22,9 +23,12 @@ func ErrorTemplates() map[string]string { "containsany": `{{.Namespace}} must contain at least one of the following characters '{{.Param}}'`, "containsrune": `{{.Namespace}} must contain the following '{{.Param}}'`, "credit_card": `{{.Namespace}} must be a valid credit card number`, + "cron": `{{.Namespace}} must be a valid cron expression`, + "cve": `{{.Namespace}} must be a valid cve id, defined in cve.mitre.org`, "datauri": `{{.Namespace}} must contain a valid Data URI`, "datetime": `{{.Namespace}} does not match the {{.Param}} format`, - "dir": `{{.Namespace}} must be a valid directory`, + "dir": `{{.Namespace}} must be a valid existing directory`, + "dirpath": `{{.Namespace}} must be a valid directory path`, "dns_rfc1035_label": `{{.Namespace}} must be a valid DNS RFC 1035 label`, "e164": `{{.Namespace}} must be a valid E.164 formatted phone number`, "e164noplus": `{{.Namespace}} must be a valid E.164 formatted phone number without the leading '+' symbol`, @@ -33,9 +37,11 @@ func ErrorTemplates() map[string]string { "endsnotwith": `{{.Namespace}} must not end with {{.Param}}`, "endswith": `{{.Namespace}} must end with {{.Param}}`, "eq": `{{.Namespace}} must be equal to {{.Param}}`, + "eq_ignore_case": `{{.Namespace}} must be case-insensitive equal to {{.Param}}`, "eqcsfield": `{{.Namespace}} must be equal to {{.Param}}`, "eqfield": `{{.Namespace}} must be equal to {{.Param}}`, "eth_addr": `{{.Namespace}} must be a valid Ethereum address`, + "eth_addr_checksum": `{{.Namespace}} must be a valid checksumed Ethereum address`, "excluded_if": `{{.Namespace}} must not be present or it must be empty`, "excluded_unless": `{{.Namespace}} must not be present or it must be empty`, "excluded_with": `{{.Namespace}} must not be present or it must be empty`, @@ -47,7 +53,8 @@ func ErrorTemplates() map[string]string { "excludesrune": `{{.Namespace}} cannot contain the following '{{.Param}}'`, "fieldcontains": `{{.Namespace}} must contain the field {{.Param}}`, "fieldexcludes": `{{.Namespace}} must not contain the field {{.Param}}`, - "file": `{{.Namespace}} must be a valid file path`, + "file": `{{.Namespace}} must be a valid existing file path`, + "filepath": `{{.Namespace}} must be a valid file path`, "fqdn": `{{.Namespace}} must be a Fully Qualified Domain Name (FQDN)`, "gt": `{{.Namespace}} must {{ if (eq .Kind "String") }}be greater than {{.Param}} characters in length{{ else }}{{ if or (eq .Kind "Array") (eq .Kind "Map") (eq .Kind "String") }}contain more than {{.Param}} items{{ else }}be greater than {{.Param}}{{ end }}{{ end }}`, "gtcsfield": `{{.Namespace}} must {{ if (eq .Kind "String") }}be greater than {{.Param}} characters in length{{ else }}{{ if or (eq .Kind "Array") (eq .Kind "Map") (eq .Kind "String") }}contain more than {{.Param}} items{{ else }}be greater than {{.Param}}{{ end }}{{ end }}`, @@ -64,6 +71,8 @@ func ErrorTemplates() map[string]string { "hsla": `{{.Namespace}} must be a valid HSLA color`, "html": `{{.Namespace}} must be valid HTML`, "html_encoded": `{{.Namespace}} must be HTML-encoded`, + "http_url": `{{.Namespace}} must be a valid HTTP(s) URL`, + "image": `{{.Namespace}} must be a valid image file`, "ip": `{{.Namespace}} must be a valid IP address`, "ip4_addr": `{{.Namespace}} must be a resolvable IPv4 address`, "ip6_addr": `{{.Namespace}} must be a resolvable IPv6 address`, @@ -82,7 +91,7 @@ func ErrorTemplates() map[string]string { "iso4217": `{{.Namespace}} must be a valid ISO 4217 currency code`, "iso4217_numeric": `{{.Namespace}} must be a valid ISO 4217 numeric currency code`, "json": `{{.Namespace}} must be a valid json string`, - "jwt": `{{.Namespace}} must be a valid JWT string`, + "jwt": `{{.Namespace}} must be a valid JWT string`, "latitude": `{{.Namespace}} must contain valid latitude coordinates`, "len": `{{.Namespace}} must {{ if (eq .Kind "String") }}be {{.Param}} characters in length{{ else }}{{ if or (eq .Kind "Array") (eq .Kind "Map") (eq .Kind "String") }}contain {{.Param}} items{{ else }}be equal to {{.Param}}{{ end }}{{ end }}`, "longitude": `{{.Namespace}} must contain a valid longitude coordinates`, @@ -93,13 +102,16 @@ func ErrorTemplates() map[string]string { "ltecsfield": `{{.Namespace}} must {{ if (eq .Kind "String") }}be a maximum of {{.Param}} characters in length{{ else }}{{ if or (eq .Kind "Array") (eq .Kind "Map") (eq .Kind "String") }}contain at maximum {{.Param}} items{{ else }}be {{.Param}} or less{{ end }}{{ end }}`, "ltefield": `{{.Namespace}} must {{ if (eq .Kind "String") }}be a maximum of {{.Param}} characters in length{{ else }}{{ if or (eq .Kind "Array") (eq .Kind "Map") (eq .Kind "String") }}contain at maximum {{.Param}} items{{ else }}be {{.Param}} or less{{ end }}{{ end }}`, "ltfield": `{{.Namespace}} must {{ if (eq .Kind "String") }}be less than {{.Param}} characters in length{{ else }}{{ if or (eq .Kind "Array") (eq .Kind "Map") (eq .Kind "String") }}contain less than {{.Param}} items{{ else }}be less than {{.Param}}{{ end }}{{ end }}`, + "luhn_checksum": `{{.Namespace}} must have a valid Luhn checksum`, "mac": `{{.Namespace}} must contain a valid MAC address`, "max": `{{.Namespace}} must {{ if (eq .Kind "String") }}be a maximum of {{.Param}} characters in length{{ else }}{{ if or (eq .Kind "Array") (eq .Kind "Map") (eq .Kind "String") }}contain at maximum {{.Param}} items{{ else }}be {{.Param}} or less{{ end }}{{ end }}`, "md4": `{{.Namespace}} must be a valid MD4`, "md5": `{{.Namespace}} must be a valid MD5`, "min": `{{.Namespace}} must {{ if (eq .Kind "String") }}be at least {{.Param}} characters in length{{ else }}{{ if or (eq .Kind "Array") (eq .Kind "Map") (eq .Kind "String") }}contain at least {{.Param}} items{{ else }}be {{.Param}} or greater{{ end }}{{ end }}`, + "mongodb": `{{.Namespace}} must be a valid mongoDB objectID`, "multibyte": `{{.Namespace}} must contain multibyte characters`, "ne": `{{.Namespace}} must be different than {{.Param}}`, + "ne_ignore_case": `{{.Namespace}} must be case-insensitive different than {{.Param}}`, "necsfield": `{{.Namespace}} must be different than {{.Param}}`, "nefield": `{{.Namespace}} must be different than {{.Param}}`, "number": `{{.Namespace}} must be a valid number`, @@ -123,6 +135,8 @@ func ErrorTemplates() map[string]string { "sha256": `{{.Namespace}} must be a valid SHA256`, "sha384": `{{.Namespace}} must be a valid SHA384`, "sha512": `{{.Namespace}} must be a valid SHA512`, + "skip_unless": `{{.Namespace}} must be present and not empty only unless all the other specified fields are equal to the value following with the specified field`, + "spicedb": `{{.Namespace}} must be valid for use with Authzed SpiceDB in the indicated way`, "ssn": `{{.Namespace}} must be a valid US SSN number`, "startsnotwith": `{{.Namespace}} must not start with {{.Param}}`, "startswith": `{{.Namespace}} must start with {{.Param}}`,