-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsourceforge-rules.yml
More file actions
112 lines (101 loc) · 3.21 KB
/
sourceforge-rules.yml
File metadata and controls
112 lines (101 loc) · 3.21 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
extends: spectral:oas
rules:
# SourceForge uses /rest/ prefix for all endpoints
sourceforge-rest-prefix:
description: All SourceForge API paths must begin with /rest/
severity: error
given: "$.paths"
then:
function: pattern
functionOptions:
match: "^\\/rest\\/"
# All operations must have summaries in Title Case
sourceforge-operation-summary-title-case:
description: Operation summaries must use Title Case
severity: warn
given: "$.paths[*][get,post,put,patch,delete].summary"
then:
function: pattern
functionOptions:
match: "^[A-Z][a-zA-Z0-9]*([ ][A-Z][a-zA-Z0-9]*)*$"
# All operations must have operationId
sourceforge-operation-id-required:
description: All operations must have an operationId
severity: error
given: "$.paths[*][get,post,put,patch,delete]"
then:
field: operationId
function: truthy
# operationId must use camelCase
sourceforge-operation-id-camel-case:
description: OperationId must use camelCase convention
severity: warn
given: "$.paths[*][get,post,put,patch,delete].operationId"
then:
function: pattern
functionOptions:
match: "^[a-z][a-zA-Z0-9]*$"
# All operations must have tags
sourceforge-operation-has-tags:
description: All operations must have at least one tag
severity: warn
given: "$.paths[*][get,post,put,patch,delete]"
then:
field: tags
function: truthy
# POST operations should have requestBody
sourceforge-post-has-request-body:
description: POST operations must define a requestBody
severity: error
given: "$.paths[*].post"
then:
field: requestBody
function: truthy
# 401 response required
sourceforge-401-response:
description: Operations must document 401 Unauthorized response
severity: warn
given: "$.paths[*][get,post,put,patch,delete].responses"
then:
field: "401"
function: defined
# DELETE returns 204
sourceforge-delete-returns-204:
description: DELETE operations should return 204 No Content
severity: warn
given: "$.paths[*].delete.responses"
then:
field: "204"
function: defined
# All tags must be Title Case
sourceforge-tags-title-case:
description: All tags in the spec must use Title Case
severity: warn
given: "$.tags[*].name"
then:
function: pattern
functionOptions:
match: "^[A-Z][a-zA-Z0-9]*([ ][A-Z][a-zA-Z0-9]*)*$"
# Security must be defined
sourceforge-security-defined:
description: OAuth2 security must be defined globally or per operation
severity: error
given: "$"
then:
field: security
function: defined
# Project path parameter must exist for project-scoped operations
sourceforge-project-parameter:
description: Project-scoped paths must use {project} path parameter
severity: info
given: "$.paths['/rest/p/{project}']"
then:
function: defined
# Response schemas must be defined
sourceforge-response-schema-defined:
description: Successful responses must have a schema
severity: warn
given: "$.paths[*][get,post].responses['200','201'].content['application/json']"
then:
field: schema
function: defined