-
Notifications
You must be signed in to change notification settings - Fork 18
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 Step Object (#3471)
Refs #3392
- Loading branch information
1 parent
29a4d51
commit c63021e
Showing
26 changed files
with
1,111 additions
and
2 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,104 @@ | ||
import { | ||
ObjectElement, | ||
ArrayElement, | ||
StringElement, | ||
Attributes, | ||
Meta, | ||
} from '@swagger-api/apidom-core'; | ||
|
||
class Step extends ObjectElement { | ||
constructor(content?: Record<string, unknown>, meta?: Meta, attributes?: Attributes) { | ||
super(content, meta, attributes); | ||
this.element = 'step'; | ||
} | ||
|
||
get description(): StringElement | undefined { | ||
return this.get('description'); | ||
} | ||
|
||
set description(description: StringElement | undefined) { | ||
this.set('description', description); | ||
} | ||
|
||
get stepId(): StringElement | undefined { | ||
return this.get('stepId'); | ||
} | ||
|
||
set stepId(stepId: StringElement | undefined) { | ||
this.set('stepId', stepId); | ||
} | ||
|
||
get operationId(): StringElement | undefined { | ||
return this.get('operationId'); | ||
} | ||
|
||
set operationId(operationId: StringElement | undefined) { | ||
this.set('operationId', operationId); | ||
} | ||
|
||
get operationRef(): StringElement | undefined { | ||
return this.get('operationRef'); | ||
} | ||
|
||
set operationRef(operationRef: StringElement | undefined) { | ||
this.set('operationRef', operationRef); | ||
} | ||
|
||
get workflowId(): StringElement | undefined { | ||
return this.get('workflowId'); | ||
} | ||
|
||
set workflowId(workflowId: StringElement | undefined) { | ||
this.set('workflowId', workflowId); | ||
} | ||
|
||
get parameters(): ArrayElement | undefined { | ||
return this.get('parameters'); | ||
} | ||
|
||
set parameters(parameters: ArrayElement | undefined) { | ||
this.set('parameters', parameters); | ||
} | ||
|
||
get dependsOn(): ArrayElement | undefined { | ||
return this.get('dependsOn'); | ||
} | ||
|
||
set dependsOn(dependsOn: ArrayElement | undefined) { | ||
this.set('dependsOn', dependsOn); | ||
} | ||
|
||
get successCriteria(): ArrayElement | undefined { | ||
return this.get('successCriteria'); | ||
} | ||
|
||
set successCriteria(successCriteria: ArrayElement | undefined) { | ||
this.set('successCriteria', successCriteria); | ||
} | ||
|
||
get onSuccess(): ArrayElement | undefined { | ||
return this.get('onSuccess'); | ||
} | ||
|
||
set onSuccess(onSuccess: ArrayElement | undefined) { | ||
this.set('onSuccess', onSuccess); | ||
} | ||
|
||
get onFailure(): ArrayElement | undefined { | ||
return this.get('onFailure'); | ||
} | ||
|
||
set onFailure(onFailure: ArrayElement | undefined) { | ||
this.set('onFailure', onFailure); | ||
} | ||
|
||
get outputs(): ObjectElement | undefined { | ||
return this.get('outputs'); | ||
} | ||
|
||
set outputs(outputs: ObjectElement | undefined) { | ||
this.set('outputs', outputs); | ||
} | ||
} | ||
|
||
export default Step; |
12 changes: 12 additions & 0 deletions
12
packages/apidom-ns-workflows-1/src/elements/nces/StepDependsOn.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 StepDependsOn extends ArrayElement { | ||
static primaryClass = 'step-depends-on'; | ||
|
||
constructor(content?: Array<unknown>, meta?: Meta, attributes?: Attributes) { | ||
super(content, meta, attributes); | ||
this.classes.push(StepDependsOn.primaryClass); | ||
} | ||
} | ||
|
||
export default StepDependsOn; |
12 changes: 12 additions & 0 deletions
12
packages/apidom-ns-workflows-1/src/elements/nces/StepOnFailure.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 StepOnFailure extends ArrayElement { | ||
static primaryClass = 'step-on-failure'; | ||
|
||
constructor(content?: Array<unknown>, meta?: Meta, attributes?: Attributes) { | ||
super(content, meta, attributes); | ||
this.classes.push(StepOnFailure.primaryClass); | ||
} | ||
} | ||
|
||
export default StepOnFailure; |
12 changes: 12 additions & 0 deletions
12
packages/apidom-ns-workflows-1/src/elements/nces/StepOnSuccess.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 StepOnSuccess extends ArrayElement { | ||
static primaryClass = 'step-on-success'; | ||
|
||
constructor(content?: Array<unknown>, meta?: Meta, attributes?: Attributes) { | ||
super(content, meta, attributes); | ||
this.classes.push(StepOnSuccess.primaryClass); | ||
} | ||
} | ||
|
||
export default StepOnSuccess; |
12 changes: 12 additions & 0 deletions
12
packages/apidom-ns-workflows-1/src/elements/nces/StepOutputs.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 StepOutputs extends ObjectElement { | ||
static primaryClass = 'step-outputs'; | ||
|
||
constructor(content?: Record<string, unknown>, meta?: Meta, attributes?: Attributes) { | ||
super(content, meta, attributes); | ||
this.classes.push(StepOutputs.primaryClass); | ||
} | ||
} | ||
|
||
export default StepOutputs; |
13 changes: 13 additions & 0 deletions
13
packages/apidom-ns-workflows-1/src/elements/nces/StepParameters.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 StepParameters extends ArrayElement { | ||
static primaryClass = 'step-parameters'; | ||
|
||
constructor(content?: Array<unknown>, meta?: Meta, attributes?: Attributes) { | ||
super(content, meta, attributes); | ||
this.classes.push(StepParameters.primaryClass); | ||
this.classes.push('parameters'); | ||
} | ||
} | ||
|
||
export default StepParameters; |
13 changes: 13 additions & 0 deletions
13
packages/apidom-ns-workflows-1/src/elements/nces/StepSuccessCriteria.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 StepSuccessCriteria extends ArrayElement { | ||
static primaryClass = 'step-success-criteria'; | ||
|
||
constructor(content?: Array<unknown>, meta?: Meta, attributes?: Attributes) { | ||
super(content, meta, attributes); | ||
this.classes.push(StepSuccessCriteria.primaryClass); | ||
this.classes.push('criteria'); | ||
} | ||
} | ||
|
||
export default StepSuccessCriteria; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,22 @@ | ||
import { startsWith } from 'ramda'; | ||
import { MemberElement, isStringElement, toValue } from '@swagger-api/apidom-core'; | ||
import { | ||
MemberElement, | ||
ObjectElement, | ||
isStringElement, | ||
toValue, | ||
isObjectElement, | ||
} from '@swagger-api/apidom-core'; | ||
|
||
export interface ReferenceLikeElement extends ObjectElement { | ||
hasKey: (value: '$ref') => true; | ||
} | ||
|
||
// eslint-disable-next-line import/prefer-default-export | ||
export const isWorkflowsSpecificationExtension = (element: MemberElement): boolean => { | ||
// @ts-ignore | ||
return isStringElement(element.key) && startsWith('x-', toValue(element.key)); | ||
}; | ||
|
||
export const isReferenceLikeElement = (element: unknown): element is ReferenceLikeElement => { | ||
return isObjectElement(element) && element.hasKey('$ref'); | ||
}; |
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.