February 2021 at AsyncAPI

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.

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:

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
    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

Photo by Denys Nevozhai on Unsplash