sanity
Version:
Sanity is a real-time content infrastructure with a scalable, hosted backend featuring a Graph Oriented Query Language (GROQ), asset pipelines and fast edge caches
19 lines (15 loc) • 420 B
text/typescript
import {type SchemaValidationProblemPath} from '@sanity/types'
export function renderPath(path: SchemaValidationProblemPath) {
return path
.map((segment) => {
if (segment.kind === 'type') {
return `${segment.name || '<unnamed>'}(${segment.type})`
}
if (segment.kind === 'property') {
return segment.name
}
return null
})
.filter(Boolean)
.join(' > ')
}