MCPcopy Create free account
hub / github.com/middleapi/orpc / isSchemaIssue

Function isSchemaIssue

packages/contract/src/schema-utils.ts:4–22  ·  view source on GitHub ↗
(issue: unknown)

Source from the content-addressed store, hash-verified

2import { isPropertyKey, isTypescriptObject } from '@orpc/shared'
3
4export function isSchemaIssue(issue: unknown): issue is SchemaIssue {
5 if (!isTypescriptObject(issue) || typeof issue.message !== 'string') {
6 return false
7 }
8
9 if (issue.path !== undefined) {
10 if (!Array.isArray(issue.path)) {
11 return false
12 }
13
14 if (
15 !issue.path.every(segment => isPropertyKey(segment) || (isTypescriptObject(segment) && isPropertyKey(segment.key)))
16 ) {
17 return false
18 }
19 }
20
21 return true
22}

Callers 2

getIssueMessageFunction · 0.90

Calls 2

isTypescriptObjectFunction · 0.90
isPropertyKeyFunction · 0.90

Tested by

no test coverage detected