-
Notifications
You must be signed in to change notification settings - Fork 203
/
Copy pathbest_practices.openapi.yaml
183 lines (183 loc) · 5.82 KB
/
best_practices.openapi.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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
openapi: 3.0.0
info:
title: Best Practices API
description: RESTful API for OpenSSF Best Practices badge website
version: 1.0.0
servers:
- url: https://bestpractices.coreinfrastructure.org
description: Main site
paths:
/{locale}/projects/{id}/{level}.{format}:
get:
summary: Retrieve project data
description: Returns data for project :id in :format. An empty format suffix returns HTML, and the ".json" format suffix returns JSON. External interfaces should normally request format "json". If "level" is given (0, 1, or 2), that level is shown (level is ignored if json format is requested, because we just provide all the data when JSON is requested).
parameters:
- name: locale
in: path
description: The locale for the requested data
required: false
schema:
type: string
default: en
- name: id
in: path
description: The ID of the project to retrieve
required: true
type: string
- name: level
in: path
description: The badge level of data to retrieve (0, 1, or 2); the level is ignored if json is requested. Level 0 is passing, 1 is silver, 2 is gold.
required: false
type: integer
- name: format
in: path
description: The format of the returned data (json, html, or omitted for html)
required: false
type: string
enum:
- json
- html
responses:
'200':
description: Project data retrieved successfully
'404':
description: Project not found
'500':
description: Internal server error
/{locale}/projects/{id}/badge.{format}:
get:
summary: Retrieve badge display
description: Returns badge display for project :id in :format. An empty format suffix returns SVG, and the ".json" format suffix returns JSON. If you just want to the badge status of a project, retrieve this as JSON and look at the key badge_level.
parameters:
- name: locale
in: path
description: The locale for the requested data
required: false
schema:
type: string
default: en
- name: id
in: path
description: The ID of the project to retrieve
required: true
type: string
- name: format
in: path
description: The format of the returned badge display (json or svg)
required: false
type: string
enum:
- json
- svg
responses:
'200':
description: Badge display retrieved successfully
'404':
description: Project not found
'500':
description: Internal server error
/{locale}/projects{format}:
get:
summary: Get a list of projects
parameters:
- name: locale
in: path
required: false
description: The locale to use for the project names and descriptions
schema:
type: string
default: en
- name: format
in: path
required: false
description: The format to return the response in (html, json, csv)
schema:
type: string
- name: status
in: query
required: false
description: Filter projects by status
schema:
type: string
enum:
- passing
- in_progress
- silver
- gold
- name: gteq
in: query
required: false
description: Filter projects with a passing rate greater than or equal to the specified percentage
schema:
type: integer
- name: lteq
in: query
required: false
description: Filter projects with a passing rate less than or equal to the specified percentage
schema:
type: integer
- name: url
in: query
required: false
description: Filter projects by the home or repo URL
schema:
type: string
- name: pq
in: query
required: false
description: Filter projects by a prefix query against the URL or name
schema:
type: string
- name: q
in: query
required: false
description: Filter projects by a normal query against the parsed name, description, or URL
schema:
type: string
- in: query
name: as
description: Display format for the resulting project badge that matches this query. The query must match exactly *one* project. Note that using this is rate-limited; "as=badge" is great for quick work, but not for mass use.
required: true
schema:
type: string
example: badge
- name: page
in: query
required: false
description: The page number to return. The first page is page 1.
schema:
type: integer
responses:
'200':
description: A list of projects
content:
text/html:
schema:
type: string
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Project'
text/csv:
schema:
type: string
'404':
description: No matching project found
tags:
- Projects
components:
schemas:
Project:
type: object
properties:
name:
type: string
description:
type: string
url:
type: string
passing_rate:
type: number
status:
type: string