1. {
  2. "openapi": "3.0.0",
  3. "info": {
  4. "title": "Example API",
  5. "version": "0.1.0"
  6. },
  7. "paths": {
  8. "/test": {
  9. "post": {
  10. "summary": "Test",
  11. "operationId": "TestTaggedUnion",
  12. "requestBody": {
  13. "required": true,
  14. "content": {
  15. "application/json": {
  16. "schema": {
  17. "$ref": "#/components/schemas/TaggedUnionExample"
  18. }
  19. }
  20. }
  21. },
  22. "responses": {
  23. "200": {
  24. "description": "Successful Response",
  25. "content": {
  26. "application/json": {
  27. "schema": {}
  28. }
  29. }
  30. }
  31. }
  32. }
  33. }
  34. },
  35. "components": {
  36. "schemas": {
  37. "Prop0Params": {
  38. "properties": {
  39. "service": {
  40. "type": "string",
  41. "enum": [
  42. "Prop0"
  43. ],
  44. "title": "Service",
  45. "default": "Prop0"
  46. },
  47. "prop0": {
  48. "type": "string",
  49. "title": "Prop0"
  50. }
  51. },
  52. "type": "object",
  53. "title": "Prop0Params"
  54. },
  55. "Prop1Params": {
  56. "properties": {
  57. "service": {
  58. "type": "string",
  59. "enum": [
  60. "Prop1"
  61. ],
  62. "title": "Service",
  63. "default": "Prop1"
  64. },
  65. "prop1": {
  66. "type": "string",
  67. "title": "Prop1"
  68. }
  69. },
  70. "type": "object",
  71. "title": "Prop1Params"
  72. },
  73. "TaggedUnionExample": {
  74. "properties": {
  75. "query": {
  76. "type": "string",
  77. "title": "Query"
  78. },
  79. "params": {
  80. "oneOf": [
  81. {
  82. "$ref": "#/components/schemas/Prop1Params"
  83. },
  84. {
  85. "$ref": "#/components/schemas/Prop0Params"
  86. }
  87. ],
  88. "title": "Params",
  89. "discriminator": {
  90. "propertyName": "service",
  91. "mapping": {
  92. "Prop0": "#/components/schemas/Prop0Params",
  93. "Prop1": "#/components/schemas/Prop1Params"
  94. }
  95. }
  96. }
  97. },
  98. "type": "object",
  99. "required": [
  100. "query",
  101. "params"
  102. ],
  103. "title": "TaggedUnionExample"
  104. }
  105. }
  106. }
  107. }