-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ns-workflows-1): add support for Success Action Object (#3408)
Refs #3392
- Loading branch information
1 parent
66acc1b
commit 28b81ac
Showing
14 changed files
with
328 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
packages/apidom-ns-workflows-1/src/elements/SuccessAction.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import { | ||
ObjectElement, | ||
ArrayElement, | ||
StringElement, | ||
Attributes, | ||
Meta, | ||
} from '@swagger-api/apidom-core'; | ||
|
||
class SuccessAction extends ObjectElement { | ||
constructor(content?: Record<string, unknown>, meta?: Meta, attributes?: Attributes) { | ||
super(content, meta, attributes); | ||
this.element = 'successAction'; | ||
} | ||
|
||
get type(): StringElement | undefined { | ||
return this.get('type'); | ||
} | ||
|
||
set type(type: StringElement | undefined) { | ||
this.set('type', type); | ||
} | ||
|
||
get workflowId(): StringElement | undefined { | ||
return this.get('workflowId'); | ||
} | ||
|
||
set workflowId(workflowId: StringElement | undefined) { | ||
this.set('workflowId', workflowId); | ||
} | ||
|
||
get stepId(): StringElement | undefined { | ||
return this.get('stepId'); | ||
} | ||
|
||
set stepId(stepId: StringElement | undefined) { | ||
this.set('stepId', stepId); | ||
} | ||
|
||
get criteria(): ArrayElement | undefined { | ||
return this.get('criteria'); | ||
} | ||
|
||
set criteria(criteria: ArrayElement | undefined) { | ||
this.set('criteria', criteria); | ||
} | ||
} | ||
|
||
export default SuccessAction; |
13 changes: 13 additions & 0 deletions
13
packages/apidom-ns-workflows-1/src/elements/nces/SuccessActionCriteria.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { ArrayElement, Attributes, Meta } from '@swagger-api/apidom-core'; | ||
|
||
class SuccessActionCriteria extends ArrayElement { | ||
static primaryClass = 'success-action-criteria'; | ||
|
||
constructor(content?: Array<unknown>, meta?: Meta, attributes?: Attributes) { | ||
super(content, meta, attributes); | ||
this.classes.push(SuccessActionCriteria.primaryClass); | ||
this.classes.push('criteria'); | ||
} | ||
} | ||
|
||
export default SuccessActionCriteria; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
.../apidom-ns-workflows-1/src/refractor/visitors/workflows-1/SuccessActionCriteriaVisitor.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import stampit from 'stampit'; | ||
import { ArrayElement, Element, BREAK } from '@swagger-api/apidom-core'; | ||
|
||
import SuccessActionCriteriaElement from '../../../elements/nces/SuccessActionCriteria'; | ||
import SpecificationVisitor from '../SpecificationVisitor'; | ||
import FallbackVisitor from '../FallbackVisitor'; | ||
|
||
const SuccessActionCriteriaVisitor = stampit(SpecificationVisitor, FallbackVisitor, { | ||
init() { | ||
this.element = new SuccessActionCriteriaElement(); | ||
}, | ||
methods: { | ||
ArrayElement(arrayElement: ArrayElement) { | ||
arrayElement.forEach((item: Element): void => { | ||
const specPath = ['document', 'objects', 'Criterion']; | ||
const element = this.toRefractedElement(specPath, item); | ||
|
||
this.element.push(element); | ||
}); | ||
|
||
this.copyMetaAndAttributes(arrayElement, this.element); | ||
|
||
return BREAK; | ||
}, | ||
}, | ||
}); | ||
|
||
export default SuccessActionCriteriaVisitor; |
18 changes: 18 additions & 0 deletions
18
packages/apidom-ns-workflows-1/src/refractor/visitors/workflows-1/success-action/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import stampit from 'stampit'; | ||
import { always } from 'ramda'; | ||
|
||
import SuccessActionElement from '../../../../elements/SuccessAction'; | ||
import FallbackVisitor from '../../FallbackVisitor'; | ||
import FixedFieldsVisitor from '../../generics/FixedFieldsVisitor'; | ||
|
||
const SuccessActionVisitor = stampit(FixedFieldsVisitor, FallbackVisitor, { | ||
props: { | ||
specPath: always(['document', 'objects', 'SuccessAction']), | ||
canSupportSpecificationExtensions: true, | ||
}, | ||
init() { | ||
this.element = new SuccessActionElement(); | ||
}, | ||
}); | ||
|
||
export default SuccessActionVisitor; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.