arktypea
arktype10mo ago
Kuba

Stanard Schema issues conformance

Hello! As I've been playing with Tanstack Start, it seems that there's an issue with how Arktype handles issues.

Standard Schema defines, that issues should look like this:
/** The result interface if validation fails. */
export interface FailureResult {
  /** The issues of failed validation. */
  readonly issues: ReadonlyArray<Issue>;
}

/** The issue interface of the failure output. */
export interface Issue {
  /** The error message of the issue. */
  readonly message: string;
  /** The path of the issue, if any. */
  readonly path?: ReadonlyArray<PropertyKey | PathSegment> | undefined;
}

/** The path segment interface of the issue. */
export interface PathSegment {
  /** The key representing a path segment. */
  readonly key: PropertyKey;
}

However, arktype puts it's own errors in the issues, that do not conform to the above interfaces. It's troubling as serialization with JSON.stringify fails, as the ArkError seems to have circular reference to itself.

Of course, validation was performed by invoking schema['~standard'].validate(value).

CC: @Manuel Schiller
image.png
Was this page helpful?