import { ApiTraffic } from '../traffic/types'; import { OpenAPIDiffingQuestions } from '../read/types'; import { FieldLocation, OpenAPIV3 } from '@useoptic/openapi-utilities'; import { JsonSchemaKnownKeyword } from './differs/json-schema-json-diff/plugins/plugin-types'; import { JsonSchemaJsonDiffer } from './differs/json-schema-json-diff/types'; import { JsonPath } from '@useoptic/openapi-io'; export interface IDiffService { compare(traffic: ApiTraffic): Promise<{ diffs: IDiff[]; errors: string[]; }>; jsonSchemaDiffer: JsonSchemaJsonDiffer; } export declare type DiffServiceFactoryFunction = (spec: OpenAPIDiffingQuestions) => IDiffService; export declare enum DiffType { UnmatchedPath = "UnmatchedPath", UnmatchedMethod = "UnmatchedMethod", UnmatchedResponse = "UnmatchedResponse", BodyAdditionalProperty = "BodyAdditionalProperty", BodyMissingRequiredProperty = "BodyMissingRequiredProperty", BodyUnmatchedType = "BodyUnmatchedType", QueryAdditionalParameter = "QueryAdditionalParameter" } export interface IDiff { type: DiffType; } export interface UnmatchedPath extends IDiff { type: DiffType.UnmatchedPath; path: string; method: OpenAPIV3.HttpMethods; closestMatch: string; } export interface UnmatchedMethod extends IDiff { type: DiffType.UnmatchedMethod; path: string; method: OpenAPIV3.HttpMethods; } export interface UnmatchedResponse extends IDiff { type: DiffType.UnmatchedResponse; path: string; method: OpenAPIV3.HttpMethods; statusCode: string; } export interface QueryAdditionalParameter extends IDiff { type: DiffType.QueryAdditionalParameter; path: string; name: string; method: OpenAPIV3.HttpMethods; example: any; } export interface BodyAdditionalProperty extends IDiff { type: DiffType.BodyAdditionalProperty; propertyExamplePath: JsonPath; parentObjectPath: JsonPath; key: string; example: any; propertyPath: JsonPath; keyword: JsonSchemaKnownKeyword.additionalProperties; schemaPath: JsonPath; instancePath: JsonPath; location: FieldLocation; } export interface BodyMissingRequiredProperty extends IDiff { type: DiffType.BodyMissingRequiredProperty; keyword: JsonSchemaKnownKeyword.required; parentObjectPath: JsonPath; propertyPath: JsonPath; key: string; schemaPath: JsonPath; instancePath: JsonPath; location: FieldLocation; } export interface BodyPropertyUnmatchedType extends IDiff { type: DiffType.BodyUnmatchedType; keyword: JsonSchemaKnownKeyword.type | JsonSchemaKnownKeyword.oneOf; propertyPath: JsonPath; key: string; example: any; schemaPath: JsonPath; instancePath: JsonPath; location: FieldLocation; } export declare type ShapeDiffTypes = BodyMissingRequiredProperty | BodyAdditionalProperty | BodyPropertyUnmatchedType; declare type DiffKinds = UnmatchedMethod | UnmatchedPath | UnmatchedResponse | QueryAdditionalParameter | ShapeDiffTypes; export interface DiffResult { isMatch: boolean; } export interface MatchedWithContext extends DiffResult { isMatch: true; context: Context; } export interface Matched extends DiffResult { isMatch: true; } export interface Diff extends DiffResult { isMatch: false; diffs: DiffKinds[]; } export interface DiffError extends DiffResult { isMatch: false; error: string; } export interface EitherDiffResult { context: Context; error: string; diffs: DiffKinds[]; isMatch: boolean; isDiff: boolean; } export declare function EitherDiffResult(i: DiffResult): EitherDiffResult; export declare const DiffResult: { match: () => EitherDiffResult; matchWithContext: (context: Context) => EitherDiffResult; diff: (diffs: DiffKinds[]) => EitherDiffResult; error: (error: string) => EitherDiffResult; }; export declare function isSchemaDiff(i: IDiff): boolean; export {}; //# sourceMappingURL=types.d.ts.map