Skip to content

Commit 9a3ead9

Browse files
Maksym Trofimenkoclaude
andcommitted
fix: return empty object for configurable fields without type in simulation
When a schema has `configurable: true` but no explicit type (like `type Context any`), return an empty object `{}` instead of `null` during data simulation. This fixes the LLM tools `get_node_port_schema` returning `context: null` for downstream ports when the Context field hasn't been extended with a schema yet. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 7fcbf00 commit 9a3ead9

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

pkg/jsonschemagenerator/generator.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,17 @@ func (se *JSONSchemaBasedDataGenerator) Generate(node *ajson.Node, clb Callback)
7676

7777
switch typ {
7878
case "":
79-
// empty schema - nil
79+
// empty schema - check for default value first
80+
if d, _ := node.GetKey("default"); d != nil {
81+
return d.Unpack()
82+
}
83+
// check if configurable (can hold any user-defined data)
84+
configurable, _ := GetStrKey("configurable", node)
85+
if configurable == "true" {
86+
// Configurable fields without type should return empty object, not null
87+
// This represents "user can configure this to any value"
88+
return map[string]interface{}{}, nil
89+
}
8090
return nil, nil
8191
case "string", "number", "integer":
8292
return getDefaultValue(typ, node)

0 commit comments

Comments
 (0)