diff --git a/validation_tags_to_schema.go b/validation_tags_to_schema.go index 778f140..ab43328 100644 --- a/validation_tags_to_schema.go +++ b/validation_tags_to_schema.go @@ -192,6 +192,8 @@ func ValidationTagsToSchema(validationTag string) (tagSchema Schema, required bo schema.Pattern = "^urn:[a-zA-Z0-9][a-zA-Z0-9-]{0,31}:([a-zA-Z0-9()+,\\-.:=@;$_!*'%/?#]|%[0-9a-fA-F]{2})+$" // Primitives + case "": + continue case "required": fieldRequired = true diff --git a/validation_tags_to_schema_test.go b/validation_tags_to_schema_test.go index 21d5cbc..df1126c 100644 --- a/validation_tags_to_schema_test.go +++ b/validation_tags_to_schema_test.go @@ -658,6 +658,11 @@ func TestValidateTagsToSchema(t *testing.T) { validateTag: "urn_rfc2141", expectedSchema: singleSchemaFromPattern("^urn:[a-zA-Z0-9][a-zA-Z0-9-]{0,31}:([a-zA-Z0-9()+,\\-.:=@;$_!*'%/?#]|%[0-9a-fA-F]{2})+$"), }, + { + name: "empty", + validateTag: "", + expectedSchema: Schema{}, + }, { name: "required", validateTag: "required",