import type { GraphQLType } from 'graphql'; import type { OasSchema } from '../../oas/schema/Schema.js'; import type { OasRef } from '../../oas/ref/Ref.js'; import type { ParseContextType } from '../../context/parseTypes.js'; import type { StackTrail } from '../../context/StackTrail.js'; /** * Args for {@link toFieldSchema}. * * Mirrors the OAS parser convention `{ value, context, stackTrail }` — * the stack trail represents the field's schema-level address (e.g. * `User.posts`, `Query.getUser.return`). Issues recorded inside use * `stackTrail.toString()` for the location string; ref consumers * register via `context.registerRef(stackTrail, typeName)` so the * cross-type invalidation pipeline can prune fields whose target type * fails to parse. */ export type ToFieldSchemaArgs = { type: GraphQLType; context: ParseContextType; stackTrail: StackTrail; }; /** * Converts a GraphQL field type into an `OasSchema | OasRef<'schema'>` * suitable for use inside an `OasObject.properties` slot or as the * `returnType` / argument type of a {@link GqlOperation}. * * Named composite types (objects, inputs, interfaces, unions) become * refs into the registry so cross-type references resolve through the * registry's internal mirror. Scalars and enums are emitted inline * because they don't need to be referenced from anywhere else (their * type info is fully self-contained). * * The function also encodes the GraphQL list-nullability matrix: * `[T]`, `[T!]`, `[T]!`, `[T!]!` each produce different combinations of * `OasArray.nullable` and the inner schema's nullability. */ export declare const toFieldSchema: ({ type, context, stackTrail }: ToFieldSchemaArgs) => OasSchema | OasRef<"schema">;