Skip to content

Conversation

@JounQin
Copy link
Member

@JounQin JounQin commented Nov 6, 2025

close IDP-1353

Summary by CodeRabbit

  • Bug Fixes

    • Fixed $ref compatibility issue in OpenAPI schema handling.
  • Documentation

    • Added API reference pages for Kubernetes DaemonSet and Deployment.
    • Documented namespaced DaemonSet endpoint and expanded catalog with ObjectMeta, ListMeta, Patch, Status, LabelSelector, DeleteOptions, and ObjectFieldSelector.
  • Chores

    • Added a patch release changeset and updated common Kubernetes reference links.

close IDP-1353
Copilot AI review requested due to automatic review settings November 6, 2025 09:28
@changeset-bot
Copy link

changeset-bot bot commented Nov 6, 2025

🦋 Changeset detected

Latest commit: 3e5a236

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@alauda/doom Patch

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

@coderabbitai
Copy link

coderabbitai bot commented Nov 6, 2025

Note

Other AI code review bot(s) detected

CodeRabbit 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.

Walkthrough

Adds an exported get$Ref() helper and refactors OpenAPI $ref handling in the Doom runtime; updates reference mappings and Kubernetes common-definition URLs; and adds documentation and config entries for DaemonSet and Deployment APIs.

Changes

Cohort / File(s) Summary
Changeset
.changeset/shaggy-bees-sort.md
Adds a changeset documenting a patch release for @alauda/doom and a fix for $ref compatibility.
OpenAPI ref handling
packages/doom/src/runtime/components/OpenAPIRef.tsx
Exports get$Ref(obj) to extract $ref (including nested allOf) and refactors OpenAPIProperty to use it across items, props, and additionalProperties; replaces scattered $ref checks with centralized logic and adjusted rendering of RefLink and resolved schemas.
Utils / reference mappings
packages/doom/src/runtime/utils.ts
Updates K8S_DOC_PREFIX to the common-definitions subpath and shortens DEFAULT_COMMON_REFS entries (e.g., list-meta/, object-meta/), affecting constructed common reference URLs.
Configuration
doom.config.yml
Expands api.references to include Kubernetes anchors and external docs for DaemonSet, Deployment, ObjectFieldSelector, DeleteOptions, LabelSelector, ListMeta, ObjectMeta, Patch, and Status.
Documentation
docs/zh/apis/advanced-apis/workload/daemonset.mdx, docs/zh/apis/references/DaemonSet.mdx, docs/zh/apis/references/Deployment.mdx
Adds/extends docs: namespaced DaemonSet API path with /kubernetes/{cluster} prefix and new reference pages for DaemonSet and Deployment (OpenAPIRef entries to respective schemas).

Sequence Diagram(s)

sequenceDiagram
  participant UI as OpenAPIProperty component
  participant G as get$Ref(obj)
  participant R as resolveRef($ref)
  participant D as RefLink / Renderer

  UI->>G: provide schema object (property/items/props)
  alt $ref found (direct or in allOf)
    G-->>UI: return $ref
    UI->>R: resolve returned $ref
    R-->>UI: resolved schema object
    UI->>D: render RefLink + resolved details
  else no $ref
    G-->>UI: undefined
    UI->>D: render inline type/properties
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Focus review on:
    • get$Ref() correctness with nested allOf and edge cases
    • All refactored branches in OpenAPIRef.tsx to ensure rendering parity and no regressions
    • utils.ts mappings produce correct external URLs for common refs

Possibly related PRs

Suggested labels

bug, documentation

Poem

🐰 I nibble through schemas late at night,
Finding $ref tucked out of sight,
AllOf, items, props — no more a fright,
I hop, link, and render everything right! 🥕

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix: $ref compatibility' directly and clearly describes the main change in the pull request - fixing $ref compatibility issues across multiple components.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/ref

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4188c4a and 3e5a236.

📒 Files selected for processing (1)
  • doom.config.yml (1 hunks)
⏰ 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). (5)
  • 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 24 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
🔇 Additional comments (2)
doom.config.yml (2)

19-25: External references use canonical Kubernetes documentation URLs.

The Kubernetes common-definition references correctly point to the official kubernetes.io documentation with consistent URL formatting.


16-18: Partially verified: Documentation pages exist but with inconsistent language coverage.

The casing has been correctly fixed. However, verification reveals an inconsistency:

  • CodeQualityBranch.mdx exists in both English and Chinese documentation directories
  • DaemonSet.mdx and Deployment.mdx exist only in the Chinese documentation directory (missing from docs/en/apis/references/)

Please verify whether the English documentation pages for DaemonSet and Deployment should be added, or if this configuration intentionally references only the Chinese documentation.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Nov 6, 2025

Open in StackBlitz

yarn add https://pkg.pr.new/@alauda/doom@216.tgz
yarn add https://pkg.pr.new/@alauda/doom-export@216.tgz

commit: 3e5a236

Copy link
Contributor

Copilot AI left a 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 fixes $ref compatibility in OpenAPI schema handling by refactoring how references are resolved and updating Kubernetes API documentation links.

  • Introduces a get$Ref helper function to handle both direct $ref properties and allOf patterns
  • Updates Kubernetes documentation URL structure to point to common-definitions subdirectory
  • Adds reference mappings for multiple Kubernetes resources (DaemonSet, Deployment, ObjectMeta, etc.)

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/doom/src/runtime/utils.ts Updates K8S_DOC_PREFIX to include common-definitions path and simplifies reference paths
packages/doom/src/runtime/components/OpenAPIRef.tsx Adds get$Ref helper and refactors property rendering to consistently use it for reference extraction
doom.config.yml Adds Kubernetes API references and fixes hash fragment format
docs/zh/apis/references/Deployment.mdx Adds new Deployment reference documentation page
docs/zh/apis/references/DaemonSet.mdx Adds new DaemonSet reference documentation page
docs/zh/apis/advanced-apis/workload/daemonset.mdx Adds namespaced daemonsets API path documentation
.changeset/shaggy-bees-sort.md Documents the patch-level change

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

@coderabbitai coderabbitai bot left a 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

🧹 Nitpick comments (1)
packages/doom/src/runtime/components/OpenAPIRef.tsx (1)

37-50: Consider handling oneOf and anyOf in addition to allOf.

The function currently only searches through allOf for nested $ref values. OpenAPI schemas can also use oneOf and anyOf composition keywords that may contain $ref values.

Apply this diff to handle all composition keywords:

 export const get$Ref = (
   obj: OpenAPIV3_1.ReferenceObject | OpenAPIV3_1.SchemaObject,
 ) => {
   if ('$ref' in obj && obj.$ref) {
     return obj.$ref
   }
-  if ('allOf' in obj && Array.isArray(obj.allOf)) {
-    for (const item of obj.allOf) {
+  // Check allOf, oneOf, and anyOf for nested $refs
+  for (const key of ['allOf', 'oneOf', 'anyOf'] as const) {
+    if (key in obj && Array.isArray(obj[key])) {
+      for (const item of obj[key]) {
+        if ('$ref' in item && item.$ref) {
+          return item.$ref
+        }
+      }
+    }
+  }
-      if ('$ref' in item && item.$ref) {
-        return item.$ref
-      }
-    }
-  }
 }
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2c78f79 and 4188c4a.

📒 Files selected for processing (7)
  • .changeset/shaggy-bees-sort.md (1 hunks)
  • docs/zh/apis/advanced-apis/workload/daemonset.mdx (1 hunks)
  • docs/zh/apis/references/DaemonSet.mdx (1 hunks)
  • docs/zh/apis/references/Deployment.mdx (1 hunks)
  • doom.config.yml (1 hunks)
  • packages/doom/src/runtime/components/OpenAPIRef.tsx (2 hunks)
  • packages/doom/src/runtime/utils.ts (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 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:

  • .changeset/shaggy-bees-sort.md
🧬 Code graph analysis (1)
packages/doom/src/runtime/components/OpenAPIRef.tsx (2)
packages/doom/src/runtime/utils.ts (1)
  • resolveRef (11-22)
packages/doom/src/runtime/components/_RefLink.tsx (1)
  • RefLink (10-25)
⏰ 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: Upload results
  • GitHub Check: Build and Lint with Node.js 24 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 22 on ubuntu-latest
  • GitHub Check: Build and Lint with Node.js 20 on ubuntu-latest
🔇 Additional comments (7)
.changeset/shaggy-bees-sort.md (1)

1-5: LGTM!

The changeset format is correct and appropriately documents the patch-level fix for $ref compatibility.

packages/doom/src/runtime/utils.ts (1)

24-40: LGTM!

The refactoring simplifies reference path construction by using a more specific base URL and cleaner path suffixes. The changes are consistent and maintain the same functionality.

packages/doom/src/runtime/components/OpenAPIRef.tsx (1)

61-127: Effective refactoring using the new get$Ref helper.

The refactoring consistently applies the new get$Ref helper throughout the component, improving code clarity and maintainability. The logic for handling arrays, objects, and additionalProperties is well-structured.

docs/zh/apis/references/DaemonSet.mdx (1)

1-3: LGTM!

The documentation structure is clean and correctly uses the OpenAPIRef component to reference the Kubernetes DaemonSet schema.

docs/zh/apis/references/Deployment.mdx (1)

1-3: LGTM!

The documentation structure is consistent with the DaemonSet reference page and correctly references the Kubernetes Deployment schema.

docs/zh/apis/advanced-apis/workload/daemonset.mdx (1)

8-11: LGTM!

The new OpenAPIPath block correctly documents the namespaced DaemonSet API endpoint, complementing the existing non-namespaced path. The format is consistent and the path structure is accurate.

doom.config.yml (1)

16-25: All reference URLs are valid and accessible.

Verification confirms:

  • All 7 Kubernetes documentation URLs return HTTP 200
  • All 3 internal reference files exist in the repository

The code changes in doom.config.yml are correct and properly configured.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: JounQin <admin@1stg.me>
@JounQin JounQin merged commit 9f7c838 into main Nov 6, 2025
14 checks passed
@JounQin JounQin deleted the fix/ref branch November 6, 2025 09:44
github-actions bot pushed a commit that referenced this pull request Nov 6, 2025
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants