-
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(AsyncApi2.0): add support for ChannelItem object
Refs #67
- Loading branch information
Showing
15 changed files
with
297 additions
and
2 deletions.
There are no files selected for viewing
10 changes: 10 additions & 0 deletions
10
apidom/packages/apidom-ns-asyncapi2-0/src/elements/ChannelBindings.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,10 @@ | ||
import { Attributes, Meta, ObjectElement } from 'minim'; | ||
|
||
class ChannelBindings extends ObjectElement { | ||
constructor(content?: Array<unknown>, meta?: Meta, attributes?: Attributes) { | ||
super(content, meta, attributes); | ||
this.element = 'channelBindings'; | ||
} | ||
} | ||
|
||
export default ChannelBindings; |
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
10 changes: 10 additions & 0 deletions
10
apidom/packages/apidom-ns-asyncapi2-0/src/elements/Operation.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,10 @@ | ||
import { Attributes, Meta, ObjectElement } from 'minim'; | ||
|
||
class Operation extends ObjectElement { | ||
constructor(content?: Array<unknown>, meta?: Meta, attributes?: Attributes) { | ||
super(content, meta, attributes); | ||
this.element = 'operation'; | ||
} | ||
} | ||
|
||
export default Operation; |
10 changes: 10 additions & 0 deletions
10
apidom/packages/apidom-ns-asyncapi2-0/src/elements/Parameters.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,10 @@ | ||
import { Attributes, Meta, ObjectElement } from 'minim'; | ||
|
||
class Parameters extends ObjectElement { | ||
constructor(content?: Array<unknown>, meta?: Meta, attributes?: Attributes) { | ||
super(content, meta, attributes); | ||
this.element = 'parameters'; | ||
} | ||
} | ||
|
||
export default Parameters; |
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
15 changes: 15 additions & 0 deletions
15
...rser-adapter-asyncapi2-0-json/src/parser/visitors/async-api-2-0/channel-bindings/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,15 @@ | ||
import stampit from 'stampit'; | ||
import { always } from 'ramda'; | ||
|
||
import FixedFieldsJsonObjectVisitor from '../../generics/FixedFieldsJsonObjectVisitor'; | ||
|
||
const ChannelBindingsVisitor = stampit(FixedFieldsJsonObjectVisitor, { | ||
props: { | ||
specPath: always(['document', 'objects', 'ChannelBindings']), | ||
}, | ||
init() { | ||
this.element = new this.namespace.elements.ChannelBindings(); | ||
}, | ||
}); | ||
|
||
export default ChannelBindingsVisitor; |
18 changes: 18 additions & 0 deletions
18
...er-adapter-asyncapi2-0-json/src/parser/visitors/async-api-2-0/channel-item/$RefVisitor.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 SpecificationVisitor from '../../SpecificationVisitor'; | ||
import { BREAK } from '../..'; | ||
|
||
const $RefVisitor = stampit(SpecificationVisitor, { | ||
methods: { | ||
string(stringNode) { | ||
const refElement = new this.namespace.elements.Ref(stringNode.value); | ||
refElement.path = stringNode.value; | ||
this.element = this.maybeAddSourceMap(stringNode, refElement); | ||
|
||
return BREAK; | ||
}, | ||
}, | ||
}); | ||
|
||
export default $RefVisitor; |
6 changes: 6 additions & 0 deletions
6
...ter-asyncapi2-0-json/src/parser/visitors/async-api-2-0/channel-item/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,6 @@ | ||
import stampit from 'stampit'; | ||
import JsonStringVisitor from '../../generics/JsonStringVisitor'; | ||
|
||
const DescriptionVisitor = stampit(JsonStringVisitor); | ||
|
||
export default DescriptionVisitor; |
15 changes: 15 additions & 0 deletions
15
...idom-parser-adapter-asyncapi2-0-json/src/parser/visitors/async-api-2-0/operation/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,15 @@ | ||
import stampit from 'stampit'; | ||
import { always } from 'ramda'; | ||
|
||
import FixedFieldsJsonObjectVisitor from '../../generics/FixedFieldsJsonObjectVisitor'; | ||
|
||
const OperationVisitor = stampit(FixedFieldsJsonObjectVisitor, { | ||
props: { | ||
specPath: always(['document', 'objects', 'Operation']), | ||
}, | ||
init() { | ||
this.element = new this.namespace.elements.Operation(); | ||
}, | ||
}); | ||
|
||
export default OperationVisitor; |
12 changes: 12 additions & 0 deletions
12
...dom-parser-adapter-asyncapi2-0-json/src/parser/visitors/async-api-2-0/parameters/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,12 @@ | ||
import stampit from 'stampit'; | ||
import { test } from 'ramda'; | ||
|
||
import PatternedFieldsJsonObjectVisitor from '../../generics/PatternedFieldsJsonObjectVisitor'; | ||
|
||
const ParametersVisitor = stampit(PatternedFieldsJsonObjectVisitor, { | ||
props: { | ||
fieldPatternPredicate: test(/^[A-Za-z0-9_\\-]+$/), | ||
}, | ||
}); | ||
|
||
export default ParametersVisitor; |
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