-
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 Source Description Object (#3403)
Refs #3392
- Loading branch information
1 parent
e60194b
commit 893f125
Showing
17 changed files
with
322 additions
and
10 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
34 changes: 34 additions & 0 deletions
34
packages/apidom-ns-workflows-1/src/elements/SourceDescription.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,34 @@ | ||
import { ObjectElement, StringElement, Attributes, Meta } from '@swagger-api/apidom-core'; | ||
|
||
class SourceDescription extends ObjectElement { | ||
constructor(content?: Record<string, unknown>, meta?: Meta, attributes?: Attributes) { | ||
super(content, meta, attributes); | ||
this.element = 'sourceDescription'; | ||
} | ||
|
||
get name(): StringElement | undefined { | ||
return this.get('name'); | ||
} | ||
|
||
set name(name: StringElement | undefined) { | ||
this.set('name', name); | ||
} | ||
|
||
get url(): StringElement | undefined { | ||
return this.get('url'); | ||
} | ||
|
||
set url(url: StringElement | undefined) { | ||
this.set('url', url); | ||
} | ||
|
||
get type(): StringElement | undefined { | ||
return this.get('type'); | ||
} | ||
|
||
set type(type: StringElement | undefined) { | ||
this.set('type', type); | ||
} | ||
} | ||
|
||
export default SourceDescription; |
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
12 changes: 12 additions & 0 deletions
12
packages/apidom-ns-workflows-1/src/elements/nces/SourceDescriptions.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 SourceDescriptions extends ArrayElement { | ||
static primaryClass = 'sourceDescriptions'; | ||
|
||
constructor(content?: Array<unknown>, meta?: Meta, attributes?: Attributes) { | ||
super(content, meta, attributes); | ||
this.classes.push(SourceDescriptions.primaryClass); | ||
} | ||
} | ||
|
||
export default SourceDescriptions; |
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
...ges/apidom-ns-workflows-1/src/refractor/visitors/workflows-1/SourceDescriptionsVisitor.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 SourceDescriptionsElement from '../../../elements/nces/SourceDescriptions'; | ||
import SpecificationVisitor from '../SpecificationVisitor'; | ||
import FallbackVisitor from '../FallbackVisitor'; | ||
|
||
const SourceDescriptionsVisitor = stampit(SpecificationVisitor, FallbackVisitor, { | ||
init() { | ||
this.element = new SourceDescriptionsElement(); | ||
}, | ||
methods: { | ||
ArrayElement(arrayElement: ArrayElement) { | ||
arrayElement.forEach((item: Element): void => { | ||
const specPath = ['document', 'objects', 'SourceDescription']; | ||
const element = this.toRefractedElement(specPath, item); | ||
|
||
this.element.push(element); | ||
}); | ||
|
||
this.copyMetaAndAttributes(arrayElement, this.element); | ||
|
||
return BREAK; | ||
}, | ||
}, | ||
}); | ||
|
||
export default SourceDescriptionsVisitor; |
17 changes: 17 additions & 0 deletions
17
...apidom-ns-workflows-1/src/refractor/visitors/workflows-1/source-description/UrlVisitor.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 { StringElement, BREAK, cloneDeep } from '@swagger-api/apidom-core'; | ||
|
||
import FallbackVisitor from '../../FallbackVisitor'; | ||
|
||
const UrlVisitor = stampit(FallbackVisitor, { | ||
methods: { | ||
StringElement(stringElement: StringElement) { | ||
this.element = cloneDeep(stringElement); | ||
this.element.classes.push('source-description-url'); | ||
|
||
return BREAK; | ||
}, | ||
}, | ||
}); | ||
|
||
export default UrlVisitor; |
18 changes: 18 additions & 0 deletions
18
...ages/apidom-ns-workflows-1/src/refractor/visitors/workflows-1/source-description/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 SourceDescriptionElement from '../../../../elements/SourceDescription'; | ||
import FallbackVisitor from '../../FallbackVisitor'; | ||
import FixedFieldsVisitor from '../../generics/FixedFieldsVisitor'; | ||
|
||
const SourceDescriptionVisitor = stampit(FixedFieldsVisitor, FallbackVisitor, { | ||
props: { | ||
specPath: always(['document', 'objects', 'SourceDescription']), | ||
canSupportSpecificationExtensions: true, | ||
}, | ||
init() { | ||
this.element = new SourceDescriptionElement(); | ||
}, | ||
}); | ||
|
||
export default SourceDescriptionVisitor; |
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 was deleted.
Oops, something went wrong.
Oops, something went wrong.