Skip to content

Commit 9976fc6

Browse files
authored
fix: schema in requestBody could be undefined (#212)
1 parent 9d59479 commit 9976fc6

File tree

9 files changed

+15928
-4
lines changed

9 files changed

+15928
-4
lines changed

.changeset/grumpy-berries-dress.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@alauda/doom": patch
3+
---
4+
5+
fix: schema in requestBody could be undefined
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
sourceSHA: 5a2d3f9cc25176c99e33ca220bb99a2669d3f628e607892f4c7398541ef7bb91
3+
---
4+
5+
# DaemonSet \[apps/v1]
6+
7+
<OpenAPIPath
8+
path="/apis/apps/v1/daemonsets"
9+
pathPrefix="/kubernetes/{cluster}"
10+
/>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
sourceSHA: b384c6db222be075260a43b6b1fd370e666d5ca95dbe0d216b0e38293b8f02c9
3+
---
4+
5+
# Deployments \[apps/v1]
6+
7+
<OpenAPIPath
8+
path="/apis/apps/v1/deployments"
9+
pathPrefix="/kubernetes/{cluster}"
10+
/>
11+
12+
<OpenAPIPath
13+
path="/apis/apps/v1/namespaces/{namespace}/deployments/{name}"
14+
pathPrefix="/kubernetes/{cluster}"
15+
/>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
sourceSHA: 03a6ab08a6e4563d25e1d8876db2d2ca0c07579c2f70d075128a0a3b7466b930
3+
---
4+
5+
# Workload APIs
6+
7+
<Overview overviewHeaders={[]} />

docs/shared/openapis/apps.v1.json

Lines changed: 15863 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# DaemonSet [apps/v1]
2+
3+
<OpenAPIPath
4+
path="/apis/apps/v1/daemonsets"
5+
pathPrefix="/kubernetes/{cluster}"
6+
/>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Deployments [apps/v1]
2+
3+
<OpenAPIPath
4+
path="/apis/apps/v1/deployments"
5+
pathPrefix="/kubernetes/{cluster}"
6+
/>
7+
8+
<OpenAPIPath
9+
path="/apis/apps/v1/namespaces/{namespace}/deployments/{name}"
10+
pathPrefix="/kubernetes/{cluster}"
11+
/>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Workload APIs
2+
3+
<Overview overviewHeaders={[]} />

packages/doom/src/runtime/components/OpenAPIPath.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -243,11 +243,15 @@ export const OpenAPIPath = ({
243243
requestBody &&
244244
('$ref' in requestBody
245245
? requestBody.$ref
246-
: (
247-
requestBody.content['application/json'].schema as
248-
| OpenAPIV3_1.ReferenceObject
249-
| undefined
246+
: /* eslint-disable @typescript-eslint/no-unnecessary-condition */
247+
(
248+
(
249+
requestBody.content['application/json'] ||
250+
requestBody.content['application/json-patch+json'] ||
251+
requestBody.content['*/*']
252+
)?.schema as OpenAPIV3_1.ReferenceObject | undefined
250253
)?.$ref)
254+
/* eslint-enable @typescript-eslint/no-unnecessary-condition */
251255

252256
const requestBodySchema = requestBodyRef
253257
? resolveRef(openapi, requestBodyRef)

0 commit comments

Comments
 (0)