diff --git a/reflect.go b/reflect.go index 4ee0b33..fb5d12d 100644 --- a/reflect.go +++ b/reflect.go @@ -892,6 +892,8 @@ func (t *Schema) arrayKeywords(tags []string) { } case "format": t.Items.Format = val + case "pattern": + t.Items.Pattern = val } } } diff --git a/reflect_test.go b/reflect_test.go index 804e9fa..fe2a030 100644 --- a/reflect_test.go +++ b/reflect_test.go @@ -527,9 +527,9 @@ func TestSplitOnUnescapedCommas(t *testing.T) { } } -func TestArrayFormat(t *testing.T) { +func TestArrayExtraTags(t *testing.T) { type URIArray struct { - TestURIs []string `jsonschema:"type=array,format=uri"` + TestURIs []string `jsonschema:"type=array,format=uri,pattern=^https://.*"` } r := new(Reflector) @@ -544,4 +544,6 @@ func TestArrayFormat(t *testing.T) { p := i.(*Schema) pt := p.Items.Format require.Equal(t, pt, "uri") + pt = p.Items.Pattern + require.Equal(t, pt, "^https://.*") }