1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
|
# Test case for issue #1763
# allOf referencing a schema with oneOf + discriminator
openapi: 3.0.0
info:
title: Test API
version: 1.0.0
paths:
/users:
post:
summary: Create a user
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/UserPostRequest'
responses:
'200':
description: Success
components:
schemas:
AdminUser:
type: object
required:
- userType
- adminLevel
properties:
userType:
type: string
enum:
- admin
adminLevel:
type: integer
RegularUser:
type: object
required:
- userType
- username
properties:
userType:
type: string
enum:
- regular
username:
type: string
User:
oneOf:
- $ref: '#/components/schemas/AdminUser'
- $ref: '#/components/schemas/RegularUser'
discriminator:
propertyName: userType
mapping:
admin: '#/components/schemas/AdminUser'
regular: '#/components/schemas/RegularUser'
UserPostRequest:
allOf:
- $ref: '#/components/schemas/User'
- type: object
required:
- userId
properties:
userId:
type: string
|