Skip to main content

Module input_schema

Module input_schema 

Source
Expand description

Derive a JSON Schema for a verb’s parameters from its own ParamDef list.

help publishes params[].type as a documentation string. Every machine bridge parses it as a JSON Schema type, and several of the spellings in use are not schema types: uuid names a format, array names no element type, and object or array of object is a union. A driver that cannot read a verb’s parameter types cannot call it, and only the git pack publishes a hand-authored input_schema to read instead.

The duplicate spellings this module used to absorb are gone: one type is written one way, and the registry-wide test in kkernel asserts the exact set. The map below therefore has one arm per spelling, and adding an alternation to an arm is the shape to refuse, because it lets a second spelling of an existing type back in without anything failing.

This module closes that by deriving a schema from the declarations the runtime already holds. A pack-supplied input_schema still wins, so the hand-authored ones are untouched; every other verb gains a derived one. params[].type is left exactly as it is: it is documentation, and uuid carries information a bare schema type does not.

Functions§

derive_input_schema
Build the input_schema object for one verb’s parameter list.
json_schema_type
Map one declared param_type spelling onto a JSON Schema fragment.