{"record":{"id":"96471f540653c764","repo":"vectordotdev/vector","slug":"encountered-schema-with-subschema-validation-that-wasn-t-one","errorCode":null,"errorMessage":"Encountered schema with subschema validation that wasn't one of the supported types: allOf, oneOf, anyOf.","messagePattern":"Encountered schema with subschema validation that wasn't one of the supported types: allOf, oneOf, anyOf\\.","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"lib/vector-config/src/schema/parser/query.rs","lineNumber":285,"sourceCode":"        // with other schema types i.e. `allOf` in conjunction with specifying a `type`.\n        //\n        // Right now, the configuration schema codegen should not actually be emitting anything like\n        // this, so our logic below is written against what we generate, not against what is\n        // technically possible. This _may_ need to change in the future if we end up using any \"X\n        // of\" schema composition mechanisms for richer validation (i.e. sticking special validation\n        // logic in various subschemas under `allOf`, while defining the main data schema via\n        // `type`, etc.)\n        if let Some(subschemas) = self.subschemas.as_ref() {\n            // Of all the possible \"subschema\" validation mechanism, we only support `allOf` and\n            // `oneOf`, based on what the configuration schema codegen will spit out.\n            if let Some(all_of) = subschemas.all_of.as_ref() {\n                return SchemaType::AllOf(all_of.iter().map(schema_to_simple_schema).collect());\n            } else if let Some(one_of) = subschemas.one_of.as_ref() {\n                return SchemaType::OneOf(one_of.iter().map(schema_to_simple_schema).collect());\n            } else if let Some(any_of) = subschemas.any_of.as_ref() {\n                return SchemaType::AnyOf(any_of.iter().map(schema_to_simple_schema).collect());\n            } else {\n                panic!(\n                    \"Encountered schema with subschema validation that wasn't one of the supported types: allOf, oneOf, anyOf.\"\n                );\n            }\n        }\n\n        if let Some(instance_types) = self.instance_type.as_ref() {\n            return match instance_types {\n                SingleOrVec::Single(single) => SchemaType::Typed(OneOrMany::One(*single.clone())),\n                SingleOrVec::Vec(many) => SchemaType::Typed(OneOrMany::Many(many.clone())),\n            };\n        }\n\n        if let Some(const_value) = self.const_value.as_ref() {\n            return SchemaType::Constant(const_value);\n        }\n\n        if let Some(enum_values) = self.enum_values.as_ref() {\n            return SchemaType::Enum(enum_values);","sourceCodeStart":267,"sourceCodeEnd":303,"githubUrl":"https://github.com/vectordotdev/vector/blob/bdb87aeaa4c4ff27c0ba643c1c77b21bf2ef4013/lib/vector-config/src/schema/parser/query.rs#L267-L303","documentation":"The schema query parser (`schema_type` in lib/vector-config/src/schema/parser/query.rs) classifies a schema node by inspecting `subschemas`. If a subschema validation keyword is present but it is none of `all_of`, `one_of`, or `any_of` (e.g. `not`, `if`/`then`/`else` from a JSON Schema input), the parser does not know how to represent it and panics. This guards a parser invariant: only the three supported combinators are expected in schemas processed by this query API.","triggerScenarios":"Calling the schema query/lookup APIs on a parsed schema whose `subschemas` field contains an unsupported combinator keyword (anything other than allOf/oneOf/anyOf, e.g. `not`), causing the `else` branch panic at lib/vector-config/src/schema/parser/query.rs:285.","commonSituations":"Feeding externally authored JSON Schema documents (with `not`/`if`/`then`) into Vector's schema query tooling; a schema-producing library emitting newer JSON Schema keywords; hand-edited generated schema files loaded by the docs/query tooling.","solutions":["Rewrite the schema to use only allOf/oneOf/anyOf combinators (e.g. replace `not` with an equivalent enumeration of allowed values)","Strip unsupported subschema keywords before passing the schema to the query parser","Upgrade/patch the schema parser to handle the additional keyword if you control the tooling"],"exampleFix":"// before\n{ \"not\": { \"enum\": [\"a\"] } }\n// after\n{ \"anyOf\": [ { \"type\": \"string\", \"not-enum-placeholder\": true } ] }\n// or express allowed values directly:\n{ \"enum\": [\"b\", \"c\"] }","handlingStrategy":"type-guard","validationCode":"// Before querying, verify only supported combinators are present:\nfn has_only_supported_subschemas(schema: &serde_json::Value) -> bool {\n    schema.get(\"subschemas\").map_or(true, |s| {\n        [\"allOf\", \"oneOf\", \"anyOf\"].iter().all(|k| s.get(k).is_none() || s.get(k).is_some())\n            && !s.as_object().map_or(false, |o| {\n                o.keys().any(|k| !matches!(k.as_str(), \"allOf\" | \"oneOf\" | \"anyOf\"))\n            })\n    })\n}","typeGuard":"fn is_supported_combinator(key: &str) -> bool {\n    matches!(key, \"allOf\" | \"oneOf\" | \"anyOf\")\n}","tryCatchPattern":null,"preventionTips":["Normalize external JSON Schemas to allOf/oneOf/anyOf before ingestion","Validate schema inputs with a JSON Schema meta-validator that flags `not`/`if`/`then`/`else`","Keep generated schemas produced by vector-config itself rather than hand-editing them"],"tags":["rust","json-schema","parser"],"backgroundTag":"unsupported-operation","analyzedSha":"bdb87aeaa4c4ff27c0ba643c1c77b21bf2ef4013","analyzedAt":"2026-09-16T02:53:35.741Z","contentChangedAt":"2026-09-16T02:53:35.741Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}