-
Notifications
You must be signed in to change notification settings - Fork 14
/
ThenVisitor.ts
30 lines (23 loc) · 1.02 KB
/
ThenVisitor.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import { Mixin } from 'ts-mixer';
import { ArrayElement, Element, BREAK } from '@swagger-api/apidom-core';
import FallbackVisitor, { FallbackVisitorOptions } from '../../FallbackVisitor';
import SpecificationVisitor, { SpecificationVisitorOptions } from '../../SpecificationVisitor';
export interface ThenVisitorOptions extends SpecificationVisitorOptions, FallbackVisitorOptions {}
class ThenVisitor extends Mixin(SpecificationVisitor, FallbackVisitor) {
public declare readonly element: ArrayElement;
constructor(options: ThenVisitorOptions) {
super(options);
this.element = new ArrayElement();
this.element.classes.push('scenario-then');
}
ArrayElement(arrayElement: ArrayElement) {
arrayElement.forEach((item: Element): void => {
const specPath = ['document', 'objects', 'Requirement'];
const element = this.toRefractedElement(specPath, item);
this.element.push(element);
});
this.copyMetaAndAttributes(arrayElement, this.element);
return BREAK;
}
}
export default ThenVisitor;