Skip to content

docs: fix result values in custom operation examples#1989

Open
anxkhn wants to merge 1 commit into
open-feature:mainfrom
anxkhn:docs/fix-custom-op-example-results
Open

docs: fix result values in custom operation examples#1989
anxkhn wants to merge 1 commit into
open-feature:mainfrom
anxkhn:docs/fix-custom-op-example-results

Conversation

@anxkhn

@anxkhn anxkhn commented Jul 7, 2026

Copy link
Copy Markdown
## This PR

Fixes the example "Result" JSON in the semver and starts-with/ends-with custom
operation docs, where the `value` did not match its own `variant`.

Each example flag defines the same variants map:

```json
"variants": { "red": "#FF0000", "blue": "#0000FF", "green": "#00FF00" }

with targeting if(<operation>) then "red" else "green". So a result with
"variant":"red" must carry "value":"#FF0000" and "variant":"green" must
carry "value":"#00FF00". The docs instead showed:

  • {"value":"#00FF00", ... ,"variant":"red"} (should be #FF0000)
  • {"value":"#0000FF", ... ,"variant":"green"} (should be #00FF00)

which flagd never actually returns, so anyone copy-running the examples sees a
mismatch. This corrects the six affected value fields (2 in
semver-operation.md, 4 in string-comparison-operation.md) to match each
variant. Only the hex value changes; reason (TARGETING_MATCH, correct on
both branches) and variant are left as-is.

Verification

Built flagd and re-ran the exact commands from the docs against ResolveString:

  • semver >=1.0.0: 1.0.1 -> {"value":"#FF0000",...,"variant":"red"};
    0.1.0 -> {"value":"#00FF00",...,"variant":"green"}
  • startsWith user@faas: user@faas.com -> red/#FF0000;
    foo@bar.com -> green/#00FF00
  • endsWith faas.com: user@faas.com -> red/#FF0000;
    foo@bar.com -> green/#00FF00

All six live outputs now match the corrected docs. fractional-operation.md
already agreed with its variants map, so it is left untouched.

Docs-only change; make markdownlint rules pass on both files.

The example "Result" blocks in the sem_ver and starts_with/ends_with
docs showed values that did not match their own variant. The variants
map defines red as #FF0000 and green as #00FF00, but the red results
showed #00FF00 and the green results showed #0000FF, which is not what
flagd actually returns.

Correct each result value to match its variant so users copy-running the
examples see the real output:
- variant "red"   -> value "#FF0000"
- variant "green" -> value "#00FF00"

Verified against flagd's ResolveString output for both examples.

Signed-off-by: Anas Khan <83116240+anxkhn@users.noreply.github.com>
@anxkhn anxkhn requested review from a team as code owners July 7, 2026 07:51
@netlify

netlify Bot commented Jul 7, 2026

Copy link
Copy Markdown

Deploy Preview for polite-licorice-3db33c ready!

Name Link
🔨 Latest commit 9596dc0
🔍 Latest deploy log https://app.netlify.com/projects/polite-licorice-3db33c/deploys/6a4cafec1c05c0000807446b
😎 Deploy Preview https://deploy-preview-1989--polite-licorice-3db33c.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@dosubot dosubot Bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Jul 7, 2026
@coderabbitai

coderabbitai Bot commented Jul 7, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: f1451764-4356-4ba5-9ac5-e085f3d1c6ac

📥 Commits

Reviewing files that changed from the base of the PR and between d99a3e3 and 9596dc0.

📒 Files selected for processing (2)
  • docs/reference/custom-operations/semver-operation.md
  • docs/reference/custom-operations/string-comparison-operation.md

📝 Walkthrough

Walkthrough

This PR corrects example output values in two documentation files. In semver-operation.md, the red and green variant value fields in ResolveString examples were swapped to correct hex colors. In string-comparison-operation.md, similar value corrections were made across starts_with and ends_with examples.

Changes

Custom operations documentation fixes

Layer / File(s) Summary
Semver operation example fixes
docs/reference/custom-operations/semver-operation.md
Corrected the value field for red (#FF0000) and green (#00FF00) variants in the ResolveString example output.
String comparison operation example fixes
docs/reference/custom-operations/string-comparison-operation.md
Corrected the value fields shown in ResolveString example results for both starts_with and ends_with operations, for red and green variants.

Estimated code review effort: 1 (Trivial) | ~2 minutes

Related PRs: None identified.

Suggested labels: documentation

Suggested reviewers: None identified.

🐰 A poem for the occasion

A rabbit checked the docs one day,
Found colors swapped along the way,
Red was green and green was blue,
Now hex codes match the value true,
Hop along, the fix is neat and small! 🥕

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the docs change fixing example result values in custom operation examples.
Description check ✅ Passed The description accurately explains the same documentation updates and their purpose.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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.

@sonarqubecloud

sonarqubecloud Bot commented Jul 7, 2026

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant