import type { OpenAPIV3 } from 'openapi-types'; import type { ParseContextType } from '../context/parseTypes.js'; import type { StackTrail } from '../context/StackTrail.js'; /** Whether one of the members of an `anyOf` is only `null`. */ export declare const hasNullMember: (members: readonly object[]) => boolean; /** Follows a reference to the schema it names, as the parsers' `GetRefFn` does. */ type GetRefFn = (ref: OpenAPIV3.ReferenceObject) => OpenAPIV3.SchemaObject; /** Arguments for {@link isUnknownAnyOf}. */ type IsUnknownAnyOfArgs = { /** The `anyOf` members, as the document writes them. */ members: readonly (OpenAPIV3.ReferenceObject | OpenAPIV3.SchemaObject)[]; /** `client.json` `system.anyOf`. A test's mock context may have none. */ setting: 'union' | 'unknown' | undefined; getRef: GetRefFn; }; /** * Whether `system.anyOf: unknown` reads an `anyOf` as any value, as * Cloudflare's `cf` reads it: when it has two or more members, not counting a * `null` one, and one of them is not a single value. * * - An `anyOf` with one member is read as before, so `anyOf: [{ $ref }, { * type: 'null' }]` stays a nullable reference. * - An `anyOf` of single values stays a union (`string | number`): cf gives * it one flag. */ export declare const isUnknownAnyOf: ({ members, setting, getRef }: IsUnknownAnyOfArgs) => boolean; /** Arguments for {@link withoutUnknownAnyOf}. */ type WithoutUnknownAnyOfArgs = { schema: OpenAPIV3.SchemaObject; /** `client.json` `system.anyOf`. */ setting: 'union' | 'unknown' | undefined; getRef: GetRefFn; }; /** * `schema` with its other keywords and without an `anyOf` that * `system.anyOf: unknown` reads as any value ({@link isUnknownAnyOf}), so the * properties next to the `anyOf` stay. A `null` member makes it nullable. Any * other schema is returned as it is. */ export declare const withoutUnknownAnyOf: ({ schema, setting, getRef }: WithoutUnknownAnyOfArgs) => OpenAPIV3.SchemaObject; /** * Whether the keywords that are left when an `anyOf` is read as any value * ({@link withoutUnknownAnyOf}) give the schema a shape of its own: * `properties` next to the `anyOf` do. A `default`, an `example` or a * `format` alone does not. The parser must not guess a type from them, as it * does for a schema that has no type (`MISSING_STRING_TYPE`): the members * were the type, and they are gone. */ export declare const hasShapeKeyword: (schema: object) => boolean; /** Arguments for {@link logUnknownAnyOf}. */ type LogUnknownAnyOfArgs = { /** The trail of the schema whose `anyOf` was read as any value. */ stackTrail: StackTrail; parent: unknown; context: ParseContextType; }; /** Arguments for {@link logMergedUnknownAnyOf}. */ type LogMergedUnknownAnyOfArgs = LogUnknownAnyOfArgs & { /** The merge's `system`: `unknown` holds `anyOf` when the merge read one as any value. */ system: { unknown: Set; }; }; /** One warning for a schema whose merge read an `anyOf` as any value. Nothing when it read none. */ export declare const logMergedUnknownAnyOf: ({ system, stackTrail, parent, context }: LogMergedUnknownAnyOfArgs) => void; /** One warning for a schema whose `anyOf` was read as any value (`system.anyOf: unknown`). */ export declare const logUnknownAnyOf: ({ stackTrail, parent, context }: LogUnknownAnyOfArgs) => void; export {};