uniqueItems.json 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. [
  2. {
  3. "description": "uniqueItems validation",
  4. "schema": {"uniqueItems": true},
  5. "tests": [
  6. {
  7. "description": "unique array of integers is valid",
  8. "data": [1, 2],
  9. "valid": true
  10. },
  11. {
  12. "description": "non-unique array of integers is invalid",
  13. "data": [1, 1],
  14. "valid": false
  15. },
  16. {
  17. "description": "numbers are unique if mathematically unequal",
  18. "data": [1.0, 1.00, 1],
  19. "valid": false
  20. },
  21. {
  22. "description": "unique array of objects is valid",
  23. "data": [{"foo": "bar"}, {"foo": "baz"}],
  24. "valid": true
  25. },
  26. {
  27. "description": "non-unique array of objects is invalid",
  28. "data": [{"foo": "bar"}, {"foo": "bar"}],
  29. "valid": false
  30. },
  31. {
  32. "description": "unique array of nested objects is valid",
  33. "data": [
  34. {"foo": {"bar" : {"baz" : true}}},
  35. {"foo": {"bar" : {"baz" : false}}}
  36. ],
  37. "valid": true
  38. },
  39. {
  40. "description": "non-unique array of nested objects is invalid",
  41. "data": [
  42. {"foo": {"bar" : {"baz" : true}}},
  43. {"foo": {"bar" : {"baz" : true}}}
  44. ],
  45. "valid": false
  46. },
  47. {
  48. "description": "unique array of arrays is valid",
  49. "data": [["foo"], ["bar"]],
  50. "valid": true
  51. },
  52. {
  53. "description": "non-unique array of arrays is invalid",
  54. "data": [["foo"], ["foo"]],
  55. "valid": false
  56. },
  57. {
  58. "description": "1 and true are unique",
  59. "data": [1, true],
  60. "valid": true
  61. },
  62. {
  63. "description": "0 and false are unique",
  64. "data": [0, false],
  65. "valid": true
  66. },
  67. {
  68. "description": "unique heterogeneous types are valid",
  69. "data": [{}, [1], true, null, 1],
  70. "valid": true
  71. },
  72. {
  73. "description": "non-unique heterogeneous types are invalid",
  74. "data": [{}, [1], true, null, {}, 1],
  75. "valid": false
  76. }
  77. ]
  78. }
  79. ]