Skip to content

Commit

Permalink
feat(ns-workflows-1): Add Workflows Spec Object
Browse files Browse the repository at this point in the history
  • Loading branch information
frankkilcommins committed Dec 4, 2023
1 parent fce4096 commit d7f0414
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/apidom-ns-workflows-1/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ const workflowsElement = WorkflowsSpecification1Element.refract(apiDOM.result, {

Only fully implemented specification objects should be checked here.

- [ ] [Workflows Specification Object](https://github.com/OAI/sig-workflows/blob/main/versions/1.0.0.md#workflows-specification-object)
- [x] [Workflows Specification Object](https://github.com/OAI/sig-workflows/blob/main/versions/1.0.0.md#workflows-specification-object)
- [x] [Info Object](https://github.com/OAI/sig-workflows/blob/main/versions/1.0.0.md#info-object)
- [x] [Source Description Object](https://github.com/OAI/sig-workflows/blob/main/versions/1.0.0.md#source-description-object)
- [x] [Workflow Object](https://github.com/OAI/sig-workflows/blob/main/versions/1.0.0.md#workflow-object)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { ObjectElement, ArrayElement, Attributes, Meta } from '@swagger-api/apid

import WorkflowsSpecElement from './WorkflowsSpec';
import InfoElement from './Info';
import ComponentsElement from './Components';

class WorkflowsSpecification1 extends ObjectElement {
constructor(content?: Record<string, unknown>, meta?: Meta, attributes?: Attributes) {
Expand Down Expand Up @@ -34,6 +35,22 @@ class WorkflowsSpecification1 extends ObjectElement {
set sourceDescriptions(sourceDescriptions: ArrayElement | undefined) {
this.set('sourceDescriptions', sourceDescriptions);
}

get workflows(): ArrayElement | undefined {
return this.get('workflows');
}

set workflows(workflows: ArrayElement | undefined) {
this.set('workflows', workflows);
}

get components(): ComponentsElement | undefined {
return this.get('components');
}

set components(components: ComponentsElement | undefined) {
this.set('components', components);
}
}

export default WorkflowsSpecification1;
2 changes: 2 additions & 0 deletions packages/apidom-ns-workflows-1/src/refractor/specification.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ const specification = {
$ref: '#/visitors/document/objects/Info',
},
sourceDescriptions: SourceDescriptionsVisitor,
workflows: WorkflowVisitor,
components: ComponentsVisitor,
},
},
Info: {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`refractor elements WorkflowsSpecification1Element should refract to semantic ApiDOM tree 1`] = `
(WorkflowsSpecification1Element
(MemberElement
(StringElement)
(StringElement))
(MemberElement
(StringElement)
(InfoElement))
(MemberElement
(StringElement)
(ArrayElement
(SourceDescriptionElement)))
(MemberElement
(StringElement)
(ArrayElement
(ObjectElement)))
(MemberElement
(StringElement)
(ComponentsElement)))
`;
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { expect } from 'chai';
import { sexprs } from '@swagger-api/apidom-core';

import { WorkflowsSpecification1Element } from '../../../../src';

describe('refractor', function () {
context('elements', function () {
context('WorkflowsSpecification1Element', function () {
specify('should refract to semantic ApiDOM tree', function () {
const workflowsSpecification1Element = WorkflowsSpecification1Element.refract({
workflowsSpec: '1.0.0',
info: {},
sourceDescriptions: [{}],
workflows: [{}],
components: {},
});

expect(sexprs(workflowsSpecification1Element)).toMatchSnapshot();
});
});
});
});

0 comments on commit d7f0414

Please sign in to comment.