import { i as DiagnosticsOptions } from "../diagnostics-mftUZI7c.mjs"; import { OpenApiDocument, OperationInfo, ParameterInfo, RequestBodyInfo, ResponseInfo } from "./parser.mjs"; //#region src/openapi/resolve.d.ts /** * Parse and cache an OpenAPI document. Returns the cached parse for the * same object identity. * * Before parsing, the document is run through the version-aware * normalisation pipeline (`normaliseOpenApiSchemas`) so OpenAPI 3.0.x * keywords (`nullable`, `discriminator`, `example`), OpenAPI 3.1.x * `discriminator`, and Swagger 2.0 documents are all converted to * canonical Draft 2020-12 form. The parser and downstream extractors * (`extractRequestBody`, `extractResponses`, etc.) then observe schemas in the * same form `` does, keeping the OpenAPI components on * the same pipeline as the top-level adapter. * * ### Caching and diagnostics * * Normalisation runs at most once per document identity. The full set * of doc-level diagnostics emitted during that single run is captured * into the cache alongside the parsed result. Each caller-supplied * sink receives the captured diagnostics exactly once per cached * entry, no matter how many times `getParsed` is called with that * `(doc, sink)` pair. * * The previous implementation bypassed the cache whenever * `diagnostics` was supplied and re-ran the entire normalisation * pipeline against the new sink. That fired every doc-level * diagnostic once per call, so a parent like `ApiWebhooks` that * renders `ApiWebhook` per webhook entry caused N-fold emission of a * single real cause. With the new strategy, cardinality stays at one * per real cause regardless of how many child renders share the * sink. * * Strict mode is treated as a per-call invariant — see the internal * `replayCapturedDiagnostics` helper below for the rationale. */ declare function getParsed(doc: Record, diagnostics?: DiagnosticsOptions): OpenApiDocument; /** * Coerce an unknown value to a record, returning `undefined` when the * value is not a plain object. Callers MUST handle the `undefined` case * explicitly — typically by rendering a "doc not an object" diagnostic * and short-circuiting, never by silently substituting `{}`. * * A previous implementation fell back to `{}` for non-objects, which * masked configuration mistakes (passing a string, `null`, an array, or * `undefined` as the OpenAPI document) as an empty document with no * operations. */ declare function toDoc(value: unknown): Record | undefined; /** * Path-Item-level metadata. OpenAPI 3.1 added `summary` and `description` * to Path Item Objects alongside the existing operation-level fields. * Both are plain strings (no Markdown rendering at this layer). */ interface PathItemInfo { summary: string | undefined; description: string | undefined; } /** * Aggregate view of a single OpenAPI operation: the operation itself, * its Path Item Object context, merged parameters, request body, and * responses. Produced by {@link resolveOperation} for rendering and * inspection. */ interface ResolvedOperation { operation: OperationInfo; pathItem: PathItemInfo; parameters: ParameterInfo[]; requestBody: RequestBodyInfo | undefined; responses: ResponseInfo[]; } /** * Resolve an operation from an OpenAPI document by path and method. * Throws if the operation is not found. * * Accepts either a raw document (parsed lazily via {@link getParsed}'s * WeakMap cache) or an already-parsed {@link OpenApiDocument}. Callers * that have a parsed document at hand can pass it directly to avoid * an extra cache lookup; everyone else trusts the cache. * * `diagnostics` is forwarded to {@link getParsed} so normalisation * events surface to the caller's sink exactly once per `(doc, sink)` * pair, no matter how many times this function is called. */ declare function resolveOperation(doc: Record | OpenApiDocument, path: string, method: string, diagnostics?: DiagnosticsOptions): ResolvedOperation; /** * Resolve parameters for an operation. Returns an empty array if none. * * Accepts either a raw document or an already-parsed * {@link OpenApiDocument}. `diagnostics` is forwarded to * {@link getParsed} so normalisation events surface to the caller's * sink. */ declare function resolveParameters(doc: Record | OpenApiDocument, path: string, method: string, diagnostics?: DiagnosticsOptions): ParameterInfo[]; /** * Resolve the request body for an operation. Returns `undefined` if * the operation declares no request body. * * Accepts either a raw document or an already-parsed * {@link OpenApiDocument}. `diagnostics` is forwarded to * {@link getParsed} so normalisation events surface to the caller's * sink. */ declare function resolveRequestBody(doc: Record | OpenApiDocument, path: string, method: string, diagnostics?: DiagnosticsOptions): RequestBodyInfo | undefined; /** * Resolve a specific response by status code. Throws if not found. * * Accepts either a raw document or an already-parsed * {@link OpenApiDocument}. `diagnostics` is forwarded to * {@link getParsed} so normalisation events surface to the caller's * sink. */ declare function resolveResponse(doc: Record | OpenApiDocument, path: string, method: string, statusCode: string, diagnostics?: DiagnosticsOptions): ResponseInfo; /** * Resolve all responses for an operation. * * Accepts either a raw document or an already-parsed * {@link OpenApiDocument}. `diagnostics` is forwarded to * {@link getParsed} so normalisation events surface to the caller's * sink. */ declare function resolveResponses(doc: Record | OpenApiDocument, path: string, method: string, diagnostics?: DiagnosticsOptions): ResponseInfo[]; //#endregion export { PathItemInfo, ResolvedOperation, getParsed, resolveOperation, resolveParameters, resolveRequestBody, resolveResponse, resolveResponses, toDoc };