Closed Florence-Njeri closed 2 months ago
@asyncapi/bounty_team
@Gmin2 please suggest one
Latest commit: 8ef5496be4fd9a5bf8d5e24c4ce812a697479074
Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.
Click here to learn what changesets are, and how to add one.
Click here if you're a maintainer who wants to add a changeset to this PR
@Gmin2 kind reminder
Hey @Gmin2 I have updated the PR
folks we need an example that is valid. Provided example is not valid and looks like generated with AI, as it is inventing not existing features and using old API.
it is critical to always run examples manually before they are added to docs - no matter if written by ChatGPT or a human (never trust an engineer). Since we have https://github.com/asyncapi/generator/tree/master/apps/generator/test/test-templates/react-template/template in the generator now, it should be as simple as locally adding new file with an example, then you run the generation with CLI and see the result
here is a simplified version of the example:
import { File, Text } from "@asyncapi/generator-react-sdk";
export default function ({ asyncapi }) {
const files = [];
// Generate files for channels
asyncapi.channels().forEach((channel) => {
const channelName = channel.id();
files.push(
<File name={`${channelName}.md`}>
<Text newLines={2}># Channel: {channelName}</Text>
<Text>
{channel.hasDescription() && `${channel.description()}`}
</Text>
</File>
);
});
return files;
}
it shows:
Text
component, otherwise all gets generated as one line<File name={
channels/${channelName}.md}>
will not work, you will get an error. If you want to generate channel MD files in channels
directory, you need to put template file in channels
directory@Gmin2 your example is good from idea point of view, so now just please take my sample end extend with part where you render operations information (forget about publish and subscribe, it is not there in new AsyncAPI anymore)
Hey @derberg @Gmin2 I have updated the PR with the up-to-date code snippet. Please help me re-review. Thank you!
Hey @derberg I fixed the code. Please take another look
Issues
0 New issues
0 Accepted issues
Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code
/rtm
Description Improve documentation related to File templates feature:
Related issue(s) Resolves #1199