@typespec/openapi3
Version:
TypeSpec library for emitting OpenAPI 3.0 and OpenAPI 3.1 from the TypeSpec REST protocol binding and converting OpenAPI3 to TypeSpec
48 lines • 2.51 kB
TypeScript
import { BooleanLiteral, IntrinsicScalarName, Model, ModelProperty, NumericLiteral, Program, Scalar, StringLiteral, Type, Value } from "@typespec/compiler";
import { HttpOperation, HttpProperty } from "@typespec/http";
/**
* Checks if two objects are deeply equal.
*
* Does not support cycles. Intended to be used only on plain data that can
* be directly represented in JSON.
*/
export declare function deepEquals(left: unknown, right: unknown): boolean;
export type EqualityComparer<T> = (x: T, y: T) => boolean;
/**
* Check if two arrays have the same elements.
*
* @param equals Optional callback for element equality comparison.
* Default is to compare by identity using `===`.
*/
export declare function arrayEquals<T>(left: T[], right: T[], equals?: EqualityComparer<T>): boolean;
/**
* Check if two maps have the same entries.
*
* @param equals Optional callback for value equality comparison.
* Default is to compare by identity using `===`.
*/
export declare function mapEquals<K, V>(left: Map<K, V>, right: Map<K, V>, equals?: EqualityComparer<V>): boolean;
/**
* Check if argument is not undefined.
*/
export declare function isDefined<T>(arg: T | undefined): arg is T;
export interface SharedHttpOperation {
kind: "shared";
operations: HttpOperation[];
}
export declare function isSharedHttpOperation(operation: HttpOperation | SharedHttpOperation): operation is SharedHttpOperation;
export declare function isStdType(program: Program, type: Type): type is Scalar & {
name: IntrinsicScalarName;
};
export declare function isLiteralType(type: Type): type is StringLiteral | NumericLiteral | BooleanLiteral;
export declare function literalType(type: StringLiteral | NumericLiteral | BooleanLiteral): "number" | "string" | "boolean";
export declare function includeDerivedModel(model: Model): boolean;
export declare function isScalarExtendsBytes(type: Type): boolean;
export declare function getDefaultValue(program: Program, defaultType: Value, modelProperty: ModelProperty): any;
export declare function isBytesKeptRaw(program: Program, type: Type): boolean;
export declare function ensureValidComponentFixedFieldKey(program: Program, type: Type, oldKey: string): string;
export type HttpParameterProperties = Extract<HttpProperty, {
kind: "header" | "query" | "path" | "cookie";
}>;
export declare function isHttpParameterProperty(httpProperty: HttpProperty): httpProperty is HttpParameterProperties;
//# sourceMappingURL=util.d.ts.map