-
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 Workflow Object (#3492)
Refs #3392
- Loading branch information
1 parent
c35931d
commit fce4096
Showing
18 changed files
with
447 additions
and
7 deletions.
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
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,66 @@ | ||
import { | ||
ObjectElement, | ||
ArrayElement, | ||
StringElement, | ||
Attributes, | ||
Meta, | ||
} from '@swagger-api/apidom-core'; | ||
|
||
import JSONSchemaElement from './JSONSchema'; | ||
|
||
class Workflow extends ObjectElement { | ||
constructor(content?: Record<string, unknown>, meta?: Meta, attributes?: Attributes) { | ||
super(content, meta, attributes); | ||
this.element = 'workflow'; | ||
} | ||
|
||
get workflowId(): StringElement | undefined { | ||
return this.get('workflowId'); | ||
} | ||
|
||
set workflowId(workflowId: StringElement | undefined) { | ||
this.set('workflowId', workflowId); | ||
} | ||
|
||
get summary(): StringElement | undefined { | ||
return this.get('summary'); | ||
} | ||
|
||
set summary(summary: StringElement | undefined) { | ||
this.set('summary', summary); | ||
} | ||
|
||
get description(): StringElement | undefined { | ||
return this.get('description'); | ||
} | ||
|
||
set description(description: StringElement | undefined) { | ||
this.set('description', description); | ||
} | ||
|
||
get inputs(): JSONSchemaElement | undefined { | ||
return this.get('inputs'); | ||
} | ||
|
||
set inputs(inputs: JSONSchemaElement | undefined) { | ||
this.set('inputs', inputs); | ||
} | ||
|
||
get steps(): ArrayElement | undefined { | ||
return this.get('steps'); | ||
} | ||
|
||
set steps(steps: ArrayElement | undefined) { | ||
this.set('steps', steps); | ||
} | ||
|
||
get outputs(): ObjectElement | undefined { | ||
return this.get('outputs'); | ||
} | ||
|
||
set outputs(outputs: ObjectElement | undefined) { | ||
this.set('outputs', outputs); | ||
} | ||
} | ||
|
||
export default Workflow; |
12 changes: 12 additions & 0 deletions
12
packages/apidom-ns-workflows-1/src/elements/nces/WorkflowOutputs.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,12 @@ | ||
import { ObjectElement, Attributes, Meta } from '@swagger-api/apidom-core'; | ||
|
||
class WorkflowOutputs extends ObjectElement { | ||
static primaryClass = 'workflow-outputs'; | ||
|
||
constructor(content?: Record<string, unknown>, meta?: Meta, attributes?: Attributes) { | ||
super(content, meta, attributes); | ||
this.classes.push(WorkflowOutputs.primaryClass); | ||
} | ||
} | ||
|
||
export default WorkflowOutputs; |
12 changes: 12 additions & 0 deletions
12
packages/apidom-ns-workflows-1/src/elements/nces/WorkflowSteps.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,12 @@ | ||
import { ArrayElement, Attributes, Meta } from '@swagger-api/apidom-core'; | ||
|
||
class WorkflowSteps extends ArrayElement { | ||
static primaryClass = 'workflow-steps'; | ||
|
||
constructor(content?: Array<unknown>, meta?: Meta, attributes?: Attributes) { | ||
super(content, meta, attributes); | ||
this.classes.push(WorkflowSteps.primaryClass); | ||
} | ||
} | ||
|
||
export default WorkflowSteps; |
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
17 changes: 17 additions & 0 deletions
17
packages/apidom-ns-workflows-1/src/refractor/visitors/workflows-1/workflow/OutputsVisitor.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,17 @@ | ||
import stampit from 'stampit'; | ||
import { always } from 'ramda'; | ||
|
||
import MapVisitor from '../../generics/MapVisitor'; | ||
import FallbackVisitor from '../../FallbackVisitor'; | ||
import WorkflowOutputsElement from '../../../../elements/nces/WorkflowOutputs'; | ||
|
||
const OutputsVisitor = stampit(MapVisitor, FallbackVisitor, { | ||
props: { | ||
specPath: always(['value']), | ||
}, | ||
init() { | ||
this.element = new WorkflowOutputsElement(); | ||
}, | ||
}); | ||
|
||
export default OutputsVisitor; |
28 changes: 28 additions & 0 deletions
28
packages/apidom-ns-workflows-1/src/refractor/visitors/workflows-1/workflow/StepsVisitor.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 WorkflowStepsElement from '../../../../elements/nces/WorkflowSteps'; | ||
import SpecificationVisitor from '../../SpecificationVisitor'; | ||
import FallbackVisitor from '../../FallbackVisitor'; | ||
|
||
const StepsVisitor = stampit(SpecificationVisitor, FallbackVisitor, { | ||
init() { | ||
this.element = new WorkflowStepsElement(); | ||
}, | ||
methods: { | ||
ArrayElement(arrayElement: ArrayElement) { | ||
arrayElement.forEach((item: Element): void => { | ||
const specPath = ['document', 'objects', 'Step']; | ||
const element = this.toRefractedElement(specPath, item); | ||
|
||
this.element.push(element); | ||
}); | ||
|
||
this.copyMetaAndAttributes(arrayElement, this.element); | ||
|
||
return BREAK; | ||
}, | ||
}, | ||
}); | ||
|
||
export default StepsVisitor; |
18 changes: 18 additions & 0 deletions
18
packages/apidom-ns-workflows-1/src/refractor/visitors/workflows-1/workflow/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 WorkflowElement from '../../../../elements/Workflow'; | ||
import FallbackVisitor from '../../FallbackVisitor'; | ||
import FixedFieldsVisitor from '../../generics/FixedFieldsVisitor'; | ||
|
||
const WorkflowVisitor = stampit(FixedFieldsVisitor, FallbackVisitor, { | ||
props: { | ||
specPath: always(['document', 'objects', 'Workflow']), | ||
canSupportSpecificationExtensions: true, | ||
}, | ||
init() { | ||
this.element = new WorkflowElement(); | ||
}, | ||
}); | ||
|
||
export default WorkflowVisitor; |
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.