/**
* Validate a parsed API response against the OpenAPI schema the committed
* `spec/openapi.json` declares for it.
*
* Deliberately small: it checks the properties that actually catch drift
* between the spec and what the API returns — declared types, `required`
* keys, `enum`/`const` membership, `oneOf` alternatives, and — because
* every object in this spec is `additionalProperties: false` — fields the
* server sends that the schema does not list. Anything it does not
* understand it passes.
*/
import type { MethodKey } from './types.js';
export type Schema = Readonly<{
type?: string | readonly string[];
properties?: Readonly<Record<string, Schema>>;
required?: readonly string[];
items?: Schema;
enum?: readonly unknown[];
const?: unknown;
oneOf?: readonly Schema[];
additionalProperties?: boolean | Schema;
}>;
type MediaTypes = Readonly<Record<string, Readonly<{
schema?: Schema;
}>>>;
type Responses = Readonly<Record<string, Readonly<{
content?: MediaTypes;
}>>>;
export type OpenApiSpec = Readonly<{
paths?: Readonly<Record<string, Readonly<Partial<Record<MethodKey, Readonly<{
responses?: Responses;
}>>>>>>;
}>;
/**
* Problems found validating VALUE against SCHEMA, as human-readable
* strings; empty when the response conforms. PATH prefixes each message so
* a problem can be located in a nested body.
*/
export declare const check: (schema: Schema | undefined, value: unknown, path?: string) => readonly string[];
/** The schema SPEC declares for METHOD PATH's STATUS response, or undefined when it documents no JSON body. */
export declare const responseSchema: (spec: OpenApiSpec, method: MethodKey, path: string, status: number) => Schema | undefined;
export {};