Skip to content

fix: reject capability input schemas that exclude objects - #2

Merged
Balanov merged 1 commit into
Balanov:mainfrom
ShahadatTest:fix/capability-object-schema
Nov 15, 2026
Merged

Balanov merged 1 commit into
Balanov:mainfrom
ShahadatTest:fix/capability-object-schema

Conversation

@ShahadatTest

Copy link
Copy Markdown
Contributor

Card validation now checks the declared input schema type directly. Non-object types produce invalid_card with the capability ID and declared type. An omitted type and unions containing object remain accepted.

Fixes #1.

Validation on Linux/Node 24: all 33 tests passed. The three rejection regressions failed before the change. node --check, the six-step local demo, and npm run bench completed. The benchmark measurements were retained as local validation artifacts.

OpenAI Codex assisted with implementation, review, and validation.

@Balanov Balanov left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Thank you for this, and for replacing the string match on an error message with a check of the declared type. The old check could not fire: it looked for "must be object" in the error produced by validating {}, and that error only appears for a type that already matches {}. Reading the declared type is the fix, and your error names the capability id and the type, so a provider can correct the card without guessing.

The union case is handled the way the spec needs it: a type array that contains object stays valid, an omitted type stays valid, and SPEC.md now says the same thing the code does.

Merging this. It ships in the next release.

@Balanov
Balanov merged commit aea0f8a into Balanov:main Nov 15, 2026
5 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.

Refuse a card whose capability input schema is not an object schema

2 participants