MCPcopy Create free account
hub / github.com/OpenHands/OpenHands / getValidationField

Function getValidationField

src/utils/api-error-message.ts:22–26  ·  view source on GitHub ↗

The last string segment of a validation error's `loc`, e.g. the field.

(loc: unknown)

Source from the content-addressed store, hash-verified

20
21/** The last string segment of a validation error's `loc`, e.g. the field. */
22function getValidationField(loc: unknown): string | null {
23 if (!Array.isArray(loc)) return null;
24 const field = [...loc].reverse().find((part) => typeof part === "string");
25 return typeof field === "string" && field ? field : null;
26}
27
28/**
29 * Join the `msg` fields of a FastAPI/Pydantic validation `detail` array

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected