add example code generator
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
// //1
|
||||
// import { File } from '@asyncapi/generator-react-sdk'
|
||||
// //2
|
||||
// export default function ({ asyncapi }) {
|
||||
// //3
|
||||
// return <File name="client.py">{asyncapi.info().title()}</File>
|
||||
// }
|
||||
|
||||
|
||||
|
||||
import { File } from '@asyncapi/generator-react-sdk';
|
||||
|
||||
export default function ({ asyncapi, params }) {
|
||||
const channels = Object.keys(asyncapi.components());
|
||||
|
||||
let content = ''
|
||||
for (const channel of channels) {
|
||||
content += `# channel: ${channel}\n`
|
||||
}
|
||||
return (
|
||||
<File name="client2.py"># {asyncapi.info().title()}
|
||||
{`\n`}
|
||||
# {asyncapi.info().description()}
|
||||
{`\n`}
|
||||
{channels.map((ch) => `# channel: ${ch}\n`)}
|
||||
{content}
|
||||
</File>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user