Skip to content

Instantly share code, notes, and snippets.

@mymtw
Created March 1, 2021 16:27
Show Gist options
  • Save mymtw/96fe3a43beb150fd46d39ec794a33d1c to your computer and use it in GitHub Desktop.
Save mymtw/96fe3a43beb150fd46d39ec794a33d1c to your computer and use it in GitHub Desktop.
openapi: 3.0.0
info:
title: title
version: 1.0.0
servers:
- url: http://127.0.0.1:8080
paths:
/bad:
get:
tags:
- dota2
summary: test get schemes
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/nested'
operationId: getSchema
post:
tags:
- dota2
summary: test
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/nested'
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/nested'
operationId: createSchemes
components:
schemas:
nested:
type: object
properties:
oneof:
$ref: '#/components/schemas/oneof'
oneof:
discriminator:
propertyName: some name
mapping:
one: '#/components/schemas/x'
two: '#/components/schemas/y'
oneOf:
- $ref: '#/components/schemas/x'
- $ref: '#/components/schemas/y'
x:
type: object
required:
- first_name
properties:
first_name:
type: string
minLength: 3
maxLength: 20
pattern: ^one$
'y':
type: object
required:
- last_name
properties:
last_name:
type: string
minLength: 3
maxLength: 20
pattern: ^two$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment