@beignet/core
Version:
Core framework primitives for Beignet
37 lines • 1.3 kB
TypeScript
/**
* Internal schema shape helpers shared by server route registration and
* OpenAPI generation.
*
* These helpers are intentionally zod-free: zod is an optional peer
* dependency, so shape extraction duck-types Zod's `_def.shape` internals and
* returns undefined for schemas it cannot introspect. This module is not
* exported from the package index.
*/
/**
* Extract the field shape (field name → field schema) from an object schema.
*
* Returns undefined when the schema is not an introspectable object schema,
* for example a non-Zod Standard Schema.
*/
export declare function getObjectSchemaShape(schema: unknown): Record<string, unknown> | undefined;
/**
* Compare a path template's dynamic keys against a pathParams schema shape.
*/
export declare function comparePathParamsToTemplate(args: {
pathKeys: readonly string[];
shapeKeys: readonly string[];
}): {
missingKeys: string[];
extraKeys: string[];
};
/**
* Format a pathParams/template mismatch for error messages.
*
* Shared so server registration and OpenAPI generation report the same
* diagnostic details.
*/
export declare function formatPathParamsMismatch(args: {
missingKeys: readonly string[];
extraKeys: readonly string[];
}): string;
//# sourceMappingURL=schema-shape.d.ts.map