import { MergeInput, ErrorMergeResult, Dispute } from "./data"; import { Swagger } from "@atlassian/atlassian-openapi"; import { SecuritySchemesStrategy } from './security-schemes'; import { Components31, OpenApiDocument, PathItemMap } from './oas31'; export type PathAndComponents = { paths: Swagger.Paths; /** 3.1 only; empty for 3.0 inputs, which cannot declare webhooks. */ webhooks: PathItemMap; components: Components31; /** * The document-level `security` array, first-wins as it has always been -- * but taken from the input AFTER its security-scheme renames were applied. * * It is returned from here rather than read from the untouched inputs in * `index.ts` because only this function knows what got renamed (issue #33). * Reading it upstream produced a document whose top-level requirement named * a scheme that deduplication had since renamed away. */ security?: Swagger.SecurityRequirement[]; }; export type Components = { [key: string]: A; }; export type Equal = (x: A, y: A) => boolean; export type AddModRef = (from: string, to: string) => void; /** * Every deduplicated component type goes through the same machinery. Kept as * one list rather than nine near-identical blocks: the duplication is how * `pathItems` came to be missing when 3.1 support landed, and how the error * return in {@link processComponents} came to be dropped in all nine places. * * Exported (rather than local to {@link mergePathsAndComponents}) so * `external-references.ts` validates a pulled-in `$ref`'s fragment against * exactly the same set of bucket names this function already deduplicates -- * one list, not two that can drift apart. */ export declare const DEDUPLICATED_COMPONENT_TYPES: readonly ['schemas', 'responses', 'parameters', 'examples', 'requestBodies', 'headers', 'links', 'pathItems', 'callbacks']; export declare function processComponents(results: Components, components: Components, areEqual: Equal, dispute: Dispute | undefined, addModifiedReference: AddModRef): ErrorMergeResult | undefined; /** * Merge algorithm: * * Generate reference mappings for the components. Eliminating duplicates. * Generate reference mappings for the paths. * Copy the elements into the new location. * Update all of the paths and components to the new references. * * @param inputs */ export declare function mergePathsAndComponents(inputs: MergeInput, securitySchemesStrategy?: SecuritySchemesStrategy, externalDocuments?: Record): PathAndComponents | ErrorMergeResult; //# sourceMappingURL=paths-and-components.d.ts.map