Skip to content

Clarify implicit relations in the module schema - #219

Merged
w4bremer merged 2 commits into
mainfrom
docs/module-schema-implicit-relations
Jun 5, 2026
Merged

Clarify implicit relations in the module schema#219
w4bremer merged 2 commits into
mainfrom
docs/module-schema-implicit-relations

Conversation

@w4bremer

@w4bremer w4bremer commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Why

An agent (or any tool) that reads the ObjectAPI module schema through the MCP specificationSchema tool has no way to learn ApiGear's implicit behavior, and several descriptions actively contradicted the generator. Since specificationCheck only surfaces JSON-schema errors (semantic rules in pkg/model emit log.Warn, never reaching the client), the schema descriptions are effectively the agent's only source of truth.

What changed

Source of truth is apigear.module.schema.yaml; …schema.json is regenerated via task schema.

Documented implicit relations

  • New top-level model overview: reactive objects (local or remote via ObjectLink); each property auto-generates a getter, setter (unless readonly) and a change-notification signal — so don't declare a separate signal for property changes; properties/operations/signals share one namespace; a cross-module type needs both an import on the type and a top-level imports entry.

Corrected schema-vs-implementation discrepancies

  • Primitive type list fixed: removed the non-existent int16/float16, added bytes and any (matches pkg/model/schema.go).
  • Signals now use a dedicated Signal definition (name + params, no return) instead of reusing Operation, which had implied signals could return a value (the model drops it).
  • Operation and Signal now require a name.
  • Enum value documented as all-or-nothing auto-numbering (matches pkg/model/enum.go): set values on all members or none.
  • readonly scoped to interface properties only.
  • extends described as technology-neutral inheritance delegated to the template (native : public Base / extends Base); declare only added members. Note: bundled templates don't render extends yet, so it's currently inert.

Housekeeping

  • style: gofmt — formats 9 pre-existing unformatted Go files (no semantic changes).

Verification

  • task schema regenerates the JSON cleanly; only the two schema files changed.
  • go test ./pkg/spec/... ./pkg/model/... ./pkg/idl/... ./pkg/gen/... pass.
  • Real in-repo modules still validate via the CLI check path.
  • gofmt -l clean; go build ./... passes.

Out of scope (follow-ups)

  • Making extends actually emit native inheritance in templates (starting with cpp17), or deciding to deprecate the field.
  • No mechanism keeps the hand-written schema and the hand-written pkg/model structs in sync — they will drift again.

w4bremer added 2 commits June 5, 2026 13:22
Make the ObjectAPI module schema understandable to agents/tools that only
read the schema, and align its descriptions with actual generator behavior.

- Add a top-level model overview: reactive objects (local or remote),
  auto getter/setter/change-signal per property, one-way signals, the
  shared member namespace, and the cross-module import <-> top-level
  imports requirement.
- Correct the primitive type list (remove non-existent int16/float16,
  add bytes and any) to match pkg/model/schema.go.
- Split signals into a dedicated Signal definition (name + params, no
  return) instead of reusing Operation, which had implied a return value.
- Require a name on Operation and Signal.
- Document enum value auto-numbering as all-or-nothing (matches enum.go).
- Scope readonly to interface properties only.
- Describe extends as technology-neutral inheritance delegated to the
  template; note the bundled templates do not currently render it.

JSON regenerated from YAML via `task schema`.
@w4bremer
w4bremer merged commit 4d8f0be into main Jun 5, 2026
6 checks passed
@w4bremer
w4bremer deleted the docs/module-schema-implicit-relations branch June 5, 2026 11:31
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.

1 participant