format.json 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  1. [
  2. {
  3. "description": "validation of regular expressions",
  4. "schema": {"format": "regex"},
  5. "tests": [
  6. {
  7. "description": "a valid regular expression",
  8. "data": "([abc])+\\s+$",
  9. "valid": true
  10. },
  11. {
  12. "description": "a regular expression with unclosed parens is invalid",
  13. "data": "^(abc]",
  14. "valid": false
  15. }
  16. ]
  17. },
  18. {
  19. "description": "validation of date-time strings",
  20. "schema": {"format": "date-time"},
  21. "tests": [
  22. {
  23. "description": "a valid date-time string",
  24. "data": "1963-06-19T08:30:06.283185Z",
  25. "valid": true
  26. },
  27. {
  28. "description": "an invalid date-time string",
  29. "data": "06/19/1963 08:30:06 PST",
  30. "valid": false
  31. },
  32. {
  33. "description": "only RFC3339 not all of ISO 8601 are valid",
  34. "data": "2013-350T01:01:01",
  35. "valid": false
  36. }
  37. ]
  38. },
  39. {
  40. "description": "validation of date strings",
  41. "schema": {"format": "date"},
  42. "tests": [
  43. {
  44. "description": "a valid date string",
  45. "data": "1963-06-19",
  46. "valid": true
  47. },
  48. {
  49. "description": "an invalid date string",
  50. "data": "06/19/1963",
  51. "valid": false
  52. }
  53. ]
  54. },
  55. {
  56. "description": "validation of time strings",
  57. "schema": {"format": "time"},
  58. "tests": [
  59. {
  60. "description": "a valid time string",
  61. "data": "08:30:06",
  62. "valid": true
  63. },
  64. {
  65. "description": "an invalid time string",
  66. "data": "8:30 AM",
  67. "valid": false
  68. }
  69. ]
  70. },
  71. {
  72. "description": "validation of URIs",
  73. "schema": {"format": "uri"},
  74. "tests": [
  75. {
  76. "description": "a valid URI",
  77. "data": "http://foo.bar/?baz=qux#quux",
  78. "valid": true
  79. },
  80. {
  81. "description": "a valid protocol-relative URI",
  82. "data": "//foo.bar/?baz=qux#quux",
  83. "valid": true
  84. },
  85. {
  86. "description": "an invalid URI",
  87. "data": "\\\\WINDOWS\\fileshare",
  88. "valid": false
  89. },
  90. {
  91. "description": "an invalid URI though valid URI reference",
  92. "data": "abc",
  93. "valid": false
  94. }
  95. ]
  96. },
  97. {
  98. "description": "validation of e-mail addresses",
  99. "schema": {"format": "email"},
  100. "tests": [
  101. {
  102. "description": "a valid e-mail address",
  103. "data": "joe.bloggs@example.com",
  104. "valid": true
  105. },
  106. {
  107. "description": "an invalid e-mail address",
  108. "data": "2962",
  109. "valid": false
  110. }
  111. ]
  112. },
  113. {
  114. "description": "validation of IP addresses",
  115. "schema": {"format": "ip-address"},
  116. "tests": [
  117. {
  118. "description": "a valid IP address",
  119. "data": "192.168.0.1",
  120. "valid": true
  121. },
  122. {
  123. "description": "an IP address with too many components",
  124. "data": "127.0.0.0.1",
  125. "valid": false
  126. },
  127. {
  128. "description": "an IP address with out-of-range values",
  129. "data": "256.256.256.256",
  130. "valid": false
  131. }
  132. ]
  133. },
  134. {
  135. "description": "validation of IPv6 addresses",
  136. "schema": {"format": "ipv6"},
  137. "tests": [
  138. {
  139. "description": "a valid IPv6 address",
  140. "data": "::1",
  141. "valid": true
  142. },
  143. {
  144. "description": "an IPv6 address with out-of-range values",
  145. "data": "12345::",
  146. "valid": false
  147. },
  148. {
  149. "description": "an IPv6 address with too many components",
  150. "data": "1:1:1:1:1:1:1:1:1:1:1:1:1:1:1:1",
  151. "valid": false
  152. },
  153. {
  154. "description": "an IPv6 address containing illegal characters",
  155. "data": "::laptop",
  156. "valid": false
  157. }
  158. ]
  159. },
  160. {
  161. "description": "validation of host names",
  162. "schema": {"format": "host-name"},
  163. "tests": [
  164. {
  165. "description": "a valid host name",
  166. "data": "www.example.com",
  167. "valid": true
  168. },
  169. {
  170. "description": "a host name starting with an illegal character",
  171. "data": "-a-host-name-that-starts-with--",
  172. "valid": false
  173. },
  174. {
  175. "description": "a host name containing illegal characters",
  176. "data": "not_a_valid_host_name",
  177. "valid": false
  178. },
  179. {
  180. "description": "a host name with a component too long",
  181. "data": "a-vvvvvvvvvvvvvvvveeeeeeeeeeeeeeeerrrrrrrrrrrrrrrryyyyyyyyyyyyyyyy-long-host-name-component",
  182. "valid": false
  183. }
  184. ]
  185. },
  186. {
  187. "description": "validation of CSS colors",
  188. "schema": {"format": "color"},
  189. "tests": [
  190. {
  191. "description": "a valid CSS color name",
  192. "data": "fuchsia",
  193. "valid": true
  194. },
  195. {
  196. "description": "a valid six-digit CSS color code",
  197. "data": "#CC8899",
  198. "valid": true
  199. },
  200. {
  201. "description": "a valid three-digit CSS color code",
  202. "data": "#C89",
  203. "valid": true
  204. },
  205. {
  206. "description": "an invalid CSS color code",
  207. "data": "#00332520",
  208. "valid": false
  209. },
  210. {
  211. "description": "an invalid CSS color name",
  212. "data": "puce",
  213. "valid": false
  214. },
  215. {
  216. "description": "a CSS color name containing invalid characters",
  217. "data": "light_grayish_red-violet",
  218. "valid": false
  219. }
  220. ]
  221. }
  222. ]