Skip to content

Hydrate Radius.Core schemas from OpenAPI#11881

Open
willdavsmith wants to merge 2 commits into
radius-project:mainfrom
willdavsmith:willdavsmith/10894
Open

Hydrate Radius.Core schemas from OpenAPI#11881
willdavsmith wants to merge 2 commits into
radius-project:mainfrom
willdavsmith:willdavsmith/10894

Conversation

@willdavsmith
Copy link
Copy Markdown
Contributor

@willdavsmith willdavsmith commented May 13, 2026

Summary

Fixes #10894 by hydrating Radius.Core resource type metadata from the generated OpenAPI spec during UCP startup.

The built-in manifests can stay minimal, while UCP registration fills descriptions and schemas for Radius.Core/applications, Radius.Core/environments, and Radius.Core/recipePacks.

Root Cause

The Radius.Core built-in manifests register these resource types with empty schemas. rad resource-type show reads ResourceProviderSummary, so the CLI and dashboard only saw empty descriptions and null schemas for these built-in types.

What Changed

  • Added UCP initializer hydration for Radius.Core metadata.
  • Reads the embedded generated OpenAPI document from swagger.SpecFiles.
  • Maps each built-in type to its TypeSpec-generated OpenAPI definitions.
  • Expands local OpenAPI refs before persisting so existing CLI schema rendering receives concrete property schemas.
  • Writes hydrated schemas through the existing registration flow into both APIVersion resources and ResourceProviderSummary.
  • Added regression coverage using the real built-in radius_core.yaml manifest.

User Experience

Before

Users could discover that Radius.Core/applications, Radius.Core/environments, and Radius.Core/recipePacks existed, but the type details were effectively empty.

For example:

rad resource-type show Radius.Core/applications

returned only the type name and API version:

TYPE                      NAMESPACE
Radius.Core/applications  Radius.Core

DESCRIPTION:

API VERSION: 2025-08-01-preview

JSON output also showed the missing metadata:

"Description": "",
"Schema": null

In the Dashboard, these built-in Radius.Core types appeared without useful schema/property information, so users could not inspect required fields, read-only fields, nested properties, or property descriptions.

After

Users can inspect the built-in Radius.Core types the same way they inspect other registered resource types.

For example:

rad resource-type show Radius.Core/applications

now shows the generated TypeSpec/OpenAPI metadata:

TYPE                      NAMESPACE
Radius.Core/applications  Radius.Core

DESCRIPTION:
Radius Application resource
API VERSION: 2025-08-01-preview

TOP-LEVEL PROPERTIES:

NAME               TYPE      REQUIRED  READ-ONLY  DESCRIPTION
environment        string    true      false      Fully qualified resource ID for the environment that the application is linked to
provisioningState  string    false     true       The status of the asynchronous operation.
status             object    false     true       Status of a resource.

The same improvement applies to:

  • Radius.Core/environments
  • Radius.Core/recipePacks

Dashboard and CLI users now get meaningful descriptions and schema details for these built-in types without duplicating schemas in the manifest YAML.

Validation

  • go test ./pkg/ucp/initializer ./pkg/cli/cmd/resourcetype/show ./pkg/cli/cmd/resourcetype/common ./pkg/cli/manifest ./pkg/schema
  • git diff --check
  • Live kind smoke test on kind-radius-10894 with patched UCP image verified applications, environments, and recipePacks render schema details.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 13, 2026

Codecov Report

❌ Patch coverage is 54.20561% with 49 lines in your changes missing coverage. Please review.
✅ Project coverage is 51.71%. Comparing base (48bcd09) to head (833116c).

Files with missing lines Patch % Lines
pkg/ucp/initializer/radius_core_openapi.go 55.23% 26 Missing and 21 partials ⚠️
pkg/ucp/initializer/service.go 0.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #11881      +/-   ##
==========================================
- Coverage   51.74%   51.71%   -0.03%     
==========================================
  Files         726      727       +1     
  Lines       45605    45712     +107     
==========================================
+ Hits        23597    23642      +45     
- Misses      19788    19822      +34     
- Partials     2220     2248      +28     

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

@willdavsmith willdavsmith requested review from Copilot and removed request for Copilot May 14, 2026 16:13
@willdavsmith willdavsmith marked this pull request as ready for review May 14, 2026 17:55
@willdavsmith willdavsmith requested review from a team as code owners May 14, 2026 17:55
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

This PR fixes missing schema/description metadata for built-in Radius.Core resource types by hydrating the manifest metadata from the embedded TypeSpec-generated OpenAPI document during UCP startup, improving rad resource-type show and Dashboard schema rendering for applications, environments, and recipePacks.

Changes:

  • Hydrates Radius.Core resource type descriptions and per-API-version schemas from the embedded OpenAPI spec during initializer registration.
  • Expands local OpenAPI #/definitions/* refs into concrete schemas before persisting into APIVersion and ResourceProviderSummary.
  • Adds a regression test that registers the real built-in radius_core.yaml manifest and asserts schemas are populated and $ref-free for renderability.

Reviewed changes

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

File Description
pkg/ucp/initializer/service.go Invokes built-in metadata hydration before persisting provider/type/version resources.
pkg/ucp/initializer/radius_core_openapi.go Loads embedded Radius.Core OpenAPI and resolves #/definitions/* refs to hydrate descriptions and schemas.
pkg/ucp/initializer/service_test.go Adds regression coverage validating hydrated schemas/descriptions are persisted and renderable.

Comment thread pkg/ucp/initializer/radius_core_openapi.go Outdated
Comment thread pkg/ucp/initializer/service.go Outdated
// bypassing the HTTP API and async operation queue. This is used during server initialization
// where the resources are known to not exist yet.
func registerResourceProviderDirect(ctx context.Context, dbClient database.Client, planeName string, rp manifest.ResourceProvider) error {
if err := hydrateBuiltInResourceProviderMetadata(&rp); err != nil {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: this call is independant and should be at ln90, not within registerResourceProviderDirect (SRP)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in f9bfc3884. The hydration call now happens in Service.Run immediately after manifest validation and before direct registration, so registerResourceProviderDirect is back to only persisting the already-prepared resource provider metadata.

Validation run:

go test ./pkg/ucp/initializer ./pkg/cli/cmd/resourcetype/show ./pkg/cli/cmd/resourcetype/common ./pkg/cli/manifest ./pkg/schema

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

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.

@radius-functional-tests
Copy link
Copy Markdown

radius-functional-tests Bot commented May 14, 2026

Radius functional test overview

🔍 Go to test action run

Click here to see the test run details
Name Value
Repository willdavsmith/radius
Commit ref 833116c
Unique ID func3474475bbf
Image tag pr-func3474475bbf
  • 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-func3474475bbf
  • 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-func3474475bbf
  • dynamic-rp test image location: ghcr.io/radius-project/dev/dynamic-rp:pr-func3474475bbf
  • controller test image location: ghcr.io/radius-project/dev/controller:pr-func3474475bbf
  • ucp test image location: ghcr.io/radius-project/dev/ucpd:pr-func3474475bbf
  • 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 ucp-cloud functional tests...
⌛ Starting corerp-cloud functional tests...
✅ ucp-cloud functional tests succeeded
✅ corerp-cloud functional tests succeeded

@lakshmimsft
Copy link
Copy Markdown
Contributor

nit: The functions e.g.hydrateBuiltInResourceProviderMetadata, loadRadiusCoreOpenAPI,
resolveOpenAPIValue etc. would benefit from brief doc comments. I know they're not exported so comments aren't strictly required, but given the non-obvious OpenAPI resolution logic, a short comment on each would help readers understand the intent.

openAPIDefinitionRefRoot = "#/definitions/"
)

var radiusCoreTypeOpenAPIDefinitions = map[string]struct {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the PR does not include new types added in main: terraformConfigs, bicepConfigs
This is a gap. should we raise an error if the openapi file has a type with no matching entry ?

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 for Radius.Core/* Resource Types does not display details

3 participants