Remove the need to add radius properties into every RRT schema explicitly#12252
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #12252 +/- ##
==========================================
+ Coverage 52.92% 52.99% +0.06%
==========================================
Files 753 754 +1
Lines 48468 48604 +136
==========================================
+ Hits 25654 25759 +105
- Misses 20401 20420 +19
- Partials 2413 2425 +12 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
3599a09 to
b5c6e1e
Compare
There was a problem hiding this comment.
Pull request overview
This PR introduces a canonical “base resource manifest” that defines Radius-owned, common schema properties (notably application, environment, connections, and the new codeReference) and ensures they are automatically merged into every resource type schema during manifest validation/registration and during Bicep type generation. It also updates test and built-in provider manifests to omit these common properties (relying on the merge) while adding validation to prevent per-type schemas from redeclaring the reserved base properties.
Changes:
- Added
pkg/schema/baseresourcewith an embeddedbase.yamlplus a loader/merger to inject base properties + required fields into decoded schemas. - Updated CLI manifest validation (
ValidateManifest) to apply the base manifest (and reject redeclaration conflicts) before schema validation/registration. - Updated schema validation + utilities to recognize
codeReference, and updated manifests/testdata + bicep-tools conversion to rely on the merged base properties.
Reviewed changes
Copilot reviewed 31 out of 31 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| test/functional-portable/dynamicrp/noncloud/resources/testdata/testresourcetypes.yaml | Removes explicit base properties from dynamic-rp test resource schemas so tests rely on base-manifest merging. |
| pkg/ucp/integrationtests/resourceproviders/testdata/manifests-no-location/persistentVolumes.yaml | Simplifies schema to properties: {} while retaining required list; relies on base-manifest merge during initializer validation. |
| pkg/ucp/integrationtests/resourceproviders/testdata/manifests-no-location/containers.yaml | Same as above for containers no-location startup registration coverage. |
| pkg/schema/validator.go | Adds codeReference to reserved-property type constraints (string-only). |
| pkg/schema/validator_test.go | Adds unit coverage for codeReference reserved-property type validation. |
| pkg/schema/baseresource/loader.go | New base-manifest loader + merger (Load/MustLoad/Apply) and conflict detection helpers. |
| pkg/schema/baseresource/loader_test.go | Unit tests for base-manifest parsing, merging behavior, idempotency, and copy-safety. |
| pkg/schema/baseresource/base.yaml | New canonical YAML definition of base properties + required set (embedded via go:embed). |
| pkg/resourceutil/utils.go | Treats codeReference as a framework-owned/basic property for filtering/processing. |
| pkg/dynamicrp/datamodel/dynamicresource.go | Adds a CodeReference() accessor on the dynamic resource adapter to read the base property. |
| pkg/dynamicrp/datamodel/dynamicresource_test.go | Adds tests for CodeReference() behavior across missing/invalid/valid cases. |
| pkg/cli/manifest/validation.go | Loads a single base manifest at init and adds applyBaseResourceManifest() to merge + enforce no-redeclare. |
| pkg/cli/manifest/validation_test.go | Adds tests ensuring merge behavior and redeclare rejection in the CLI manifest pipeline. |
| pkg/cli/manifest/testdata/merge-base-manifest.yaml | New manifest fixture used to validate end-to-end base-merge behavior in ValidateManifest. |
| pkg/cli/manifest/registermanifest.go | Calls applyBaseResourceManifest() inside ValidateManifest before schema validation/registration. |
| pkg/cli/manifest/registermanifest_test.go | Adds a regression test proving ValidateManifest returns schemas already merged with base properties. |
| pkg/cli/cmd/resourcetype/create/testdata/valid.yaml | Updates resourcetype-create test manifests to omit base properties from schemas. |
| eng/design-notes/resources/2026-06-base-resource-manifest.md | Updates design note to reflect immutable BaseManifest load-once model + merge chokepoint behavior. |
| deploy/manifest/built-in-providers/self-hosted/secrets.yaml | Removes explicit base properties from built-in schema; keeps required semantics; formatting cleanup. |
| deploy/manifest/built-in-providers/self-hosted/routes.yaml | Same as above; removes explicit base properties and normalizes formatting. |
| deploy/manifest/built-in-providers/self-hosted/persistentVolumes.yaml | Same as above; removes explicit base properties and normalizes formatting. |
| deploy/manifest/built-in-providers/self-hosted/mySqlDatabases.yaml | Removes explicit base properties and normalizes formatting in schema/docs blocks. |
| deploy/manifest/built-in-providers/self-hosted/containers.yaml | Removes explicit base properties (including connections) and normalizes formatting. |
| deploy/manifest/built-in-providers/dev/secrets.yaml | Mirrors self-hosted manifest updates for dev manifests. |
| deploy/manifest/built-in-providers/dev/routes.yaml | Mirrors self-hosted manifest updates for dev manifests. |
| deploy/manifest/built-in-providers/dev/persistentVolumes.yaml | Mirrors self-hosted manifest updates for dev manifests. |
| deploy/manifest/built-in-providers/dev/mySqlDatabases.yaml | Mirrors self-hosted manifest updates for dev manifests. |
| deploy/manifest/built-in-providers/dev/containers.yaml | Mirrors self-hosted manifest updates for dev manifests. |
| bicep-tools/pkg/converter/converter.go | Applies base-property merge before emitting Bicep property types, matching server-side behavior. |
| bicep-tools/pkg/converter/baseresource.go | New bicep-tools base-manifest decode-from-canonical-YAML + merge helper. |
| bicep-tools/pkg/converter/baseresource_test.go | Unit tests ensuring canonical YAML decode and merge semantics in bicep-tools. |
b1b3709 to
1b066f9
Compare
Wire baseresource.Apply into pkg/cli/manifest so every registration path (rad resource-type create, RegisterFile/RegisterDirectory, and the UCP initializer service at startup) merges the common base properties into per-type schemas before validation and registration. The base manifest is loaded once at package init and reused, immutable, for the process lifetime. Add codeReference to the validator's reserved string-shape check so a type-declared codeReference must be a string, mirroring application and environment. Signed-off-by: Nithya Subramanian <nithyasu@microsoft.com>
Add codeReference to resourceutil.BasicProperties so the runtime treats it as a framework-owned property (excluded from connection environment variables and from user-supplied resource properties), and add a CodeReference() accessor on the dynamic-rp basic-properties adapter mirroring ApplicationID and EnvironmentID. Signed-off-by: Nithya Subramanian <nithyasu@microsoft.com>
Add a parallel base-resource merger to bicep-tools so the published Bicep types expose application, environment, connections, and codeReference even when an author omits them, mirroring the server-side merge in pkg/cli/manifest. bicep-tools models schemas with its own typed manifest.Schema rather than the map[string]any the schema package merges, so the base set is duplicated as a typed literal. A sync test reads the canonical pkg/schema/baseresource/base.yaml and fails CI if the literal drifts. manifest.Schema is unchanged. Signed-off-by: Nithya Subramanian <nithyasu@microsoft.com>
Now that the base resource manifest injects application, environment, connections, and codeReference into every schema, the dynamic-rp functional test resource types no longer need to restate them. Remove the duplicated property declarations and the application/environment required entries (environment stays required via the base merge), keeping only type-specific properties and required fields. Signed-off-by: Nithya Subramanian <nithyasu@microsoft.com>
The containers connections schema carries an optional disableDefaultEnvVars flag that the base connections lacked. Add it to the canonical base.yaml and the bicep-tools typed mirror so every resource type's connections inherits it and containers can stop declaring its own connections block. Signed-off-by: Nithya Subramanian <nithyasu@microsoft.com>
Base property names (application, environment, connections, codeReference) are reserved by Radius and injected automatically. Reject any per-type schema that redeclares one under "properties" via a pre-merge ConflictingProperties check; a base property may still be listed under "required" to make it mandatory. Drop the now-redundant declarations from the built-in provider manifests (self-hosted and dev) and the affected test fixtures, leaving their required lists intact as allowed references to the base-provided properties. Signed-off-by: Nithya Subramanian <nithyasu@microsoft.com>
2e38a70 to
6728365
Compare
Radius functional test overviewClick here to see the test run details
Test Status⌛ Building Radius and pushing container images for functional tests... |
bf1015c
# Description
This pull request introduces a new mechanism for merging common "base
resource" properties into all resource type schemas in the `bicep-tools`
converter, ensuring consistency with server-side validation and reducing
duplication. The main changes include implementing a reusable merger for
base properties, updating the converter to apply this merger
automatically, and removing redundant property declarations from
manifest files. Comprehensive tests and documentation updates support
these changes.
To test these changes:
## Manual test: base-manifest feature
### Setup
mkdir -p /tmp/base-test && cd /tmp/base-test
```
### Happy path
1. Create `widgets.yaml` (no base properties declared):
```yaml
namespace: Demo.Examples
types:
widgets:
apiVersions:
"2026-06-01-preview":
schema:
type: object
properties:
size:
type: integer
description: Widget size.
color:
type: string
description: Widget color.
required:
- size
- environment # allowed: re-asserting a base property
capabilities: ["ManualResourceProvisioning"]
```
2. Register the type and confirm base props were merged:
```sh
rad resource-type create -f widgets.yaml
rad resource-type show Demo.Examples/widgets -o json
Expect:
"application","codeReference","color","connections","environment","size"
defined as expected
3. Generate the Bicep extension and confirm base props were merged:
```sh
rad bicep publish-extension --from-file widgets.yaml --target ./demo-examples.tgz --force
4. Create `bicepconfig.json`:
```json
{
"experimentalFeaturesEnabled": { "extensibility": true },
"extensions": {
"radius": "br:biceptypes.azurecr.io/radius:latest",
"demo": "./demo-examples.tgz"
}
}
```
5. Create `widget-app.bicep`:
```bicep
extension radius
extension demo
@description('Existing Radius environment.')
param environment string
@description('Optional Radius application.')
param application string = ''
resource w 'Demo.Examples/widgets@2026-06-01-preview' = {
name: 'demo-widget'
properties: {
environment: environment
application: application
connections: {}
codeReference:
'https://github.com/myorg/repo/blob/abc1234/widgets.cpp#L1' #
size: 10
color: 'red'
}
}
```
6. Deploy and verify:
```sh
rad deploy widget-app.bicep \
--parameters environment=$(rad env show -o json | jq -r .id) \
--parameters application=$(rad app show <your-app> -o json | jq -r .id)
rad resource list Demo.Examples/widgets
```
Expect: Bicep compiles, deploy succeeds, resource appears with all four base props.
### Error path — Bicep omits the required `environment`/ other auto-injected properties
Create `widget-missing-env.bicep`:
```bicep
extension radius
extension demo
resource w 'Demo.Examples/widgets@2026-06-01-preview' = {
name: 'demo-widget-missing-env'
properties: {
// environment intentionally omitted — base marks it required.
size: 5
color: 'blue'
}
}
```
## Type of change
<!--
Please select **one** of the following options that describes your change and delete the others. Clearly identifying the type of change you are making will help us review your PR faster, and is used in authoring release notes.
If you are making a bug fix or functionality change to Radius and do not have an associated issue link, please create one now.
-->
- This pull request fixes a bug in Radius and has an approved issue (issue link required).
- This pull request adds or changes features of Radius and has an approved issue (issue link required).
- This pull request is a minor refactor, code cleanup, test improvement, or other maintenance task and doesn't change the functionality of Radius (issue link optional).
- This pull request is a design document and only includes files in the eng/design-notes directory.
<!-- Please update the following to link the associated issue. This is required for some kinds of changes (see above). -->
Fixes: #issue_number
## Contributor checklist
Please verify that the PR meets the following requirements, where applicable:
- An overview of proposed schema changes is included in a linked GitHub issue.
- [ ] Yes
- [x] Not applicable
- A design document is added or updated under `eng/design-notes/` in this repository, if new APIs are being introduced.
- [ ] Yes
- [x] Not applicable
- The design document has been reviewed and approved by Radius maintainers/approvers.
- [ ] Yes
- [x] Not applicable
- A PR for [resource-types-contrib](https://github.com/radius-project/resource-types-contrib/) is created, if resource types or recipes are affected by the changes in this PR.
- [ ] Yes
- [x] Not applicable
- A PR for [dashboard](https://github.com/radius-project/dashboard/) is created, if the Radius Dashboard is affected by the changes in this PR.
- [ ] Yes
- [x] Not applicable
- A PR for the [documentation repository](https://github.com/radius-project/docs) is created, if the changes in this PR affect the documentation or any user facing updates are made.
- [ ] Yes
- [x] Not applicable
---------
Signed-off-by: Nithya Subramanian <nithyasu@microsoft.com>
Signed-off-by: sk593 <shruthikumar@microsoft.com>
Description
This pull request introduces a new mechanism for merging common "base resource" properties into all resource type schemas in the
bicep-toolsconverter, ensuring consistency with server-side validation and reducing duplication. The main changes include implementing a reusable merger for base properties, updating the converter to apply this merger automatically, and removing redundant property declarations from manifest files. Comprehensive tests and documentation updates support these changes.To test these changes:
Manual test: base-manifest feature
Setup
mkdir -p /tmp/base-test && cd /tmp/base-test
widget-app.bicep:Expect: Bicep compiles, deploy succeeds, resource appears with all four base props.
Error path — Bicep omits the required
environment/ other auto-injected propertiesCreate
widget-missing-env.bicep:Type of change
Fixes: #issue_number
Contributor checklist
Please verify that the PR meets the following requirements, where applicable:
eng/design-notes/in this repository, if new APIs are being introduced.