This repository has been archived by the owner on Aug 18, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathschema.yaml
107 lines (105 loc) · 2.26 KB
/
schema.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
openapi: '3.0.2'
info:
title: JSONPlaceholder
version: '1.0'
servers:
- url: https://jsonplaceholder.typicode.com
components:
schemas:
entityId:
type: integer
minimum: 1
post:
type: object
properties:
id:
$ref: '#/components/schemas/entityId'
userId:
$ref: '#/components/schemas/entityId'
title:
type: string
body:
type: string
required:
- id
- userId
- title
- body
user:
type: object
properties:
id:
$ref: '#/components/schemas/entityId'
name:
type: string
username:
type: string
email:
type: string
format: email
required:
- id
- name
- username
- email
parameters:
user-id:
name: user-id
in: path
description: 'key: id of user'
required: true
style: simple
schema:
$ref: '#/components/schemas/entityId'
paths:
/posts:
get:
description: Get posts
operationId: getPosts
tags:
- post
parameters:
- name: userId
in: query
description: Filter results by user ID
required: false
style: form
schema:
$ref: '#/components/schemas/entityId'
- name: limit
in: query
description: Limit results by number
required: false
style: form
schema:
type: integer
responses:
'200':
description: OK
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/post'
/users/{user-id}:
get:
description: 'Get user by ID'
operationId: getUserById
tags:
- user
parameters:
- $ref: '#/components/parameters/user-id'
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/user'
'404':
description: User not found
content:
application/json:
schema:
type: object