-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathopenapi-3.1.yaml
More file actions
127 lines (127 loc) · 3.4 KB
/
Copy pathopenapi-3.1.yaml
File metadata and controls
127 lines (127 loc) · 3.4 KB
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
119
120
121
122
123
124
125
126
127
openapi: 3.1.0
info:
title: Sample API (OpenAPI 3.1, YAML)
description: >-
The same Users API as openapi-3.1.json, written in YAML. Showcases
3.1-only features: full JSON Schema (type arrays for nullable instead of
`nullable: true`), the `examples` keyword, an SPDX `license.identifier`,
and a top-level `webhooks` section.
version: 1.0.0
license:
name: MIT
identifier: MIT
contact:
name: API Support
email: support@example.com
servers:
- url: https://api.example.com/v1
description: Production server
tags:
- name: Users
description: User management
paths:
/users:
get:
summary: Get user list
description: Returns a list of all users
tags: [Users]
responses:
'200':
description: Successfully returned user list
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/User'
post:
summary: Create new user
description: Create a new user account
tags: [Users]
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/NewUser'
responses:
'201':
description: User created successfully
content:
application/json:
schema:
$ref: '#/components/schemas/User'
'400':
description: Invalid request parameters
/users/{userId}:
get:
summary: Get specific user
description: Get detailed user information by ID
tags: [Users]
parameters:
- name: userId
in: path
required: true
description: User ID
schema:
type: integer
responses:
'200':
description: Successfully returned user information
content:
application/json:
schema:
$ref: '#/components/schemas/User'
'404':
description: User not found
webhooks:
userCreated:
post:
summary: User created event
description: >-
Sent to your registered callback URL whenever a new user is created.
`webhooks` is a top-level object introduced in OpenAPI 3.1.
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/User'
responses:
'200':
description: Return a 200 to acknowledge that the event was received.
components:
schemas:
User:
type: object
properties:
id:
type: integer
examples: [1]
name:
type: string
examples: [John Doe]
email:
type: string
format: email
examples: [john@example.com]
createdAt:
type: string
format: date-time
examples: ['2025-11-04T10:00:00Z']
deletedAt:
type: [string, 'null']
format: date-time
description: >-
Soft-delete timestamp, or null for active accounts. The
["string", "null"] type array replaces 3.0's `nullable: true`.
NewUser:
type: object
required: [name, email]
properties:
name:
type: string
examples: [Jane Smith]
email:
type: string
format: email
examples: [jane@example.com]