required.json 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. [
  2. {
  3. "description": "required validation",
  4. "schema": {
  5. "properties": {
  6. "foo": {"required" : true},
  7. "bar": {}
  8. }
  9. },
  10. "tests": [
  11. {
  12. "description": "present required property is valid",
  13. "data": {"foo": 1},
  14. "valid": true
  15. },
  16. {
  17. "description": "non-present required property is invalid",
  18. "data": {"bar": 1},
  19. "valid": false
  20. }
  21. ]
  22. },
  23. {
  24. "description": "required default validation",
  25. "schema": {
  26. "properties": {
  27. "foo": {}
  28. }
  29. },
  30. "tests": [
  31. {
  32. "description": "not required by default",
  33. "data": {},
  34. "valid": true
  35. }
  36. ]
  37. },
  38. {
  39. "description": "required explicitly false validation",
  40. "schema": {
  41. "properties": {
  42. "foo": {"required": false}
  43. }
  44. },
  45. "tests": [
  46. {
  47. "description": "not required if required is false",
  48. "data": {},
  49. "valid": true
  50. }
  51. ]
  52. }
  53. ]