Skip to content

Handle additionalProperties in resource type display#11764

Merged
nithyatsu merged 4 commits into
radius-project:mainfrom
AkashKumar7902:issue-10257-additional-properties
May 6, 2026
Merged

Handle additionalProperties in resource type display#11764
nithyatsu merged 4 commits into
radius-project:mainfrom
AkashKumar7902:issue-10257-additional-properties

Conversation

@AkashKumar7902
Copy link
Copy Markdown
Contributor

Description

rad resource-type show now displays nested fields for object schemas defined with additionalProperties, so map-style resource properties no longer render as empty object-property sections.

Type of change

  • This pull request fixes a bug in Radius and has an approved issue (issue link required).

Fixes: #10257

Validation

  • go test ./pkg/cli/cmd/resourcetype/show -run Test_GetResourceTypeSchema_AdditionalProperties -count=1
  • go test ./pkg/cli/cmd/resourcetype/... -count=1
  • go vet ./pkg/cli/cmd/resourcetype/...
  • git diff --check

Contributor checklist

  • An overview of proposed schema changes is included in a linked GitHub issue.
    • Yes
    • Not applicable
  • A design document PR is created in the design-notes repository, if new APIs are being introduced.
    • Yes
    • Not applicable
  • The design document has been reviewed and approved by Radius maintainers/approvers.
    • Yes
    • Not applicable
  • A PR for the samples repository is created, if existing samples are affected by the changes in this PR.
    • Yes
    • Not applicable
  • A PR for the documentation repository is created, if the changes in this PR affect the documentation or any user facing updates are made.
    • Yes
    • Not applicable
  • A PR for the recipes repository is created, if existing recipes are affected by the changes in this PR.
    • Yes
    • Not applicable

Signed-off-by: Akash Kumar <meakash7902@gmail.com>
Copilot AI review requested due to automatic review settings April 25, 2026 13:29
@AkashKumar7902 AkashKumar7902 requested review from a team as code owners April 25, 2026 13:29
@AkashKumar7902 AkashKumar7902 temporarily deployed to external-contributor-approval April 25, 2026 13:29 — with GitHub Actions Inactive
Copy link
Copy Markdown
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

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 additionalProperties when an object schema has no direct properties.
  • Add a unit test covering additionalProperties handling in GetResourceTypeSchema.

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.

@nithyatsu
Copy link
Copy Markdown
Contributor

Hi @AkashKumar7902 , thank you so much for fixing this issue. Could you please add a before/ after screen shot of
rad resource-type show with this fix?

Comment thread pkg/cli/cmd/resourcetype/show/display.go
Comment thread pkg/cli/cmd/resourcetype/show/show_test.go
@nithyatsu nithyatsu self-assigned this Apr 27, 2026
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>
@AkashKumar7902
Copy link
Copy Markdown
Contributor Author

@nithyatsu Pushed e978bef adding the requested tests:

  • Test_GetResourceTypeSchema_Properties — covers the regular properties path (mix of required/non-required fields and a nested object).
  • Test_getNestedSchema — directly exercises the new helper across all four branches: properties-present pass-through, descent into additionalProperties, neither-key fallback, and the precedence rule when both are set.

All four pass locally (go test ./pkg/cli/cmd/resourcetype/show/... -run Test_getNestedSchema -v).

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.

@AkashKumar7902 AkashKumar7902 requested a deployment to external-contributor-approval April 29, 2026 22:06 — with GitHub Actions Waiting
@nithyatsu nithyatsu temporarily deployed to external-contributor-approval May 5, 2026 18:47 — with GitHub Actions Inactive
@nithyatsu nithyatsu temporarily deployed to external-contributor-approval May 6, 2026 20:27 — with GitHub Actions Inactive
@radius-functional-tests
Copy link
Copy Markdown

radius-functional-tests Bot commented May 6, 2026

Radius functional test overview

🔍 Go to test action run

Click here to see the test run details
Name Value
Repository AkashKumar7902/radius
Commit ref b0938da
Unique ID func904d89a6f2
Image tag pr-func904d89a6f2
  • gotestsum 1.13.0
  • KinD: v0.29.0
  • Dapr: 1.14.4
  • Azure KeyVault CSI driver: 1.4.2
  • Azure Workload identity webhook: 1.3.0
  • Bicep recipe location ghcr.io/radius-project/dev/test/testrecipes/test-bicep-recipes/<name>:pr-func904d89a6f2
  • Terraform recipe location http://tf-module-server.radius-test-tf-module-server.svc.cluster.local/<name>.zip (in cluster)
  • applications-rp test image location: ghcr.io/radius-project/dev/applications-rp:pr-func904d89a6f2
  • dynamic-rp test image location: ghcr.io/radius-project/dev/dynamic-rp:pr-func904d89a6f2
  • controller test image location: ghcr.io/radius-project/dev/controller:pr-func904d89a6f2
  • ucp test image location: ghcr.io/radius-project/dev/ucpd:pr-func904d89a6f2
  • deployment-engine test image location: ghcr.io/radius-project/deployment-engine:latest

Test Status

⌛ Building Radius and pushing container images for functional tests...
✅ Container images build succeeded
⌛ Publishing Bicep Recipes for functional tests...
✅ Recipe publishing succeeded
⌛ Starting corerp-cloud functional tests...
⌛ Starting ucp-cloud functional tests...
✅ ucp-cloud functional tests succeeded
✅ corerp-cloud functional tests succeeded

@codecov
Copy link
Copy Markdown

codecov Bot commented May 6, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 51.20%. Comparing base (7064761) to head (b0938da).

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@nithyatsu nithyatsu merged commit 8661cf8 into radius-project:main May 6, 2026
57 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

rad resource-type show does not handle additionalProperties

4 participants