Clarify implicit relations in the module schema - #219
Merged
Conversation
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`.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
An agent (or any tool) that reads the ObjectAPI module schema through the MCP
specificationSchematool has no way to learn ApiGear's implicit behavior, and several descriptions actively contradicted the generator. SincespecificationCheckonly surfaces JSON-schema errors (semantic rules inpkg/modelemitlog.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.jsonis regenerated viatask schema.Documented implicit relations
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 animporton the type and a top-levelimportsentry.Corrected schema-vs-implementation discrepancies
int16/float16, addedbytesandany(matchespkg/model/schema.go).Signaldefinition (name + params, no return) instead of reusingOperation, which had implied signals could return a value (the model drops it).OperationandSignalnow require aname.valuedocumented as all-or-nothing auto-numbering (matchespkg/model/enum.go): set values on all members or none.readonlyscoped to interface properties only.extendsdescribed as technology-neutral inheritance delegated to the template (native: public Base/extends Base); declare only added members. Note: bundled templates don't renderextendsyet, so it's currently inert.Housekeeping
style: gofmt— formats 9 pre-existing unformatted Go files (no semantic changes).Verification
task schemaregenerates the JSON cleanly; only the two schema files changed.go test ./pkg/spec/... ./pkg/model/... ./pkg/idl/... ./pkg/gen/...pass.gofmt -lclean;go build ./...passes.Out of scope (follow-ups)
extendsactually emit native inheritance in templates (starting with cpp17), or deciding to deprecate the field.pkg/modelstructs in sync — they will drift again.