Skip to content

fix(config): add explicit type: object when setting unevaluatedProperties#25174

Draft
pront wants to merge 1 commit intovectordotdev:masterfrom
pront:pront/fix-root-schema-missing-type-object
Draft

fix(config): add explicit type: object when setting unevaluatedProperties#25174
pront wants to merge 1 commit intovectordotdev:masterfrom
pront:pront/fix-root-schema-missing-type-object

Conversation

@pront
Copy link
Copy Markdown
Member

@pront pront commented Apr 13, 2026

Summary

  • When mark_schema_closed sets unevaluatedProperties: false on schemas using subschema validation (allOf/oneOf/anyOf) without an explicit type, strict JSON Schema validators (e.g. Ajv) reject the schema
  • This adds "type": "object" to the schema's instance_type when it is unset, improving compatibility with strict validators
  • Discovered while updating Vector's schema in SchemaStore

Test plan

  • Updated existing test expectations for schemas that gain "type": "object"
  • Added new test adds_type_object_when_missing_and_unevaluated_properties_is_set
  • All 11 unevaluated visitor tests pass
  • Verified the generated schema passes Ajv 2019-09 strict mode for the unevaluatedProperties/strictTypes check

🤖 Generated with Claude Code

…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>
@pront pront requested a review from a team as a code owner April 13, 2026 13:30
@pront pront marked this pull request as draft April 13, 2026 13:30
@pront pront added no-changelog Changes in this PR do not need user-facing explanations in the release changelog domain: schemas Anything related to internal Vector event schemas labels Apr 13, 2026
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines +516 to +517
if schema.instance_type.is_none() {
schema.instance_type = Some(SingleOrVec::Single(Box::new(InstanceType::Object)));
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

domain: schemas Anything related to internal Vector event schemas no-changelog Changes in this PR do not need user-facing explanations in the release changelog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant