unions-intersections.ask-1.json 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. {
  2. "additionalProperties": false,
  3. "properties": {
  4. "maybe": {
  5. "anyOf": [
  6. {
  7. "type": "null"
  8. },
  9. {
  10. "additionalProperties": false,
  11. "properties": {
  12. "ok": {
  13. "const": true
  14. },
  15. "value": {
  16. "type": "string"
  17. }
  18. },
  19. "required": [
  20. "ok",
  21. "value"
  22. ],
  23. "type": "object"
  24. }
  25. ]
  26. },
  27. "outcome": {
  28. "anyOf": [
  29. {
  30. "additionalProperties": false,
  31. "properties": {
  32. "ok": {
  33. "const": true
  34. },
  35. "value": {
  36. "type": "string"
  37. }
  38. },
  39. "required": [
  40. "ok",
  41. "value"
  42. ],
  43. "type": "object"
  44. },
  45. {
  46. "additionalProperties": false,
  47. "properties": {
  48. "error": {
  49. "type": "string"
  50. },
  51. "ok": {
  52. "const": false
  53. }
  54. },
  55. "required": [
  56. "ok",
  57. "error"
  58. ],
  59. "type": "object"
  60. }
  61. ]
  62. },
  63. "record": {
  64. "additionalProperties": false,
  65. "properties": {
  66. "createdAtEpoch": {
  67. "type": "number"
  68. },
  69. "id": {
  70. "type": "string"
  71. }
  72. },
  73. "required": [
  74. "id",
  75. "createdAtEpoch"
  76. ],
  77. "type": "object"
  78. }
  79. },
  80. "required": [
  81. "outcome",
  82. "maybe",
  83. "record"
  84. ],
  85. "type": "object"
  86. }