MCPcopy Create free account
hub / github.com/arktypeio/arktype / ArkIssues

Class ArkIssues

ark/schema/shared/issues.ts:441–523  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

439 }
440 }
441 : class ArkIssues implements StandardSchemaV1.FailureResult, FailureContext {
442 declare _: ArkIssue[]
443 declare _p: PropertyKey[]
444
445 constructor() {
446 this._ = []
447 this._p = []
448 }
449
450 get count(): number {
451 return this._.length
452 }
453
454 get issues(): readonly WrittenIssue[] {
455 return serializableIssues(this._)
456 }
457
458 _e(
459 data: unknown,
460 code: ArkErrorCode,
461 expected?: string,
462 message?: string,
463 text?: SiteContext["text"]
464 ): true | undefined {
465 this._.push({ code, path: this._p.slice(), data, expected, message })
466 if (callsSiteText) text?.(this._[this._.length - 1])
467 return undefined
468 }
469
470 _k(
471 apply: CompactApply,
472 data: unknown,
473 key: PropertyKey,
474 ...missing: MissingText
475 ): boolean | undefined {
476 this._p.push(key)
477 const stops =
478 missing.length && !(key in (data as object)) ?
479 this._e(data, "required", ...missing)
480 : !apply((data as Keyed)[key], this)
481 this._p.pop()
482 return stops
483 }
484
485 get summary(): string {
486 let summary = ""
487 for (const issue of this._)
488 summary += (summary && "\n") + issueLineOf(issue)
489 return summary
490 }
491
492 summaryIn(locale?: unknown): string {
493 refuseLocale(locale)
494 return this.summary
495 }
496
497 // constructed by TraversalError wherever its bundle keeps the
498 // class: otherwise an Error with the same name, message and

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected