UNPKG

@omnigraph/openapi

Version:
46 lines (45 loc) 1.68 kB
import type { OpenAPIV2, OpenAPIV3 } from 'openapi-types'; import type { Logger, MeshFetch } from '@graphql-mesh/types'; import type { JSONSchemaOperationConfig, OperationHeadersConfiguration } from '@omnigraph/json-schema'; import type { SelectQueryOrMutationFieldConfig } from './types.cjs'; export interface HATEOASConfig { /** * @default "rel" */ linkNameIdentifier: string; /** * @default "href" */ linkPathIdentifier: string; /** * @default "_links" */ linkObjectIdentifier: string; /** * @default "x-links" */ linkObjectExtensionIdentifier: string; } interface GetJSONSchemaOptionsFromOpenAPIOptionsParams { source: OpenAPIV3.Document | OpenAPIV2.Document | string; fallbackFormat?: 'json' | 'yaml' | 'js' | 'ts'; cwd?: string; fetch?: MeshFetch; endpoint?: string; schemaHeaders?: Record<string, string>; operationHeaders?: OperationHeadersConfiguration; queryParams?: Record<string, any>; selectQueryOrMutationField?: SelectQueryOrMutationFieldConfig[]; logger?: Logger; jsonApi?: boolean; HATEOAS?: Partial<HATEOASConfig> | boolean; } export declare function getJSONSchemaOptionsFromOpenAPIOptions(name: string, { source, fallbackFormat, cwd, fetch: fetchFn, endpoint, schemaHeaders, operationHeaders, queryParams, selectQueryOrMutationField, logger, jsonApi, HATEOAS, }: GetJSONSchemaOptionsFromOpenAPIOptionsParams): Promise<{ operations: JSONSchemaOperationConfig[]; endpoint: string; cwd: string; fetch: MeshFetch; schemaHeaders: Record<string, string>; operationHeaders: OperationHeadersConfiguration; }>; export {};