Read January 2021 at AsyncAPI for the update from January.
Open governance model aka charter ready for the review
Is an "open governance model" the same as a "charter"? No. Charter is a boring legal document that describes many rules that need to be followed when being under a foundation. One of the things the charter tackles is the general rules on how the project will operate and be governed.
Please take your time to:
- Read Finding a Good Open Governance Model for AsyncAPI to understand our motivation
- Check out this pull request with the charter
Code generators activities
We had some significant traffic in the area of code generation templates in February.
PHP
Emiliano Zublena joined the AsyncAPI community big time by starting with donating a new template for PHP. It is not yet released under @asyncapi scope on npm, but you can already play with it by using the AsyncAPI Generator with a direct GitHub link like:
ag https://bit.ly/asyncapi https://github.com/asyncapi/asyncapi-php-template -o output`
Go
We merged the initial pull request to the Go template. The initial contributor was not able to continue working on the template, but the foundation was there. Emiliano Zublena and Takumi Sueda will try to help to drive forward template development. This template is not yet released as we need to get some feedback from the community first. Give it a try with:
ag https://bit.ly/asyncapi https://github.com/asyncapi/go-template -o output
Let us know what you think in the GitHub issues section. Thank you, Jacob Poston for your initial hard work on the template!
TypeScript and NATS
Jonas Lagoni regularly extends and polishes the TypeScript template for NATS. It reached 0.3 release and is the first template that is already using a new AsyncAPI SDK for data types generation. Please go and check it out.
AsyncAPI CLI to rule them all
We always wanted to have a single CLI to do all the things related to AsyncAPI. In other words, one CLI to validate, generate, edit, create, and others. So far, we had a CLI for the AsyncAPI generator, and recently one of our community members, Jorge Aguiar Martín, referred us to his CLI for AsyncAPI validation.
We all agreed that instead of working separately on different CLIs, it is better to work together on one CLI that everyone will love. The project kicked off! A repository has been created and we already discuss details on how the CLI interface should look like. Join the discussion.
Event gateway
An excellent engineer joined AsyncAPI, Sergio Moya. We felt like we need to start something big that should be built independently from any vendor together with the AsyncAPI community. The project got kicked off, and it is the best time to join. Have a look at the dedicated repository and our plans for the Everest? AsyncAPI Gate? or maybe Eventide?
Share your use cases. Please help us understand what you need. Sergio prepared an issue template that helps with that.
Domain model generation
As mentioned in the blog post about January, February was all about data model generation that we wanted to use to speed up templates development for code generation. The library is ready, and we started trying it out. You can try it out too, and you do not even need our AsyncAPI Generator. It is a generic library and you only need a JSON Schema Draft 7 or an AsyncAPI document.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
import { TypeScriptGenerator } from '@asyncapi/generator-model-sdk'; const DESCRIPTION_PRESET = { interface: { property({ property, content }) { const desc = property.getFromSchema('description'); if (desc) { return `// ${desc}\n${content}`; } return content; } } } const options = { modelType: 'interface', presets: [DESCRIPTION_PRESET], } const generator = new TypeScriptGenerator(options); const schema = { $id: "Address", type: "object", properties: { street_name: { type: "string" }, city: { type: "string", description: "City description" }, house_number: { type: "number" }, marriage: { type: "boolean", description: "Status if marriage live in given house" }, pet_names: { type: "array", items: { type: "string" } }, }, required: ["street_name", "city", "state", "house_number", "state"], }; const interfaceModels = await generator.generate(schema); // generated interfaceModels[0].result should have the following shape: export interface Address { streetName: string; // City description city: string; houseNumber: number; // Status if marriage live in given house marriage?: boolean; petNames?: Array<string>; }
Some important resources to follow:
- How processing data from input works
- How generator-model-sdk simplify JSON Schema
- How model generator works and how to write a new one
- How presets (customization) works and how to write a custom preset
Community continues to grow
In February we reached 1600 followers on Twitter.
A great thing to see is that the community from LinkedIn grew to 900, and our news shared there also get more visibility.
Other features
Thanks to the support of Daniel CHU —who joined us during last Hacktoberfest— now the JavaScript parser also validates the examples of server variables. For more details, check out the 1.4 release.
Once again, thanks to Ludovic Dussart from Ineat Lab, we have additional features, these time in HTML and Markdown template. Thanks to the new version parameter, you can overwrite the version of the application specified in the AsyncAPI file under info.version. Useful in CI/CD when your service version is not maintained in the AsyncAPI file but pom.xml or package.json
Thanks to Mike Ralphson, we have a new frontMatter parameter in the Markdown template. It lets you specify an external file with a custom front-matter that should be included in the resulting Markdown during generation. Very useful for static site generators' users.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
# 1. Get AsyncAPI Generator npm install -g @asyncapi/generator # 2. Create a file with frontmatter cat > ssg.yml << EOF title: AsyncAPI Documentation layout: asyncapi permalink: /asyncapi-docs EOF # 3, Generate Markdown file that includes the frontmatter ag https://bit.ly/asyncapi @asyncapi/markdown-template -o output -p frontMatter=ssg.yml # 4. Check out the output cat output/asyncapi.md
Maciej Urbanczyk and I
(I mean me 😃) pushed some features to the AsyncAPI Generator: - It supports the latest Node.js 15 and npm 7
- You can now install generator templates globally. For more details, read this new section in the readme.
- It is now much easier to generate multiple files using the new React render engine. For more details, read this or have a look at it here
- Some parts of templates can be written in TypeScript. For more details, read this. We still cannot use TS in main template code. For more details read this.
Check out all the releases
Good learning resources
- Read this important 10 FAQs About Event-Driven APIs from Dakshitha Ratnayake
- Great summary from Nordic APIs and Vyom Srivastava on 8+ AsyncAPI Documentation Generators
Fran Mendez was a part of Postman's live stream. Learn how to get from zero to AsyncAPI in just about 1h 30min. I hope it can be done faster, and Fran was just having too much small talk with Kevin and Kin 😅
Photo by Denys Nevozhai on Unsplash