Handle additionalProperties in resource type display#11764
Conversation
Signed-off-by: Akash Kumar <meakash7902@gmail.com>
There was a problem hiding this comment.
Pull request overview
Fixes rad resource-type show so that object schemas defined via additionalProperties (map-style properties) display their nested fields instead of rendering as empty object-property sections.
Changes:
- Update schema extraction to traverse into
additionalPropertieswhen an object schema has no directproperties. - Add a unit test covering
additionalPropertieshandling inGetResourceTypeSchema.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| pkg/cli/cmd/resourcetype/show/display.go | Adjusts nested schema selection to use additionalProperties as the source of nested fields when needed. |
| pkg/cli/cmd/resourcetype/show/show_test.go | Adds a focused test validating extraction of nested fields from additionalProperties. |
|
Hi @AkashKumar7902 , thank you so much for fixing this issue. Could you please add a before/ after screen shot of |
Address @nithyatsu's review on radius-project#11764: - Test_GetResourceTypeSchema_Properties exercises the regular `properties` branch (with required/non-required mixed and a nested object) so it sits alongside the existing AdditionalProperties test. - Test_getNestedSchema covers the helper directly: properties-present pass- through, additionalProperties descent, neither-key fallback, and the precedence rule when both keys are set. Signed-off-by: Akash Kumar <meakash7902@gmail.com>
|
@nithyatsu Pushed e978bef adding the requested tests:
All four pass locally ( For the before/after — I'll grab terminal output rather than screenshots since the issue is about textual output layout. Working on attaching that to a separate comment shortly. |
Radius functional test overviewClick here to see the test run details
Test Status⌛ Building Radius and pushing container images for functional tests... |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #11764 +/- ##
==========================================
- Coverage 51.21% 51.20% -0.02%
==========================================
Files 715 715
Lines 45068 45074 +6
==========================================
- Hits 23081 23079 -2
- Misses 19794 19798 +4
- Partials 2193 2197 +4 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Description
rad resource-type shownow displays nested fields for object schemas defined withadditionalProperties, so map-style resource properties no longer render as empty object-property sections.Type of change
Fixes: #10257
Validation
go test ./pkg/cli/cmd/resourcetype/show -run Test_GetResourceTypeSchema_AdditionalProperties -count=1go test ./pkg/cli/cmd/resourcetype/... -count=1go vet ./pkg/cli/cmd/resourcetype/...git diff --checkContributor checklist