February 2021 at AsyncAPI

Lukasz Gornicki

Lukasz Gornicki

·7 min read

Read January 2021 at AsyncAPI for the update from January.

I enjoy monthly status over weekly one. It is not that I'm just happy I have more time for other things. Content size did not change. I think people do have other things to do than following AsyncAPI only 😅 Life in open-source runs slower, at least when you look at it from the outside. I have an impression, that more people pay attention to the status when it is once a month. I wonder what your view is on that.

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.

I think the most important thing to write here is that the AsyncAPI charter is a reality. It finally arrived and is ready for review. In the special blog post, we also explained what governance model we envision for the AsyncAPI Initiative in more human-friendly words. This content was released and communicated on Tuesday, 9th of March, and we will wait for your feedback until the 23rd of March. It looks like we will kick off April under the umbrella of the foundation 🤞

Please take your time to:

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

Sounds big? It is 😃

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.

1import { TypeScriptGenerator } from '@asyncapi/generator-model-sdk';
2
3const DESCRIPTION_PRESET = {
4  interface: {
5    property({ property, content }) {
6      const desc = property.getFromSchema('description');
7      if (desc) {
8        return `// ${desc}\n${content}`;
9      }
10      return content;
11    }
12  }
13}
14
15const options = {
16  modelType: 'interface',
17  presets: [DESCRIPTION_PRESET],
18}
19
20const generator = new TypeScriptGenerator(options);
21
22const schema = {
23  $id: "Address",
24  type: "object",
25  properties: {
26    street_name:    { type: "string" },
27    city:           { type: "string", description: "City description" },
28    house_number:   { type: "number" },
29    marriage:       { type: "boolean", description: "Status if marriage live in given house" },
30    pet_names:      { type: "array", items: { type: "string" } },
31  },
32  required: ["street_name", "city", "state", "house_number", "state"],
33};
34
35const interfaceModels = await generator.generate(schema);
36
37// generated interfaceModels[0].result should have the following shape:
38export interface Address {
39  streetName: string;
40  // City description
41  city: string;
42  houseNumber: number;
43  // Status if marriage live in given house
44  marriage?: boolean;
45  petNames?: Array<string>;
46}

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.

We are very noisy 😅

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# 1. Get AsyncAPI Generator
    2npm install -g @asyncapi/generator
    3
    4# 2. Create a file with frontmatter
    5cat > ssg.yml << EOF
    6title: AsyncAPI Documentation
    7layout: asyncapi
    8permalink: /asyncapi-docs
    9EOF
    10
    11# 3, Generate Markdown file that includes the frontmatter
    12ag https://bit.ly/asyncapi @asyncapi/markdown-template -o output -p frontMatter=ssg.yml
    13
    14# 4. Check out the output
    15cat 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

Photo by Denys Nevozhai on Unsplash