Skip to content

Instantly share code, notes, and snippets.

@david0
Created February 22, 2024 16:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save david0/1b3d159b4e951e1a589fac596e9a0488 to your computer and use it in GitHub Desktop.
Save david0/1b3d159b4e951e1a589fac596e9a0488 to your computer and use it in GitHub Desktop.
openapi: "3.0.0"
info:
version: 1.0.0
title: OneOf example
paths:
/search:
post:
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/Filter"
responses:
'200':
description: Expected response to a valid request
content:
application/json:
schema:
type: object
components:
schemas:
Username:
type: object
properties:
username:
type: string
required:
- username
AccountNumber:
type: object
properties:
accountNumber:
type: string
required:
- accountNumber
Filter:
oneOf:
- $ref: "#/components/schemas/Username"
- $ref: "#/components/schemas/AccountNumber"
type: object
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment