Skip to content

Commit ae96d6d

Browse files
iahsmeta-codesync[bot]
authored andcommitted
Add validateBlobWithPaths for detailed validation diagnostics
Summary: Extends the SchemaValidator API to optionally track and report the paths to fields that caused validation failures. The existing `validateBlob` function returns only an enum indicating whether validation passed. This is useful for quick checks but doesn't help diagnose why validation failed. The new `validateBlobWithPaths` function returns a `SchemaValidationResultWithPaths` struct that includes: - `unknownFieldPaths`: Paths to fields present in the blob but not defined in the schema - `mismatchedFieldPaths`: Paths to fields where the wire type doesn't match the expected schema type Path format uses the convention from the `dynamic::Path` class: - `Person.address.city` for nested fields - `Person.__unknown_2` for unknown fields (using field ID) - `Person.items[0]` for list elements - `Person.tags@"key"` for map keys/values Implementation details: - Added `ValidationState` struct to optionally track path state during traversal - Refactored internal functions to accept optional `ValidationState*` parameter - Extracted common logic into `validateBlobImpl` to avoid duplication - Added helper functions `extractTypeName` and `getExpectedTType` for cleaner code Reviewed By: praihan Differential Revision: D90638860 fbshipit-source-id: d7b1f89df2fd370aa2e80c7a7f98247747e65477
1 parent 4d85bf3 commit ae96d6d

2 files changed

Lines changed: 592 additions & 49 deletions

File tree

0 commit comments

Comments
 (0)