Repository navigation
Add recursive arguments support for object-typed arguments - #33
Conversation
Allow an `arguments` sub-property on any `Argument` whose type includes `object`. This enables typed descriptions of nested object structures instead of a prose-only description. Apply to $rankFusion and $scoreFusion: - input.pipelines: typed as variadic pipeline map - input.normalization ($scoreFusion): typed as string - combination.weights: typed as variadic number map - combination.method / combination.expression ($scoreFusion): typed
There was a problem hiding this comment.
Pull request overview
Adds a way to describe nested structure for object-typed operator arguments by allowing Argument definitions to contain recursive sub-arguments, and applies this to the $rankFusion and $scoreFusion stage specs.
Changes:
- Extend
schemas/operator.jsonArgumentdefinition with an optional recursiveargumentsfield. - Update
$scoreFusionstage definition to provide typed nested fields underinputandcombination. - Update
$rankFusionstage definition to provide typed nested fields underinputandcombination.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| schemas/operator.json | Adds Argument.arguments to enable recursive, typed sub-properties for object arguments. |
| definitions/stage/scoreFusion.yaml | Replaces prose-only object structure docs with typed nested arguments for input/combination. |
| definitions/stage/rankFusion.yaml | Replaces prose-only object structure docs with typed nested arguments for input/combination. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| } | ||
| } | ||
| }, | ||
| "required": ["name", "type"], |
There was a problem hiding this comment.
The schema comment says arguments is only valid when type includes object, but the schema currently allows arguments for any Argument type. Consider enforcing this with an if/then (e.g., if: { properties: { type: { contains: { const: "object" } } } } then: { } else: { not: { required: ["arguments"] } }) so invalid uses are rejected during validation.
| "required": ["name", "type"], | |
| "required": ["name", "type"], | |
| "if": { | |
| "properties": { | |
| "type": { | |
| "contains": { | |
| "const": "object" | |
| } | |
| } | |
| } | |
| }, | |
| "then": {}, | |
| "else": { | |
| "not": { | |
| "required": ["arguments"] | |
| } | |
| }, |
|
Interesting approach, especially as this looks like it would be backward compatible: any consumer that doesn't support the nested argument syntax yet would simply ignore it and continue allowing generic objects. I'm tempted to think this might just work. |
lerouxb
left a comment
There was a problem hiding this comment.
Looks good to me. In fact it seems like the obvious solution now that I see it. I can't think of how else you'd express this.
Motivation
Object-typed arguments that have named, fixed sub-properties currently have no way to express their structure beyond a prose description. This forces readers and tooling to parse free-form text to understand what fields are accepted.
Change
Add an optional
argumentsproperty to theArgumentdefinition inschemas/operator.json. When an argument's type includesobject, it may list its sub-properties as typedArgumententries — recursively, since sub-arguments can themselves be objects with their ownarguments.Backward compatibility
The new
argumentsfield is optional. All existing definitions remain valid.