Skip to content

Instantly share code, notes, and snippets.

@InfinityByTen
Created September 24, 2025 07:23
Show Gist options
  • Select an option

  • Save InfinityByTen/29d554b9dcde1fe08ff6a399cb05b205 to your computer and use it in GitHub Desktop.

Select an option

Save InfinityByTen/29d554b9dcde1fe08ff6a399cb05b205 to your computer and use it in GitHub Desktop.
Minimal OpenAPI spec using discriminators
openapi: 3.0.3
info:
title: Discriminator Bug Demo API
description: Minimal example demonstrating discriminator field conflicts in OpenAPI Generator
version: 1.0.0
paths:
/shape:
post:
summary: Submit a shape
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/Shape'
responses:
'200':
description: Success
content:
application/json:
schema:
$ref: '#/components/schemas/Shape'
components:
schemas:
Shape:
type: object
discriminator:
propertyName: type
mapping:
circle: '#/components/schemas/Circle'
rectangle: '#/components/schemas/Rectangle'
oneOf:
- $ref: '#/components/schemas/Circle'
- $ref: '#/components/schemas/Rectangle'
required:
- type
Circle:
type: object
properties:
type:
type: string
enum: [circle]
radius:
type: number
format: double
required:
- type
- radius
Rectangle:
type: object
properties:
type:
type: string
enum: [rectangle]
width:
type: number
format: double
height:
type: number
format: double
required:
- type
- width
- height
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment