Skip to content

Instantly share code, notes, and snippets.

@bonii-xx
Created June 18, 2020 14:54
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 bonii-xx/1d48dd6d8e624aa3689cbb062ac2a7d2 to your computer and use it in GitHub Desktop.
Save bonii-xx/1d48dd6d8e624aa3689cbb062ac2a7d2 to your computer and use it in GitHub Desktop.
openapi: 3.0.0
info:
title: multi-content-type-schema
description: Use different schemas for different content types on the same endpoint
version: '1.0'
paths:
/foobar:
post:
responses:
'200':
description: OK
operationId: testEndpoint
requestBody:
description: Form key-value pairs
content:
application/x.foo+json:
schema:
$ref: '#/components/schemas/BodyA'
application/x.bar+json:
schema:
$ref: '#/components/schemas/BodyB'
components:
schemas:
BodyA:
properties:
foo:
type: string
BodyB:
properties:
bar:
type: string
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment