-
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-openapi-3-1): add support for Tag Object
- Loading branch information
Showing
9 changed files
with
88 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
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,37 @@ | ||
import { Attributes, Meta } from 'minim'; | ||
import { ObjectElement, StringElement } from 'apidom'; | ||
|
||
import ExternalDocumentationElement from './ExternalDocumentation'; | ||
|
||
class Tag extends ObjectElement { | ||
constructor(content?: Record<string, unknown>, meta?: Meta, attributes?: Attributes) { | ||
super(content, meta, attributes); | ||
this.element = 'tag'; | ||
} | ||
|
||
get name(): StringElement { | ||
return this.get('name'); | ||
} | ||
|
||
set name(name: StringElement) { | ||
this.set('name', name); | ||
} | ||
|
||
get description(): StringElement { | ||
return this.get('description'); | ||
} | ||
|
||
set description(description: StringElement) { | ||
this.set('description', description); | ||
} | ||
|
||
get externalDocs(): ExternalDocumentationElement { | ||
return this.get('externalDocs'); | ||
} | ||
|
||
set externalDocs(externalDocs: ExternalDocumentationElement) { | ||
this.set('externalDocs', externalDocs); | ||
} | ||
} | ||
|
||
export default Tag; |
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
7 changes: 7 additions & 0 deletions
7
...kages/apidom-ns-openapi-3-1/src/refractor/visitors/open-api-3-1/tag/DescriptionVisitor.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,7 @@ | ||
import stampit from 'stampit'; | ||
|
||
import FallbackVisitor from '../../FallbackVisitor'; | ||
|
||
const DescriptionVisitor = stampit(FallbackVisitor); | ||
|
||
export default DescriptionVisitor; |
7 changes: 7 additions & 0 deletions
7
apidom/packages/apidom-ns-openapi-3-1/src/refractor/visitors/open-api-3-1/tag/NameVisitor.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,7 @@ | ||
import stampit from 'stampit'; | ||
|
||
import FallbackVisitor from '../../FallbackVisitor'; | ||
|
||
const NameVisitor = stampit(FallbackVisitor); | ||
|
||
export default NameVisitor; |
18 changes: 18 additions & 0 deletions
18
apidom/packages/apidom-ns-openapi-3-1/src/refractor/visitors/open-api-3-1/tag/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 TagElement from '../../../../elements/Tag'; | ||
import FallbackVisitor from '../../FallbackVisitor'; | ||
import FixedFieldsVisitor from '../../generics/FixedFieldsVisitor'; | ||
|
||
const TagVisitor = stampit(FixedFieldsVisitor, FallbackVisitor, { | ||
props: { | ||
specPath: always(['document', 'objects', 'Tag']), | ||
canSupportSpecificationExtensions: true, | ||
}, | ||
init() { | ||
this.element = new TagElement(); | ||
}, | ||
}); | ||
|
||
export default TagVisitor; |