-
-
Notifications
You must be signed in to change notification settings - Fork 232
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs: improve documentation related to File templates feature #1230
docs: improve documentation related to File templates feature #1230
Conversation
@asyncapi/bounty_team |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
just one point you can add more examples
@Gmin2 please suggest one |
|
@Gmin2 kind reminder |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There could be an example of generating with varied content based on different components
import { File } from '@asyncapi/generator-react-sdk';
export default function({ asyncapi }) {
const files = [];
// Generate files for channels
asyncapi.channels().forEach((channel, channelName) => {
files.push(
<File name={`channels/${channelName}.md`}>
# Channel: {channelName}
Description: {channel.description() || 'No description provided'}
## Operations
{channel.publish() && <div>Publish: {channel.publish().summary()}</div>}
{channel.subscribe() && <div>Subscribe: {channel.subscribe().summary()}</div>}
</File>
);
});
return files
}
other then that looks fine
Hey @Gmin2 I have updated the PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
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:
it shows:
@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) |
const schemas = asyncapi.allSchemas(); | ||
// schemas is an instance of the Map | ||
return Array.from(schemas).map(([schemaName, schema]) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
schemas is not an array but a map, so like I suggest in my previous comment to the PR, better use forEach
and yeah, you need to manually test if file is working, as this way you would know something is wrong
during generation I get Generator Error: object is not iterable (cannot read property Symbol(Symbol.iterator))
btw, this example also needs import { File, Text } from "@asyncapi/generator-react-sdk";
Hey @derberg I fixed the code. Please take another look |
Quality Gate passedIssues Measures |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated schema example as it was invalid. Without checking examples manually, we should not put them in docs as they are not helpful and only confuse
/rtm |
Description
Improve documentation related to File templates feature:
Related issue(s)
Resolves #1199