fix(config): add explicit type: object when setting unevaluatedProperties#25174
fix(config): add explicit type: object when setting unevaluatedProperties#25174pront wants to merge 1 commit intovectordotdev:masterfrom
Conversation
…perties` When `mark_schema_closed` sets `unevaluatedProperties: false` on a schema that uses subschema validation (allOf/oneOf/anyOf) without an explicit `type` at that level, validators like Ajv in strict mode reject it because object-level keywords require `"type": "object"`. This adds `"type": "object"` to the schema when `instance_type` is unset and `unevaluatedProperties` is being applied, improving compatibility with strict JSON Schema validators. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1e2cc88cc8
ℹ️ 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".
| if schema.instance_type.is_none() { | ||
| schema.instance_type = Some(SingleOrVec::Single(Box::new(InstanceType::Object))); |
There was a problem hiding this comment.
Avoid forcing object type for every marked subschema wrapper
This assignment makes mark_schema_closed unconditionally add "type": "object" whenever a schema lacks instance_type, but visit_schema_object invokes mark_schema_closed for any schema with allOf/oneOf/anyOf children (not just object-only unions). In cases like nullable unions (for example oneOf with a null branch and a referenced object branch), this narrows the parent schema to objects and incorrectly rejects valid non-object alternatives, changing validation semantics for generated schemas.
Useful? React with 👍 / 👎.
Summary
mark_schema_closedsetsunevaluatedProperties: falseon schemas using subschema validation (allOf/oneOf/anyOf) without an explicittype, strict JSON Schema validators (e.g. Ajv) reject the schema"type": "object"to the schema'sinstance_typewhen it is unset, improving compatibility with strict validatorsTest plan
"type": "object"adds_type_object_when_missing_and_unevaluated_properties_is_setunevaluatedvisitor tests passunevaluatedProperties/strictTypescheck🤖 Generated with Claude Code