-
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 Servers object
Refs #67
- Loading branch information
Showing
9 changed files
with
84 additions
and
4 deletions.
There are no files selected for viewing
10 changes: 10 additions & 0 deletions
10
apidom/packages/apidom-ns-asyncapi2-0/src/elements/Server.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 Server extends ObjectElement { | ||
constructor(content?: Array<unknown>, meta?: Meta, attributes?: Attributes) { | ||
super(content, meta, attributes); | ||
this.element = 'server'; | ||
} | ||
} | ||
|
||
export default Server; |
10 changes: 10 additions & 0 deletions
10
apidom/packages/apidom-ns-asyncapi2-0/src/elements/Servers.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 Servers extends ObjectElement { | ||
constructor(content?: Array<unknown>, meta?: Meta, attributes?: Attributes) { | ||
super(content, meta, attributes); | ||
this.element = 'servers'; | ||
} | ||
} | ||
|
||
export default Servers; |
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
.../apidom-parser-adapter-asyncapi2-0-json/src/parser/visitors/async-api-2-0/server/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 ServerVisitor = stampit(FixedFieldsJsonObjectVisitor, { | ||
props: { | ||
specPath: always(['document', 'objects', 'Server']), | ||
}, | ||
init() { | ||
this.element = new this.namespace.elements.Server(); | ||
}, | ||
}); | ||
|
||
export default ServerVisitor; |
16 changes: 16 additions & 0 deletions
16
...apidom-parser-adapter-asyncapi2-0-json/src/parser/visitors/async-api-2-0/servers/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,16 @@ | ||
import stampit from 'stampit'; | ||
import { test, always } from 'ramda'; | ||
|
||
import PatternedFieldsJsonObjectVisitor from '../../generics/PatternedFieldsJsonObjectVisitor'; | ||
|
||
const ServersVisitor = stampit(PatternedFieldsJsonObjectVisitor, { | ||
props: { | ||
specPath: always(['document', 'objects', 'Server']), | ||
fieldPatternPredicate: test(/^[A-Za-z0-9_\\-]+$/), | ||
}, | ||
init() { | ||
this.element = new this.namespace.elements.Servers(); | ||
}, | ||
}); | ||
|
||
export default ServersVisitor; |
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