-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapi.yaml
118 lines (113 loc) · 2.72 KB
/
api.yaml
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
openapi: 3.0.0
info:
title: Root Test Definition
description: API definition for testing custom Spectral rules.
version: 1.0.0
servers:
- url: https://some-madeup-url.com/api
tags:
- name: Drinks
description: Operations related to drinks
paths:
/v1/drinks:
post:
operationId: create_drink
summary: Create a drink
description: Create a new Drink instance.
tags:
- Drinks
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/Drink'
responses:
'201':
description: Success!
content:
application/json:
schema:
$ref: '#/components/schemas/Drink'
example:
type: soda
name: Root Beer
get:
operationId: list_drinks
summary: List drinks
description: List the available drinks.
tags:
- Drinks
responses:
'201':
description: Success!
content:
application/json:
schema:
$ref: '#/components/schemas/Drinks'
example:
drinks:
- type: soda
name: Root Beer
components:
schemas:
Drink:
description: A Drink can be either a Juice or Soda instance.
oneOf:
- $ref: '#/components/schemas/Juice'
- $ref: '#/components/schemas/Soda'
discriminator:
propertyName: type
example:
type: soda
name: Root Beer
Drinks:
description: A collection of drinks
type: object
properties:
drinks:
description: The list of drinks.
type: array
items:
$ref: '#/components/schemas/Drink'
Soda:
# description: This is a Soda.
type: object
required:
- type
- name
properties:
type:
description: The drink type.
type: string
pattern: '[a-z]+'
minLength: 1
maxLength: 64
enum:
- soda
name:
description: The name of the soda.
type: string
pattern: '[a-z]+'
minLength: 1
maxLength: 64
Juice:
description: This is a juice.
type: object
required:
- type
- fruit
properties:
type:
description: The drink type.
type: string
pattern: '[a-z]+'
minLength: 1
maxLength: 64
enum:
- juice
fruit:
description: The fruit used in the juice.
type: string
pattern: '[a-z]+'
minLength: 1
maxLength: 64