this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

encoding/jsonschema: non-string regular expressions should error

The error from `Value.String` was being ignored. Use `strValue` instead,
which gives an error if the value is not a string.

Signed-off-by: Roger Peppe <rogpeppe@gmail.com>
Change-Id: If599225bd9f3e2f5db6db3153dd0a40c01393504
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1201124
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Unity-Result: CUE porcuepine <cue.porcuepine@gmail.com>
TryBot-Result: CUEcueckoo <cueckoo@cuelang.org>

+12 -1
+1 -1
encoding/jsonschema/constraints_string.go
··· 49 49 } 50 50 51 51 func constraintPattern(key string, n cue.Value, s *state) { 52 - str, _ := n.String() 52 + str, _ := s.strValue(n) 53 53 if _, err := regexp.Compile(str); err != nil { 54 54 if s.cfg.StrictFeatures { 55 55 // TODO check if the error is only because of an unsupported
+11
encoding/jsonschema/testdata/txtar/invalid_pattern.txtar
··· 1 + Invalid patterns should result in failure 2 + 3 + -- schema.json -- 4 + { 5 + "$schema": "https://json-schema.org/draft/2020-12/schema", 6 + "pattern": 1234 7 + } 8 + -- out/decode/extract -- 9 + ERROR: 10 + invalid string: 11 + schema.json:3:5