extends.json 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. [
  2. {
  3. "description": "extends",
  4. "schema": {
  5. "properties": {"bar": {"type": "integer", "required": true}},
  6. "extends": {
  7. "properties": {
  8. "foo": {"type": "string", "required": true}
  9. }
  10. }
  11. },
  12. "tests": [
  13. {
  14. "description": "extends",
  15. "data": {"foo": "baz", "bar": 2},
  16. "valid": true
  17. },
  18. {
  19. "description": "mismatch extends",
  20. "data": {"foo": "baz"},
  21. "valid": false
  22. },
  23. {
  24. "description": "mismatch extended",
  25. "data": {"bar": 2},
  26. "valid": false
  27. },
  28. {
  29. "description": "wrong type",
  30. "data": {"foo": "baz", "bar": "quux"},
  31. "valid": false
  32. }
  33. ]
  34. },
  35. {
  36. "description": "multiple extends",
  37. "schema": {
  38. "properties": {"bar": {"type": "integer", "required": true}},
  39. "extends" : [
  40. {
  41. "properties": {
  42. "foo": {"type": "string", "required": true}
  43. }
  44. },
  45. {
  46. "properties": {
  47. "baz": {"type": "null", "required": true}
  48. }
  49. }
  50. ]
  51. },
  52. "tests": [
  53. {
  54. "description": "valid",
  55. "data": {"foo": "quux", "bar": 2, "baz": null},
  56. "valid": true
  57. },
  58. {
  59. "description": "mismatch first extends",
  60. "data": {"bar": 2, "baz": null},
  61. "valid": false
  62. },
  63. {
  64. "description": "mismatch second extends",
  65. "data": {"foo": "quux", "bar": 2},
  66. "valid": false
  67. },
  68. {
  69. "description": "mismatch both",
  70. "data": {"bar": 2},
  71. "valid": false
  72. }
  73. ]
  74. },
  75. {
  76. "description": "extends simple types",
  77. "schema": {
  78. "minimum": 20,
  79. "extends": {"maximum": 30}
  80. },
  81. "tests": [
  82. {
  83. "description": "valid",
  84. "data": 25,
  85. "valid": true
  86. },
  87. {
  88. "description": "mismatch extends",
  89. "data": 35,
  90. "valid": false
  91. }
  92. ]
  93. }
  94. ]