Skip to content

Document type parameters for setCustomLocalAttribute() and get() - #88

Merged
alansemenov merged 2 commits into
masterfrom
lib-context-typed-custom-attributes
Sep 28, 2026
Merged

alansemenov merged 2 commits into
masterfrom
lib-context-typed-custom-attributes

Conversation

@alansemenov

Copy link
Copy Markdown
Member

Updates the lib-context page for enonic/xp#12398, which adds type parameters to setCustomLocalAttribute(), get(), Context and CustomAttributeValue.

  • setCustomLocalAttribute<T>() constrains the stored value to the JSON-like shape of T, compile time only
  • get<Attributes>() types the attributes read back, each as optional
  • Context<Attributes> and CustomAttributeValue<T> described under Type Definitions
  • Examples use the same type on both ends instead of an as cast

Should be merged together with enonic/xp#12398.

🤖 Generated with Claude Code

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings September 28, 2026 08:20

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

Two documentation inconsistencies remain unresolved.

Review effort: Lite
Findings: 1 Low severity

Open (1)
What changed in this PR

Updates lib-context documentation for generic TypeScript context attributes and custom attribute values.

Changes:

  • Documents typed get() and setCustomLocalAttribute() usage.
  • Adds generic Context and CustomAttributeValue documentation.
  • Updates examples to use shared attribute types.
File Summary Review notes
docs/​libraries/​lib-context.adoc Adds generic API documentation and updated examples. Two nit findings remain: clarify compile-time-only validation wording (4 votes) and update the attributes type table to include the generic intersection (1 vote).

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread docs/libraries/lib-context.adoc Outdated
…ll rejects non-JSON values

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@alansemenov
alansemenov merged commit 6b87c7d into master Sep 28, 2026
2 checks passed
@alansemenov
alansemenov deleted the lib-context-typed-custom-attributes branch September 28, 2026 10:30
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.

2 participants