diff --git a/lib/types/string.js b/lib/types/string.js index 5707cbdc47c2cf119bf7c453feb63a8422845f55..9e1c8de538515ad19d5e09a59a98869ba5b5ab81 100644 Binary files a/lib/types/string.js and b/lib/types/string.js differ diff --git a/package.json b/package.json index 633ef5a72bfa7a8258b77c64439287161c18cb16..915146198a92f951e7b30f249011c2d576e3e320 100644 --- a/package.json +++ b/package.json @@ -22,6 +22,7 @@ "z-schema": "^3.1.3" }, "dependencies": { + "chance": "^0.6.4", "deref": "^0.2.5", "faker": "^2.1.0", "randexp": "^0.4.0" diff --git a/spec/core/types/strings.json b/spec/core/types/strings.json index d742e2ac36084cb9ad3e1dbfd091dcdee6fd2964..ddd67fc5fe835bcf7e85f57e859e648b57e9ea25 100644 --- a/spec/core/types/strings.json +++ b/spec/core/types/strings.json @@ -78,6 +78,29 @@ "required": ["name", "email"] }, "valid": true + }, + { + "description": "should handle format (chance)", + "schema": { + "type": "object", + "properties": { + "userId": { + "type": "string", + "chance": "guid" + }, + "emailAddr": { + "type": "string", + "chance": { + "email": { + "domain": "fake.com" + } + }, + "pattern": ".+@fake.com" + } + }, + "required": ["userId", "emailAddr"] + }, + "valid": true } ] }