Skip to content

Commit 218a4ab

Browse files
Update OpenAPI docs
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent d343813 commit 218a4ab

2 files changed

Lines changed: 181 additions & 6 deletions

File tree

docs/reference/api/openapi-v1.yaml

Lines changed: 168 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,29 @@ info:
6565
The total number of items in the collection across all pages is
6666
returned in the `X-Total-Count` response header.
6767
68+
### Bounded total counts
69+
70+
An exact `X-Total-Count` gets more expensive as a collection grows, and on large
71+
collections it can time out. Some endpoints therefore accept an optional `totalCount`
72+
query parameter that caps the cost of counting:
73+
74+
| `totalCount` | Description |
75+
|--------------|--------------------------------------------------------------------|
76+
| `EXACT` | Count every matching item. The default. Can time out. |
77+
| `BOUNDED` | Stop counting at a server-side cap. May return only a lower bound. |
78+
79+
Any other value is rejected with `400`. Each endpoint documents how it computes the
80+
bounded count, on its `totalCount` parameter.
81+
82+
Endpoints that accept `totalCount` also return an `X-Total-Count-Type` header saying
83+
how to read `X-Total-Count`. They return it on every collection response, including
84+
ones that did not opt in.
85+
86+
| `X-Total-Count-Type` | Meaning |
87+
|----------------------|----------------------------------------------------------------------|
88+
| `EXACT` | `X-Total-Count` is the true total. |
89+
| `AT_LEAST` | `X-Total-Count` is only a lower bound. The true total may be higher. |
90+
6891
## HTTP Methods
6992
7093
| Method | Semantics |
@@ -86,6 +109,15 @@ info:
86109
87110
Delete (`DELETE`) operations typically return `204 No Content`.
88111
112+
## Timeouts
113+
114+
A request that takes too long to complete is aborted and answered
115+
with `504 Gateway Timeout` and a problem details body. Any operation
116+
can time out, so operations do not document it individually.
117+
118+
Requesting a bounded total count can avoid the timeout where the
119+
operation supports it, because counting is often the expensive part.
120+
89121
## Deprecations
90122
91123
Operations may be removed or replaced over time. When a response
@@ -2028,6 +2060,21 @@ paths:
20282060
name: isKev
20292061
schema:
20302062
type: boolean
2063+
- description: "The counting mode for `X-Total-Count`. With `BOUNDED`, the count\
2064+
\ stops at a fixed server-side cap. `X-Total-Count` is then exact when the\
2065+
\ count finishes within the cap, or when the requested page ends the result\
2066+
\ set. Otherwise it is a lower bound, never below the end of the requested\
2067+
\ page. `X-Total-Count-Type` says which case applies. See the Pagination\
2068+
\ section of the API description."
2069+
in: query
2070+
name: totalCount
2071+
schema:
2072+
type: string
2073+
default: EXACT
2074+
description: The counting mode for the `X-Total-Count` response header.
2075+
enum:
2076+
- EXACT
2077+
- BOUNDED
20312078
responses:
20322079
"200":
20332080
content:
@@ -2039,10 +2086,19 @@ paths:
20392086
description: A list of all findings
20402087
headers:
20412088
X-Total-Count:
2042-
description: The total number of findings
2089+
description: "The number of findings, exact or a lower bound. See `X-Total-Count-Type`."
20432090
schema:
20442091
format: integer
20452092
style: simple
2093+
X-Total-Count-Type:
2094+
$ref: "#/components/headers/TotalCountType"
2095+
style: simple
2096+
"400":
2097+
content:
2098+
application/problem+json:
2099+
schema:
2100+
$ref: "#/components/schemas/ProblemDetails"
2101+
description: Invalid query parameter
20462102
"401":
20472103
description: Unauthorized
20482104
security:
@@ -2189,6 +2245,21 @@ paths:
21892245
name: isKev
21902246
schema:
21912247
type: boolean
2248+
- description: "The counting mode for `X-Total-Count`. With `BOUNDED`, the count\
2249+
\ is skipped and `X-Total-Count` reports what the requested page itself\
2250+
\ proves. `X-Total-Count-Type` is then `EXACT` when the page ends the result\
2251+
\ set, and `AT_LEAST` otherwise. A page past the end reports `AT_LEAST`\
2252+
\ with a count of 0, which means the total is unknown. See the Pagination\
2253+
\ section of the API description."
2254+
in: query
2255+
name: totalCount
2256+
schema:
2257+
type: string
2258+
default: EXACT
2259+
description: The counting mode for the `X-Total-Count` response header.
2260+
enum:
2261+
- EXACT
2262+
- BOUNDED
21922263
responses:
21932264
"200":
21942265
content:
@@ -2200,10 +2271,19 @@ paths:
22002271
description: A list of all findings grouped by vulnerability
22012272
headers:
22022273
X-Total-Count:
2203-
description: The total number of findings
2274+
description: "The number of findings, exact or a lower bound. See `X-Total-Count-Type`."
22042275
schema:
22052276
format: integer
22062277
style: simple
2278+
X-Total-Count-Type:
2279+
$ref: "#/components/headers/TotalCountType"
2280+
style: simple
2281+
"400":
2282+
content:
2283+
application/problem+json:
2284+
schema:
2285+
$ref: "#/components/schemas/ProblemDetails"
2286+
description: Invalid query parameter
22072287
"401":
22082288
description: Unauthorized
22092289
security:
@@ -2315,6 +2395,21 @@ paths:
23152395
name: isKev
23162396
schema:
23172397
type: boolean
2398+
- description: "The counting mode for `X-Total-Count`. With `BOUNDED`, the count\
2399+
\ stops at a fixed server-side cap. `X-Total-Count` is then exact when the\
2400+
\ count finishes within the cap, or when the requested page ends the result\
2401+
\ set. Otherwise it is a lower bound, never below the end of the requested\
2402+
\ page. `X-Total-Count-Type` says which case applies. See the Pagination\
2403+
\ section of the API description."
2404+
in: query
2405+
name: totalCount
2406+
schema:
2407+
type: string
2408+
default: EXACT
2409+
description: The counting mode for the `X-Total-Count` response header.
2410+
enum:
2411+
- EXACT
2412+
- BOUNDED
23182413
responses:
23192414
"200":
23202415
content:
@@ -2327,13 +2422,22 @@ paths:
23272422
schema:
23282423
type: string
23292424
description: "A list of all findings for a specific project, or a SARIF\
2330-
\ file"
2425+
\ file. SARIF responses carry no count headers."
23312426
headers:
23322427
X-Total-Count:
2333-
description: The total number of findings
2428+
description: "The number of findings, exact or a lower bound. See `X-Total-Count-Type`."
23342429
schema:
23352430
format: integer
23362431
style: simple
2432+
X-Total-Count-Type:
2433+
$ref: "#/components/headers/TotalCountType"
2434+
style: simple
2435+
"400":
2436+
content:
2437+
application/problem+json:
2438+
schema:
2439+
$ref: "#/components/schemas/ProblemDetails"
2440+
description: Invalid query parameter
23372441
"401":
23382442
description: Unauthorized
23392443
"403":
@@ -7638,8 +7742,52 @@ paths:
76387742
- team
76397743
/v1/team/visible:
76407744
get:
7641-
description: <p></p>
7745+
description: <p>Optional query parameter <code>searchText</code>. The search
7746+
is case insensitive and matches team names.</p>
76427747
operationId: availableTeams
7748+
parameters:
7749+
- description: Optional case-insensitive substring match on team name.
7750+
in: query
7751+
name: searchText
7752+
schema:
7753+
type: string
7754+
- description: The page to return. To be used in conjunction with <code>pageSize</code>.
7755+
in: query
7756+
name: pageNumber
7757+
schema:
7758+
type: string
7759+
default: "1"
7760+
- description: Number of elements to return per page. To be used in conjunction
7761+
with <code>pageNumber</code>.
7762+
in: query
7763+
name: pageSize
7764+
schema:
7765+
type: string
7766+
default: "100"
7767+
- description: Offset to start returning elements from. To be used in conjunction
7768+
with <code>limit</code>.
7769+
in: query
7770+
name: offset
7771+
schema:
7772+
type: string
7773+
- description: Number of elements to return per page. To be used in conjunction
7774+
with <code>offset</code>.
7775+
in: query
7776+
name: limit
7777+
schema:
7778+
type: string
7779+
- description: Name of the resource field to sort on.
7780+
in: query
7781+
name: sortName
7782+
schema:
7783+
type: string
7784+
- description: Ordering of items when sorting with <code>sortName</code>.
7785+
in: query
7786+
name: sortOrder
7787+
schema:
7788+
type: string
7789+
enum:
7790+
- "asc, desc"
76437791
responses:
76447792
"200":
76457793
content:
@@ -7649,6 +7797,12 @@ paths:
76497797
items:
76507798
$ref: "#/components/schemas/VisibleTeams"
76517799
description: The Visible Teams
7800+
headers:
7801+
X-Total-Count:
7802+
description: The total number of visible teams
7803+
schema:
7804+
format: integer
7805+
style: simple
76527806
"401":
76537807
description: Unauthorized
76547808
security:
@@ -9485,6 +9639,15 @@ paths:
94859639
tags:
94869640
- version
94879641
components:
9642+
headers:
9643+
TotalCountType:
9644+
description: Whether `X-Total-Count` is exact (`EXACT`) or a lower bound (`AT_LEAST`).
9645+
`AT_LEAST` with a count of 0 means the total is unknown.
9646+
schema:
9647+
type: string
9648+
enum:
9649+
- EXACT
9650+
- AT_LEAST
94889651
schemas:
94899652
About:
94909653
type: object

docs/reference/api/openapi-v2.yaml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,10 @@ info:
7676
}
7777
```
7878
79+
A request that takes too long to complete is aborted and rejected
80+
with `504 Gateway Timeout`. Any operation can time out, so operations
81+
do not document it individually.
82+
7983
## Authentication
8084
8185
Two credential types are accepted:
@@ -2832,12 +2836,16 @@ components:
28322836
list-extensions-response-item:
28332837
required:
28342838
- configurable
2839+
- display_name
28352840
- name
28362841
- testable
28372842
type: object
28382843
properties:
28392844
name:
28402845
type: string
2846+
display_name:
2847+
type: string
2848+
description: Human-readable name of the extension.
28412849
configurable:
28422850
type: boolean
28432851
description: Whether the extension supports runtime configuration.
@@ -3102,6 +3110,7 @@ components:
31023110
kev-assertion:
31033111
required:
31043112
- asserter
3113+
- asserter_display_name
31053114
- created_at
31063115
- updated_at
31073116
- vuln_id
@@ -3111,7 +3120,10 @@ components:
31113120
asserter:
31123121
type: string
31133122
description: "The entity that asserted the vulnerability is known to be\
3114-
\ exploited (e.g. `CISA`, `ENISA`)."
3123+
\ exploited (e.g. `cisa`, `enisa`)."
3124+
asserter_display_name:
3125+
type: string
3126+
description: Human-readable name of the asserting entity (e.g. `CISA KEV`).
31153127
vuln_source:
31163128
type: string
31173129
description: Source of the asserted vulnerability identifier (e.g. `NVD`).

0 commit comments

Comments
 (0)