-
Notifications
You must be signed in to change notification settings - Fork 2
fix: schema in requestBody could be undefined #212
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
🦋 Changeset detectedLatest commit: 217afb8 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. WalkthroughThis PR fixes a bug where requestBody schema could be undefined by implementing fallback content-type resolution, and adds comprehensive documentation for Kubernetes workload APIs (Deployments, DaemonSets) in both English and Chinese locales. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~15 minutes
Possibly related PRs
Suggested labels
Poem
Pre-merge checks and finishing touches✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
commit: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR updates multiple dependencies to their latest versions and adds support for additional content types in OpenAPI request body handling. Additionally, it introduces new documentation files for Workload APIs.
- Updated various ESLint and React-related packages from version 2.2.4 to 2.3.1
- Updated @RsPress packages from beta.34 to beta.35
- Enhanced OpenAPIPath component to handle multiple content types (application/json, application/json-patch+json, and /) in request bodies
- Added new Workload API documentation files for Deployments and DaemonSets
Reviewed Changes
Copilot reviewed 12 out of 14 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| yarn.lock | Updated dependency versions for ESLint packages (9.38.0 → 9.39.0), @eslint-react packages (2.2.4 → 2.3.1), @RsPress packages (beta.34 → beta.35), globals (16.4.0 → 16.5.0), simple-git (3.28.0 → 3.30.0), and @types/node (24.9.2 → 24.10.0) |
| packages/doom/src/runtime/components/OpenAPIPath.tsx | Enhanced request body content type handling to support multiple MIME types beyond just application/json |
| packages/doom/package.json | Updated dependency versions to match yarn.lock changes |
| package.json | Updated devDependency versions for @eslint/js, @types/node, and eslint |
| docs/zh/apis/advanced-apis/workload/*.mdx | Added Chinese documentation files for Workload APIs including index, deployment, and daemonset pages |
| docs/en/apis/advanced-apis/workload/*.mdx | Added English documentation files for Workload APIs including index, deployment, and daemonset pages |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
yarn.lockis excluded by!**/yarn.lock,!**/*.lock
📒 Files selected for processing (12)
.changeset/grumpy-berries-dress.md(1 hunks)docs/en/apis/advanced-apis/workload/damonset.mdx(1 hunks)docs/en/apis/advanced-apis/workload/deployment.mdx(1 hunks)docs/en/apis/advanced-apis/workload/deployment_one.mdx(1 hunks)docs/en/apis/advanced-apis/workload/index.mdx(1 hunks)docs/zh/apis/advanced-apis/workload/damonset.mdx(1 hunks)docs/zh/apis/advanced-apis/workload/deployment.mdx(1 hunks)docs/zh/apis/advanced-apis/workload/deployment_one.mdx(1 hunks)docs/zh/apis/advanced-apis/workload/index.mdx(1 hunks)package.json(1 hunks)packages/doom/package.json(3 hunks)packages/doom/src/runtime/components/OpenAPIPath.tsx(1 hunks)
🧰 Additional context used
🧠 Learnings (8)
📓 Common learnings
Learnt from: JounQin
Repo: alauda/doom PR: 34
File: src/cli/load-config.ts:290-0
Timestamp: 2025-05-29T10:23:34.965Z
Learning: In the alauda/doom project, JounQin prefers concise error handling over verbose validation. While they prefer throwing on invalid configuration rather than graceful fallbacks, they don't want overly detailed validation with multiple explicit checks and error messages.
📚 Learning: 2025-05-26T09:09:21.339Z
Learnt from: JounQin
Repo: alauda/doom PR: 30
File: src/runtime/components/K8sCrd.tsx:5-5
Timestamp: 2025-05-26T09:09:21.339Z
Learning: The alauda/doom project uses yarn v4 for dependency management, which handles package exports and module resolution correctly, so imports like `rspress/core/theme` work without any ESLint errors.
Applied to files:
packages/doom/package.jsonpackage.json
📚 Learning: 2025-05-26T09:09:21.339Z
Learnt from: JounQin
Repo: alauda/doom PR: 30
File: src/runtime/components/K8sCrd.tsx:5-5
Timestamp: 2025-05-26T09:09:21.339Z
Learning: JounQin has mentioned multiple times that the alauda/doom project uses yarn v4, and there are no ESLint import resolution errors for rspress/core subpath imports.
Applied to files:
packages/doom/package.json
📚 Learning: 2025-06-09T03:10:41.010Z
Learnt from: JounQin
Repo: alauda/doom PR: 75
File: src/cli/load-config.ts:4-7
Timestamp: 2025-06-09T03:10:41.010Z
Learning: The alauda/doom project uses yarn v4 as the package manager, not npm. Always reference yarn commands when suggesting package management operations.
Applied to files:
packages/doom/package.json
📚 Learning: 2025-06-06T07:08:55.881Z
Learnt from: JounQin
Repo: alauda/doom PR: 69
File: package.json:101-101
Timestamp: 2025-06-06T07:08:55.881Z
Learning: When a package has peer dependencies that require TypeScript (like `eslint-react/eslint-plugin`), TypeScript should be moved from devDependencies to dependencies to satisfy the peer dependency requirement.
Applied to files:
packages/doom/package.jsonpackage.json
📚 Learning: 2025-05-26T08:59:41.491Z
Learnt from: JounQin
Repo: alauda/doom PR: 30
File: src/runtime/components/K8sCrd.tsx:5-5
Timestamp: 2025-05-26T08:59:41.491Z
Learning: In rspress/core v2.0.0-beta.7, the '/theme' export is available in the package exports field as `"./theme": { "default": "./theme.ts" }`, so imports like `import { Badge, Button } from 'rspress/core/theme'` are valid even if ESLint shows resolution errors.
Applied to files:
packages/doom/package.json
📚 Learning: 2025-05-29T16:25:28.086Z
Learnt from: JounQin
Repo: alauda/doom PR: 40
File: src/plugins/sitemap/index.ts:7-7
Timestamp: 2025-05-29T16:25:28.086Z
Learning: In rspress/shared v2.0.0-beta.8, the '/logger' export is available in the package exports field, so imports like `import { logger } from 'rspress/shared/logger'` are valid even if ESLint shows resolution errors. This is used throughout the codebase in files like src/cli/translate.ts, src/cli/load-config.ts, src/utils/git.ts, and src/plugins/sitemap/index.ts.
Applied to files:
packages/doom/package.json
📚 Learning: 2025-06-09T03:09:17.876Z
Learnt from: JounQin
Repo: alauda/doom PR: 75
File: src/cli/load-config.ts:4-7
Timestamp: 2025-06-09T03:09:17.876Z
Learning: When ESLint shows "Unable to resolve path to module" errors for packages that are listed in package.json dependencies, the issue is usually that npm install hasn't been run yet, not that the packages are missing from dependencies or that there's an ESLint configuration problem.
Applied to files:
package.json
🔇 Additional comments (9)
.changeset/grumpy-berries-dress.md (1)
1-5: Changeset format is correct.The changeset file follows the standard format and properly documents the patch release with an appropriate description.
package.json (1)
36-49: Version bumps are standard and appropriate.Minor and patch version updates for ESLint tooling and @types/node are safe and align with typical maintenance practices.
packages/doom/package.json (1)
45-45: Coordinated dependency updates look good.The rspress ecosystem update (beta.34 → beta.35) is coordinated, and complementary tooling bumps (ESLint, simple-git, globals) follow appropriate patterns for a patch release.
Also applies to: 52-56, 65-65, 67-67, 98-98
docs/zh/apis/advanced-apis/workload/index.mdx (1)
1-3: Documentation structure is appropriate.The Workload APIs index page follows the expected structure with header and Overview component.
docs/zh/apis/advanced-apis/workload/deployment_one.mdx (1)
1-10: Documentation and component usage are correct.The OpenAPIPath component is properly configured for the namespaced Deployment endpoint with appropriate path and cluster prefix.
docs/en/apis/advanced-apis/workload/index.mdx (1)
1-7: Documentation structure is appropriate.The English Workload APIs index page properly includes front matter with sourceSHA and Overview component.
docs/en/apis/advanced-apis/workload/deployment.mdx (1)
1-10: Documentation and component usage are correct.The OpenAPIPath component is properly configured for the Deployments list endpoint with appropriate cluster prefix.
docs/en/apis/advanced-apis/workload/deployment_one.mdx (1)
1-10: Documentation and component usage are correct.The OpenAPIPath component is properly configured for the namespaced Deployment endpoint.
packages/doom/src/runtime/components/OpenAPIPath.tsx (1)
246-254: Good fix for handling undefined schema in requestBody.The fallback logic correctly addresses the issue where
requestBody.content['application/json']might not exist. The implementation properly checks multiple content types (application/json,application/json-patch+json,*/*) in order of preference and uses optional chaining to prevent undefined access. The ESLint disable comment is appropriate since the TypeScript compiler may not recognize that these properties can be undefined at runtime depending on the OpenAPI document structure.Verification confirms no similar unsafe patterns exist elsewhere in the codebase.
21004ae to
217afb8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (8)
.changeset/grumpy-berries-dress.md(1 hunks)docs/en/apis/advanced-apis/workload/daemonset.mdx(1 hunks)docs/en/apis/advanced-apis/workload/deployment.mdx(1 hunks)docs/en/apis/advanced-apis/workload/index.mdx(1 hunks)docs/zh/apis/advanced-apis/workload/daemonset.mdx(1 hunks)docs/zh/apis/advanced-apis/workload/deployment.mdx(1 hunks)docs/zh/apis/advanced-apis/workload/index.mdx(1 hunks)packages/doom/src/runtime/components/OpenAPIPath.tsx(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (6)
- docs/en/apis/advanced-apis/workload/index.mdx
- docs/zh/apis/advanced-apis/workload/index.mdx
- docs/zh/apis/advanced-apis/workload/deployment.mdx
- .changeset/grumpy-berries-dress.md
- docs/en/apis/advanced-apis/workload/deployment.mdx
- packages/doom/src/runtime/components/OpenAPIPath.tsx
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: JounQin
Repo: alauda/doom PR: 34
File: src/cli/load-config.ts:290-0
Timestamp: 2025-05-29T10:23:34.965Z
Learning: In the alauda/doom project, JounQin prefers concise error handling over verbose validation. While they prefer throwing on invalid configuration rather than graceful fallbacks, they don't want overly detailed validation with multiple explicit checks and error messages.
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
- GitHub Check: Build and Lint with Node.js 24 on ubuntu-latest
- GitHub Check: Build and Lint with Node.js 20 on ubuntu-latest
- GitHub Check: Build and Lint with Node.js 22 on ubuntu-latest
- GitHub Check: Build and Lint with Node.js 22 on ubuntu-latest
- GitHub Check: Build and Lint with Node.js 20 on ubuntu-latest
- GitHub Check: Build and Lint with Node.js 24 on ubuntu-latest
🔇 Additional comments (3)
docs/zh/apis/advanced-apis/workload/daemonset.mdx (1)
3-10: Approve OpenAPIPath configuration.The OpenAPIPath component configuration looks correct:
- Path
/apis/apps/v1/daemonsetsaligns with the Kubernetes API endpoint- PathPrefix
/kubernetes/{cluster}follows the established pattern for workload resourcesdocs/en/apis/advanced-apis/workload/daemonset.mdx (2)
7-10: Approve OpenAPIPath configuration.The OpenAPIPath component is correctly configured with appropriate path and pathPrefix values that align with the Kubernetes DaemonSet API and established workload documentation patterns.
1-3: Confirm whether locale-specific front matter approach is intentional.Verification shows front matter is present in EN docs but absent in ZH docs—a pattern consistent across multiple files (DaemonSet and Deployment both follow this structure). Additionally, EN headers use escaped brackets
\[apps/v1]while ZH headers use unescaped brackets[apps/v1].If this locale-specific metadata structure is intentional by design, no changes are needed. If both locales should have consistent front matter and formatting, please align them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 8 out of 9 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (1)
packages/doom/src/runtime/components/OpenAPIPath.tsx:1
- The nested parentheses make this code difficult to read. Consider extracting the content type selection into a separate variable for better clarity. For example:
const mediaTypeContent = requestBody.content['application/json'] || requestBody.content['application/json-patch+json'] || requestBody.content['*/*']followed bymediaTypeContent?.schema as OpenAPIV3_1.ReferenceObject | undefined)?.$ref
import { usePage } from '@rspress/core/runtime'
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary by CodeRabbit
Bug Fixes
Documentation