- {
- "openapi": "3.0.0",
- "info": {
- "title": "Example API",
- "version": "0.1.0"
- },
- "paths": {
- "/test": {
- "post": {
- "summary": "Test",
- "operationId": "TestTaggedUnion",
- "requestBody": {
- "required": true,
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/TaggedUnionExample"
- }
- }
- }
- },
- "responses": {
- "200": {
- "description": "Successful Response",
- "content": {
- "application/json": {
- "schema": {}
- }
- }
- }
- }
- }
- }
- },
- "components": {
- "schemas": {
- "Prop0Params": {
- "properties": {
- "service": {
- "type": "string",
- "enum": [
- "Prop0"
- ],
- "title": "Service",
- "default": "Prop0"
- },
- "prop0": {
- "type": "string",
- "title": "Prop0"
- }
- },
- "type": "object",
- "title": "Prop0Params"
- },
- "Prop1Params": {
- "properties": {
- "service": {
- "type": "string",
- "enum": [
- "Prop1"
- ],
- "title": "Service",
- "default": "Prop1"
- },
- "prop1": {
- "type": "string",
- "title": "Prop1"
- }
- },
- "type": "object",
- "title": "Prop1Params"
- },
- "TaggedUnionExample": {
- "properties": {
- "query": {
- "type": "string",
- "title": "Query"
- },
- "params": {
- "oneOf": [
- {
- "$ref": "#/components/schemas/Prop1Params"
- },
- {
- "$ref": "#/components/schemas/Prop0Params"
- }
- ],
- "title": "Params",
- "discriminator": {
- "propertyName": "service",
- "mapping": {
- "Prop0": "#/components/schemas/Prop0Params",
- "Prop1": "#/components/schemas/Prop1Params"
- }
- }
- }
- },
- "type": "object",
- "required": [
- "query",
- "params"
- ],
- "title": "TaggedUnionExample"
- }
- }
- }
- }