Extract classes to detect the type of specification into the core package
Closed this issue · 0 comments
derevnjuk commented
To reduce the number of duplicates and provide a dedicated way to detect the type of specification we should extract several classes into the new core package.
e.g.
enum ImporterType {
HAR = 'har',
OASV2 = 'oasv2',
OASV3 = 'oasv3',
POSTMAN = 'postman'
}
interface Spec<T> {
readonly type: ImporterType;
readonly doc: T;
readonly name?: string;
}
interface ImportOptions {
readonly mimeType: string;
}
interface Importer {
type: ImporterType;
importSpec(
content: string,
options?: ImportOptions
): Promise<ImportedSpec | undefined>;
}