Created
November 13, 2025 08:54
-
-
Save ThomasVille/06ebf97ed17966c6d0cb2565a89c5aa2 to your computer and use it in GitHub Desktop.
`#[serde(tag)]` conflicts with discriminator property in nested objects
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "openapi": "3.1.0", | |
| "info": { | |
| "title": "Test", | |
| "description": "Reproduction scenario", | |
| "version": "0.68.0" | |
| }, | |
| "components": { | |
| "schemas": { | |
| "PersonResource": { | |
| "type": "object", | |
| "required": ["type", "id"], | |
| "properties": { | |
| "type": { | |
| "type": "string", | |
| "enum": ["person"] | |
| }, | |
| "id": { | |
| "type": "string" | |
| }, | |
| "name": { | |
| "type": "string" | |
| } | |
| } | |
| }, | |
| "OrganizationResource": { | |
| "type": "object", | |
| "required": ["type", "id"], | |
| "properties": { | |
| "type": { | |
| "type": "string", | |
| "enum": ["organization"] | |
| }, | |
| "id": { | |
| "type": "string" | |
| }, | |
| "companyName": { | |
| "type": "string" | |
| } | |
| } | |
| }, | |
| "ResourceUnion": { | |
| "oneOf": [ | |
| { | |
| "$ref": "#/components/schemas/PersonResource" | |
| }, | |
| { | |
| "$ref": "#/components/schemas/OrganizationResource" | |
| } | |
| ], | |
| "discriminator": { | |
| "propertyName": "type", | |
| "mapping": { | |
| "person": "#/components/schemas/PersonResource", | |
| "organization": "#/components/schemas/OrganizationResource" | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "paths": {} | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment