-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample-openapi.yaml
More file actions
113 lines (104 loc) · 2.83 KB
/
example-openapi.yaml
File metadata and controls
113 lines (104 loc) · 2.83 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
openapi: 3.0.3
info:
title: Spectral Level Tester API
version: 1.2.3
description: This API is intentionally full of graduated violations
# Level-2 & Level-3 will complain: no contact, no license
servers:
- url: https://api.example.com # Level-3 will complain: no /v1, /v2, etc.
tags:
- name: users
description: User management endpoints
paths:
/users:
get:
summary: List users
# Level-1: OK (summary is optional there)
# Level-2 & Level-3: missing summary → error
operationId: listUsers
parameters:
- name: limit
in: query
schema:
type: integer
- name: cursor
in: query
schema:
type: string
responses:
'200':
description: OK
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/User'
example: # Level-3 requires valid examples
- id: 123
name: John Doe
email: john@example.com
'400':
description: Bad request
/user/{id}: # ← not kebab-case and singular → Level-3 naming violation
get:
tags:
- users
operationId: getUserById
parameters:
- name: id
in: path
required: true
schema:
type: string
responses:
'200':
description: Success
content:
application/json:
schema:
$ref: '#/components/schemas/User'
example: {} # ← intentionally empty → Level-3 error
'404':
$ref: '#/components/responses/NotFound'
/admin/legacy-endpoint:
post:
deprecated: true
# Level-3 will require a sunset date in description
description: Old endpoint – will be removed eventually
operationId: createLegacyThing
responses:
'201':
description: Created
components:
schemas:
User:
type: object
required:
- id
- email
properties:
id:
type: integer
format: int64
name:
type: string
email:
type: string
format: email
createdAt:
type: string
format: date-time
# Intentionally missing example → Level-3 will complain
responses:
NotFound:
description: Resource not found
content:
application/json:
schema:
type: object
properties:
error:
type: string
securitySchemes: {} # ← empty → Level-3 will fail “must define at least one”
security: [] # ← no security defined at all → Level-2 hint, Level-3 error