Nested Schema Titles and Observability: How do I know which nested schema fails in a 300 field schema? #1492
Replies: 1 comment 2 replies
|
Hi @MkEtlingerJH! I'm Dosu and I'm helping the Open Circle team. Short answer: No, Here's why: The What you do get is the Possible workaround: You could build a utility that, given an issue's import { getTitle, getDotPath } from 'valibot';
function getNearestTitle(schema, issue) {
// Walk your schema structure using issue.path segments
// Call getTitle() on each level to find the nearest titled schema
// Return the first title found walking from deepest to shallowest
}This isn't automated today, so you'd need to maintain the traversal logic yourself. Alternatively, you could set custom Your intuition about this being a potential feature request ( To reply, just mention @dosu. Docs are dead. Just use Dosu. |
Uh oh!
There was an error while loading. Please reload this page.
Hey Valibot team!
I am working on a product where our Python backend doesn't have strict typing which means on the frontend I need to do some stuff:
v.title()on all ~50 of the schemas for this objectsafeParseand when there's a validation error, I want to log the failing schemaOur problem is more of an architectural/data issue so I think the right answer is: "stop having a crazy nested schema, and separate/flatten your data domains" but alas, that will take some time to do.
Is it possible to include
getTitle()inside ofresult.issues?I was looking here: https://github.com/open-circle/valibot/blob/main/library/src/utils/_addIssue/_addIssue.ts but I only see references to
(isSchema ? getSchemaMessage(issue.lang) : null).Thanks for any help!
All reactions