Skip to content
API reference

openapi

Import
import * as api from "@fungi.computer/forage/openapi";
Kind Export Description
class OpenApiError A bounded intake refusal, distinct from a listed unsupported operation.
type alias OpenApiThirdPartyText Bounded provider-authored text. Hosts must frame it as data, never instructions.
type alias OpenApiIntakeOptions Optional owner-declared credential parameter excluded from guest input.
type alias OpenApiRefusalCode Stable intake and per-operation refusal codes.
type alias OpenApiOperation Decoded normalized operation ready for selection, not an execution grant.
type alias OpenApiPreviewOperation An operation’s supported call shape or bounded unsupported reason.
constant openApiOperationSchema One stored operation, independent of spec-host URLs or credentials.
function normalizeOpenApi() Pure intake: the host supplies bounded spec text, never a fetch locator.
function parseOpenApiTable() Decode selected operations before persistence or execution; no authority is granted.

A bounded intake refusal, distinct from a listed unsupported operation.

  • Error
Signature
new OpenApiError(
code,
message,
cause?
): OpenApiError;
Parameter Type
code OpenApiRefusalCode
message string
cause? unknown

OpenApiError

Signature
Error.constructor;
Signature
readonly name: "OpenApiError" = "OpenApiError";
Signature
Error.name;
Signature
readonly code: OpenApiRefusalCode;

OpenApiThirdPartyTexttype alias

Section titled “OpenApiThirdPartyText”
Signature
type OpenApiThirdPartyText = string & z.BRAND<"ThirdPartyText">;

Bounded provider-authored text. Hosts must frame it as data, never instructions.


OpenApiIntakeOptionstype alias

Section titled “OpenApiIntakeOptions”
Signature
type OpenApiIntakeOptions = object;

Optional owner-declared credential parameter excluded from guest input.

Signature
optional authParameter?: object;
Signature
in: "header" | "query";
Signature
name: string;

OpenApiRefusalCodetype alias

Section titled “OpenApiRefusalCode”
Signature
type OpenApiRefusalCode =
| "too_large"
| "invalid_spec"
| "not_openapi3"
| "nodes_limit"
| "depth_limit"
| "alias_limit"
| "external_reference"
| "recursive_schema"
| "operations_limit"
| "invalid_operation"
| "unsupported_schema"
| "parameter_collision"
| "unsafe_auth_parameter"
| "unsafe_header"
| "unsupported_parameter"
| "unsupported_media"
| "unsupported_path_item"
| "unsupported_method"
| "table_too_large"
| "invalid_table"
| "unsafe_name"
| "unsafe_path";

Stable intake and per-operation refusal codes.


OpenApiOperationtype alias

Section titled “OpenApiOperation”
Signature
type OpenApiOperation = z.output<typeof openApiOperationSchema>;

Decoded normalized operation ready for selection, not an execution grant.


OpenApiPreviewOperationtype alias

Section titled “OpenApiPreviewOperation”
Signature
type OpenApiPreviewOperation =
| OpenApiOperation
| {
status: "unsupported";
name: string;
method: string;
path: string;
reason: OpenApiRefusalCode;
};

An operation’s supported call shape or bounded unsupported reason.

openApiOperationSchemaconstant

Section titled “openApiOperationSchema”
Signature
const openApiOperationSchema: ZodObject<
{
status: ZodLiteral<"supported">;
name: ZodString;
method: ZodEnum<{
GET: "GET";
HEAD: "HEAD";
OPTIONS: "OPTIONS";
POST: "POST";
PUT: "PUT";
PATCH: "PATCH";
DELETE: "DELETE";
}>;
path: ZodString;
effect: ZodEnum<{
write: "write";
read: "read";
}>;
description: $ZodBranded<ZodString, "ThirdPartyText", "out">;
textSource: ZodLiteral<"third_party">;
tags: ZodArray<$ZodBranded<ZodString, "ThirdPartyText", "out">>;
parameters: ZodArray<
ZodObject<
{
name: ZodLazy<ZodString>;
in: ZodEnum<{
header: "header";
path: "path";
query: "query";
}>;
required: ZodDefault<ZodBoolean>;
schema: ZodUnion<
readonly [ZodRecord<ZodString, ZodJSONSchema>, ZodBoolean]
>;
style: ZodOptional<ZodString>;
explode: ZodOptional<ZodBoolean>;
allowReserved: ZodOptional<ZodBoolean>;
},
$strip
>
>;
input: ZodPipe<
ZodUnknown,
ZodType<
boolean | Record<string, JSONType>,
unknown,
$ZodTypeInternals<boolean | Record<string, JSONType>, unknown>
>
>;
output: ZodPipe<
ZodUnknown,
ZodType<
boolean | Record<string, JSONType>,
unknown,
$ZodTypeInternals<boolean | Record<string, JSONType>, unknown>
>
>;
},
$strict
>;

One stored operation, independent of spec-host URLs or credentials.

normalizeOpenApi()function

Section titled “normalizeOpenApi()”
Signature
function normalizeOpenApi(
source,
options?,
): Promise<{
title: string & $brand<"ThirdPartyText">;
version: string;
servers: string[];
authHints: (
| {
scheme: string;
kind: "api_key_header" | "api_key_query";
name: string;
}
| {
scheme: string;
kind: "bearer" | "oauth" | "unsupported";
}
)[];
operations: OpenApiPreviewOperation[];
tableDigest: string;
}>;

Pure intake: the host supplies bounded spec text, never a fetch locator.

Parameter Type
source string
options OpenApiIntakeOptions

Promise<{ title: string & $brand<"ThirdPartyText">; version: string; servers: string[]; authHints: ( | { scheme: string; kind: "api_key_header" | "api_key_query"; name: string; } | { scheme: string; kind: "bearer" | "oauth" | "unsupported"; })[]; operations: OpenApiPreviewOperation[]; tableDigest: string; }>


parseOpenApiTable()function

Section titled “parseOpenApiTable()”
Signature
function parseOpenApiTable(source): Promise<{
operations: object[];
digest: string;
}>;

Decode selected operations before persistence or execution; no authority is granted.

Parameter Type
source unknown

Promise<{ operations: object[]; digest: string; }>