@redocly/openapi-core
Version:
See https://github.com/Redocly/redocly-cli
54 lines • 2.59 kB
TypeScript
import type { Context as AjvContext } from '@redocly/ajv/dist/2020.js';
import { Location } from '../ref-utils.js';
import type { Oas3Schema, Oas3Tag, Oas3_2Tag, Oas3_1Schema, Referenced } from '../typings/openapi.js';
import type { Oas2Tag } from '../typings/swagger.js';
import type { NonUndefined, UserContext } from '../walk.js';
export declare const resolveSchema: <T extends NonUndefined>(schemaOrRef: Referenced<T> | undefined, ctx: UserContext, resolveFrom?: string) => {
schema: T | undefined;
location: string | undefined;
};
export declare function oasTypeOf(value: unknown): "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function" | "integer" | "array" | "null";
/**
* Checks if value matches specified JSON schema type
*
* @param {*} value - value to check
* @param {JSONSchemaType} type - JSON Schema type
* @returns boolean
*/
export declare function matchesJsonSchemaType(value: unknown, type: string, nullable: boolean): boolean;
export declare function missingRequiredField(type: string, field: string): string;
export declare function missingRequiredOneOfFields(type: string, fields: string[]): string;
export declare function fieldNonEmpty(type: string, field: string): string;
export declare function validateDefinedAndNonEmpty({ fieldName, value, ctx, reference, }: {
fieldName: string;
value: any;
ctx: UserContext;
reference?: string;
}): void;
export declare function validateOneOfDefinedAndNonEmpty({ fieldNames, value, ctx, reference, }: {
fieldNames: string[];
value: any;
ctx: UserContext;
reference?: string;
}): void;
export declare function getSuggest(given: string, variants: string[]): string[];
export declare function validateExample({ example, schema, options, reference, }: {
example: any;
schema: Referenced<Oas3Schema | Oas3_1Schema>;
options: {
location: Location;
ctx: UserContext;
allowAdditionalProperties: boolean;
ajvContext?: AjvContext;
};
reference?: string;
}): void;
export declare function validateSchemaEnumType(schemaEnum: string[], propertyValue: string, propName: string, refLocation: Location | undefined, { report, location }: UserContext): void;
export declare function validateResponseCodes({ responseCodes, codeRange, report, reference, }: {
responseCodes: string[];
codeRange: string;
report: UserContext['report'];
reference?: string;
}): void;
export declare function getTagName(tag: Oas2Tag | Oas3Tag | Oas3_2Tag, ignoreCase: boolean): string;
//# sourceMappingURL=utils.d.ts.map