@ply-ct/ply
Version:
REST API Automated Testing
58 lines (57 loc) • 1.99 kB
TypeScript
import { OpenApi, Operation, Media } from './openapi';
import { PlyEndpointMeta } from './apidocs';
import { Log } from '../log';
export interface EndpointMethod {
file: string;
class: string;
name: string;
path: string;
method: 'get' | 'post' | 'put' | 'patch' | 'delete';
lastSegmentOptional?: boolean;
}
export interface PlyexOptions {
tsConfig?: string;
sourcePatterns?: string[];
addMissingOperations?: boolean;
/**
* Overwrite existing summaries, operationIds, descriptions, examples and code samples.
*/
overwrite?: boolean;
/**
* Add operations summaries/descripts for endpoint methods not tagged with @ply.
*/
includeUntagged?: boolean;
/**
* Request/response samples from actual results instead of expected.
*/
samplesFromActual?: boolean;
}
export declare const defaultOptions: PlyexOptions;
export declare class Plyex {
readonly plugin: string;
readonly logger: Log;
readonly options: PlyexOptions;
private ts;
private jsDocReaders;
constructor(plugin: string, logger: Log, options?: PlyexOptions);
getPluginEndpointMethods(): EndpointMethod[];
augment(openApi: OpenApi, endpointMethods?: EndpointMethod[]): Promise<OpenApi>;
doAugment(openApi: OpenApi, endpointMethods: EndpointMethod[]): Promise<OpenApi>;
operation(endpointMethod: EndpointMethod): Operation;
examples(endpointMethod: EndpointMethod, operation: Operation, plyEndpointMeta: PlyEndpointMeta): void;
schemaType(jsonPayload: Media): string;
codeSamples(operation: Operation, endpointMethod: EndpointMethod, schemaType: string, example: any): void;
typeName(schemaType: string): string;
/**
* Crude pluralization -- override with jsdoc
*/
private pluralize;
private capitalize;
private uncapitalize;
private epm;
private example;
private cleanupJson;
}
export interface PlyexPlugin {
getEndpointMethods(): EndpointMethod[];
}