Skip to content

feat: add Description field to SSA InjectedKey#672

Open
fernandezcuesta wants to merge 2 commits into
crossplane:mainfrom
fernandezcuesta:fix/671--customizable-injectedkey-description
Open

feat: add Description field to SSA InjectedKey#672
fernandezcuesta wants to merge 2 commits into
crossplane:mainfrom
fernandezcuesta:fix/671--customizable-injectedkey-description

Conversation

@fernandezcuesta

@fernandezcuesta fernandezcuesta commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Description of your changes

Add a customizable Description field to InjectedKey struct. Before, SSA injected keys always got hardcoded description.

Now providers can set their own (for instance, omit the "this is an injected field with a default value..." sentence, which might be misleading) when there isn't a default value set.

Fixes #671

I have:

  • Read and followed Upjet's contribution process.
  • Run make reviewable to ensure this PR is ready for review.
  • Added backport release-x.y labels to auto-backport this PR if necessary.

How has this code been tested

Add unit test.

Signed-off-by: Jesús Fernández <7312236+fernandezcuesta@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented Jun 10, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Adds a Description field to InjectedKey, updates the builder to use that description when present (falling back to the default), and adds a unit test validating default and custom description behavior.

Changes

Configurable injected key description

Layer / File(s) Summary
Injected key description configuration
pkg/config/resource.go
InjectedKey struct adds an exported Description field, enabling custom descriptions for injected list-map keys.
List merge strategy injection with configurable description
pkg/types/builder.go, pkg/types/builder_test.go
injectServerSideApplyListMergeKeys applies the configured description when present or falls back to descriptionInjectedKey. Tests verify both default and custom description handling.

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 7
✅ Passed checks (7 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and concisely describes the main change: adding a customizable Description field to the InjectedKey struct for server-side apply operations.
Linked Issues check ✅ Passed The PR successfully implements the objective from issue #671 by adding a customizable Description field to InjectedKey, allowing providers to set their own descriptions rather than using a hardcoded value.
Out of Scope Changes check ✅ Passed All changes are directly related to the stated objective: adding the Description field to InjectedKey, updating the logic to use it, and adding comprehensive test coverage.
Configuration Api Breaking Changes ✅ Passed PR only adds an optional field to InjectedKey struct in pkg/config/resource.go. No fields/types/functions removed, renamed, or signature changes—backward compatible with all existing code.
Generated Code Manual Edits ✅ Passed No files matching the zz_*.go pattern (generated code) were modified. All PR changes are to hand-written source files (pkg/config/resource.go, pkg/types/builder.go, pkg/types/builder_test.go).
Template Breaking Changes ✅ Passed PR modifies pkg/config/resource.go, pkg/types/builder.go, and pkg/types/builder_test.go only; no changes to pkg/controller/external*.go template files are present.
Description check ✅ Passed The pull request description clearly explains the changes: adding a customizable Description field to InjectedKey to allow providers to override the hardcoded description text.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 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 `@pkg/config/resource.go`:
- Around line 384-388: The InjectedKey struct's Description field lacks GoDoc;
add a GoDoc comment above Description in the InjectedKey type (reference:
InjectedKey.Description) explaining that it is the OpenAPI schema description
for the injected list-map key field, that providers may supply a custom
description, and that when empty it defaults to a standard description about
server-side apply/merge behavior so consumers understand its purpose and default
behavior.
🪄 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: e431b676-2494-4051-9964-162576365f5e

📥 Commits

Reviewing files that changed from the base of the PR and between 59c4552 and 1fc5dc3.

📒 Files selected for processing (3)
  • pkg/config/resource.go
  • pkg/types/builder.go
  • pkg/types/builder_test.go

Comment thread pkg/config/resource.go
Signed-off-by: Jesús Fernández <7312236+fernandezcuesta@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SSA injected InjectedKey description can't be changed

1 participant