Support nested output schemas in reference validation#401
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2a0e93c30d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| def _coerce_out_param_schema(value: Any) -> Mapping[str, Any]: | ||
| if isinstance(value, Mapping): | ||
| if any(key in value for key in ("type", "properties", "$schema")): | ||
| return value | ||
| properties = {key: _coerce_out_param_schema(item) for key, item in value.items()} | ||
| return {"type": "object", "properties": properties} |
There was a problem hiding this comment.
Treat non-type schema keywords as schemas, not objects
The new _coerce_out_param_schema treats any mapping that lacks type/properties/$schema as a nested object map, which changes the previous behavior for field-level schemas that only use other JSON Schema keywords (e.g., {"enum": [...]}, {"oneOf": [...]}, {"items": {...}}). Those were previously passed through as-is, but now get coerced into {type: object, properties: {enum: ...}}, so reference validation will interpret foo.enum as a property instead of applying the schema to foo. This breaks existing out_params_schema definitions that rely on keyword-only schemas; consider broadening the “already a schema” check to include other JSON Schema keywords.
Useful? React with 👍 / 👎.
Motivation
out_params_schemamappings so that node creation/update checks can validate deeply nested output definitions.Description
_coerce_out_param_schemato coerce nestedout_params_schemaentries into JSON-schema-like objects._schema_from_out_params_schemato use the coercion helper and preserve existing behavior when a full schema (keys liketype,properties, or$schema) is already provided.velvetflow/verification/binding_checks.pyand maintain prior behavior for scalar/fully-specified schemas.Testing
Codex Task