Skip to content

fix(caching-guide): correct jokeAPI.get() signature in complete example#521

Merged
Ethan-Arrowood merged 1 commit into
mainfrom
kris/fix-caching-getid
Jun 11, 2026
Merged

fix(caching-guide): correct jokeAPI.get() signature in complete example#521
Ethan-Arrowood merged 1 commit into
mainfrom
kris/fix-caching-getid

Conversation

@kriszyp

@kriszyp kriszyp commented Jun 9, 2026

Copy link
Copy Markdown
Member

Summary

  • The "Putting It All Together" example used async get() with this.getId() inside the body, which throws TypeError: this.getId is not a function at runtime
  • The correct signature is async get(id)id is passed as a parameter by Harper's sourcedFrom machinery, not via a method on this
  • The earlier "Wrapping an External Data Source" section already used the correct form; this fix makes the final example consistent with it and with the working caching-guide-example repo

Test plan

  • Follow the caching-with-harper guide end-to-end: GET /JokeCache/1 returns a joke (not a 500)
  • Verify the "Putting It All Together" snippet matches the caching-guide-example main branch

🤖 Generated with Claude Code — fix verified by running the full caching guide locally (all four scenarios: miss, cached, 304, no-cache, invalidate).

The 'Putting It All Together' example used `async get()` with `this.getId()`
which throws at runtime. The correct signature is `async get(id)` — consistent
with the earlier 'Wrapping an External Data Source' section and the working
caching-guide-example repo.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@kriszyp kriszyp requested a review from a team as a code owner June 9, 2026 05:00
@gemini-code-assist

Copy link
Copy Markdown

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@github-actions github-actions Bot temporarily deployed to pr-521 June 9, 2026 05:03 Inactive
@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown

🚀 Preview Deployment

Your preview deployment is ready!

🔗 Preview URL: https://preview.harper-documentation.harperfabric.com/pr-521

This preview will update automatically when you push new commits.

@Ethan-Arrowood Ethan-Arrowood merged commit 8fbc6b2 into main Jun 11, 2026
7 checks passed
@Ethan-Arrowood Ethan-Arrowood deleted the kris/fix-caching-getid branch June 11, 2026 21:01
@github-actions

Copy link
Copy Markdown

🧹 Preview Cleanup

The preview deployment for this PR has been removed.

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.

3 participants