Skip to content
Merged
2 changes: 2 additions & 0 deletions api/v1alpha1/docs/apiref.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -2040,6 +2040,8 @@ How this works: +
- if the user has a number above the weight they keep using the current UI + | | Maximum: 100 +
Minimum: 0 +

| *`workatoWebHookURL`* __string__ | WorkatoWebHookURL is used by the UI to push events to Marketo for analytics purposes. +
The webhook URL is unique per environment. + | |
|===


Expand Down
5 changes: 5 additions & 0 deletions api/v1alpha1/toolchainconfig_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,11 @@ type RegistrationServiceConfig struct {
// +kubebuilder:validation:Minimum=0
// +kubebuilder:validation:Maximum=100
UICanaryDeploymentWeight *int `json:"uiCanaryDeploymentWeight,omitempty"`

// WorkatoWebHookURL is used by the UI to push events to Marketo for analytics purposes.
// The webhook URL is unique per environment.
// +optional
WorkatoWebHookURL *string `json:"workatoWebHookURL,omitempty"`
Comment on lines +262 to +265
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion | 🟠 Major

🧩 Analysis chain

Rename to “Webhook” and add URL validation (Format=uri + https-only).

Avoid locking in an inconsistent public API and add basic validation hints.

Apply this diff:

@@
-    // WorkatoWebHookURL is used by the UI to push events to Marketo for analytics purposes.
-    // The webhook URL is unique per environment.
-    // +optional
-    WorkatoWebHookURL *string `json:"workatoWebHookURL,omitempty"`
+    // WorkatoWebhookURL is used by the UI to push events to Marketo for analytics purposes.
+    // The webhook URL is unique per environment.
+    // +kubebuilder:validation:Format=uri
+    // +kubebuilder:validation:Pattern=`^https://`
+    // +optional
+    WorkatoWebhookURL *string `json:"workatoWebhookURL,omitempty"`

🏁 Script executed:

#!/bin/bash
# Verify no lingering references to the old name remain and that the new name exists.
set -euo pipefail
echo "Searching for old/new identifiers..."
rg -n -S '\bWorkatoWebHookURL\b|\bworkatoWebHookURL\b|\bWorkatoWebhookURL\b|\bworkatoWebhookURL\b' -C2

echo
echo "Note: run 'make generate' locally, then ensure:"
echo "- zz_generated.openapi.go shows property 'workatoWebhookURL' with Format: 'uri'"
echo "- zz_generated.deepcopy.go reflects WorkatoWebhookURL copies"

Length of output: 2232


[/run_scripts]


🏁 Script executed:

#!/bin/bash
# Check for other webhook/hook field naming patterns in the types file
echo "=== Other webhook/hook related fields ==="
rg -n -i 'webhook|webhookconfig|webhooki' api/v1alpha1/toolchainconfig_types.go -C1

echo
echo "=== Kubebuilder validation examples in same file ==="
rg -n 'kubebuilder:validation:' api/v1alpha1/toolchainconfig_types.go | head -20

echo
echo "=== Check if Format=uri validation exists elsewhere ==="
rg -n 'Format=uri' api/v1alpha1/ -C1

Length of output: 620


[/run_scripts]


🏁 Script executed:

#!/bin/bash
# Search for WebhookConfig and WebhookSecret across entire codebase
echo "=== Searching for WebhookConfig ==="
rg -n 'WebhookConfig' . -C1

echo
echo "=== Searching for WebhookSecret ==="
rg -n 'WebhookSecret' . -C1

echo
echo "=== Search for other URL fields with validation ==="
rg -n -A2 'Format.*uri|Pattern.*https' api/v1alpha1/ -C1

Length of output: 8860


Rename to "Webhook" and add URL validation before API stabilizes.

The codebase establishes "Webhook" naming in WebhookConfig and WebhookSecret (memberoperatorconfig_types.go). The new field breaks this convention. Since this field is newly added, apply both the naming correction and validation markers now to avoid future API churn.

Apply this diff:

@@
-    // WorkatoWebHookURL is used by the UI to push events to Marketo for analytics purposes.
-    // The webhook URL is unique per environment.
-    // +optional
-    WorkatoWebHookURL *string `json:"workatoWebHookURL,omitempty"`
+    // WorkatoWebhookURL is used by the UI to push events to Marketo for analytics purposes.
+    // The webhook URL is unique per environment.
+    // +kubebuilder:validation:Format=uri
+    // +kubebuilder:validation:Pattern=`^https://`
+    // +optional
+    WorkatoWebhookURL *string `json:"workatoWebhookURL,omitempty"`

After renaming, run make generate locally to ensure zz_generated.deepcopy.go and zz_generated.openapi.go reflect the updated field name and validation markers.

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In api/v1alpha1/toolchainconfig_types.go around lines 262 to 265, rename the
struct field from WorkatoWebHookURL to WorkatoWebhookURL (use "Webhook" not
"WebHook"), update the json tag to `json:"workatoWebhookURL,omitempty"`, and add
validation markers such as `// +optional` and `//
+kubebuilder:validation:Format=uri` above the field; after making these changes
run `make generate` to regenerate zz_generated.deepcopy.go and
zz_generated.openapi.go so the new field name and validation are reflected.

}

// RegistrationServiceAnalyticsConfig contains the subset of registration service configuration parameters related to analytics
Expand Down
5 changes: 5 additions & 0 deletions api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions api/v1alpha1/zz_generated.openapi.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading