Skip to content

Add field-level comments to RxJsonSchema types for coding agents - #8832

Merged
pubkey merged 3 commits into
masterfrom
claude/session-0c155q
Jul 21, 2026
Merged

pubkey merged 3 commits into
masterfrom
claude/session-0c155q

Conversation

@pubkey

@pubkey pubkey commented Jul 21, 2026

Copy link
Copy Markdown
Owner

This PR contains:

  • IMPROVED typings (documentation comments only, no type changes)

Describe the problem you have without this PR

Coding agents read type definitions to learn how to build a valid RxJsonSchema, but most fields in src/types/rx-schema.d.ts had no comments. Agents therefore miss RxDB-specific rules that plain JSON Schema does not have and generate invalid schemas (missing maxLength on indexed strings, null types, default on nested fields).

This PR adds JSDoc comments to the fields of JsonSchema, TopLevelProperty and RxJsonSchema, so the rules are visible directly at the field:

  • ref: reference to another collection for the population plugin
  • final: value can never be changed after insert, automatically required
  • default: only allowed on top-level fields
  • maxLength: required for string fields used as primary key or in an index
  • minimum / maximum / multipleOf: required for number and integer fields used in an index
  • version: starts at 0, increasing it requires migration strategies
  • type, format, pattern, properties, required, items: RxDB-specific guidance (single fixed type, no underscore-prefixed field names, validation plugin needed for format/pattern, index fields must be required)

Todos

  • Tests (comment-only change, no behavior change)
  • Typings

ðŸĪ– Generated with Claude Code

https://claude.ai/code/session_01T2s4XZfAyrF3osvzNKdvCn


Generated by Claude Code

claude added 3 commits July 21, 2026 12:04
â€Ķg agents

Add JSDoc comments to the fields of JsonSchema, TopLevelProperty and
RxJsonSchema in src/types/rx-schema.d.ts. Coding agents read type
definitions, so the comments explain RxDB-specific rules directly at
the fields: ref (population), final (immutable after insert), default
(top-level only), maxLength for indexed strings, minimum/maximum/
multipleOf for indexed numbers, version/migration and more.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01T2s4XZfAyrF3osvzNKdvCn
â€ĶLLMs

Plugins like webmcp embed the collection's JSON schema into MCP tool
descriptions, so title and description reach AI agents, not only humans.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01T2s4XZfAyrF3osvzNKdvCn
@pubkey
pubkey merged commit c5b65be into master Jul 21, 2026
24 checks passed
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