HYPERFLEET-1246: Add missing kind field to NodePool creation example#7
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Central YAML (base), Organization UI (inherited) Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (5)
🔗 Linked repositories identifiedCodeRabbit considers these linked repositories for cross-repo context during reviews:
✅ Files skipped from review due to trivial changes (4)
📝 WalkthroughSummary by CodeRabbit
WalkthroughRelease 1.0.24 increments service version in Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes 🚥 Pre-merge checks | ✅ 5 | ❌ 6❌ Failed checks (6 inconclusive)
✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
✨ Simplify code
Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
schemas/template/openapi.yaml (1)
1865-1892:⚠️ Potential issue | 🟠 Major | ⚡ Quick win
NodePoolCreateRequest.kindremains unenforced in schema (CWE-20).Line 1892 adds
kindonly to example data. The schema still does not requirekind(Line 1865) and does not constrain its value (Line 1872). Linked API tests already enforcekindrequired and equal toNodePool, so contract and runtime validation remain inconsistent.Suggested schema fix
NodePoolCreateRequest: type: object required: + - kind - name - spec properties: kind: type: string + enum: + - NodePoolAs per coding guidelines, "Validate input at system boundaries (HTTP handlers, CLI parsers, webhook receivers)."
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@schemas/template/openapi.yaml` around lines 1865 - 1892, The NodePoolCreateRequest schema does not properly enforce the `kind` field, creating a mismatch with runtime validation. Add `kind` to the required list (currently only containing "name" and "spec") and add an enum constraint to the `kind` property definition to restrict its value to "NodePool". This ensures the OpenAPI schema accurately reflects the actual API contract that API tests and handlers are enforcing.Sources: Coding guidelines, Linked repositories
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@CHANGELOG.md`:
- Around line 10-15: The CHANGELOG.md entry for version 1.0.24 is incomplete and
only documents the NodePool example fix. Update the changelog entry to include
all contract changes that were shipped in this release, specifically adding the
error modeling changes, list response requirements changes, and pagination
parameter constraints changes under the appropriate sections (Fixed, Changed,
etc.) to ensure downstream integrators have complete visibility into all
modifications in this release.
In `@schemas/template/openapi.yaml`:
- Around line 42-49: The explicit 4xx error responses (400, 404, and 409) in the
OpenAPI schema currently only include descriptions without response body
schemas, while the default response correctly defines an
application/problem+json content type with an Error schema reference. Since
explicit status codes take precedence in OpenAPI, clients cannot properly parse
typed error bodies for these known failure cases. Add the content block
containing the application/problem+json schema reference from the default
response to each of the explicit 4xx responses (at lines 42-49 for 400, lines
68-73 for 404, and lines 1034-1038 for 409) so that clients receive consistent
typed error information for these specific status codes.
- Around line 1294-1301: Remove `kind` from the required fields list in all list
response schemas. The required array appears at lines 1294, 1533, 1988, 2383,
and 2565 in the OpenAPI schema. In each of these locations, delete `kind` from
the required fields array (keeping page, size, total, and items as required)
since the current implementation in the hyperfleet-api list builders does not
set the `kind` field, causing schema validation failures in clients and mocks at
runtime.
---
Outside diff comments:
In `@schemas/template/openapi.yaml`:
- Around line 1865-1892: The NodePoolCreateRequest schema does not properly
enforce the `kind` field, creating a mismatch with runtime validation. Add
`kind` to the required list (currently only containing "name" and "spec") and
add an enum constraint to the `kind` property definition to restrict its value
to "NodePool". This ensures the OpenAPI schema accurately reflects the actual
API contract that API tests and handlers are enforcing.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Central YAML (base), Organization UI (inherited)
Review profile: CHILL
Plan: Enterprise
Run ID: 131bfeb6-fa49-4cd2-84c3-b73a5c19071e
📒 Files selected for processing (5)
CHANGELOG.mdmain.tspmodels/nodepool/example_post.tspschemas/template/openapi.yamlschemas/template/swagger.yaml
🔗 Linked repositories identified
CodeRabbit considers these linked repositories for cross-repo context during reviews:
openshift-hyperfleet/architecture(manual)openshift-hyperfleet/hyperfleet-api(manual)openshift-hyperfleet/hyperfleet-sentinel(manual)openshift-hyperfleet/hyperfleet-adapter(manual)openshift-hyperfleet/hyperfleet-broker(manual)
…ample The Swagger UI example for NodePool creation was missing the mandatory kind field, causing users to get a validation error when copying the example payload.
4241f0f to
ab5fab2
Compare
|
/lgtm |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: rh-amarin The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
25d89d9
into
openshift-hyperfleet:main
Summary
kind: "NodePool"to the NodePool creation Swagger exampleContext
Same bug as openshift-hyperfleet/hyperfleet-api-spec#61 — NodePool create example was missing the mandatory
kindfield.Test plan
./build-schema.shpasseskind: NodePoolin NodePool creation example