Procedures to develop Node-RED node from OpenAPI document

Kazuhito Yokoi
7 min readMar 26, 2020

In this post, I will explain how to use the “Node generator” which makes it easy to create Node-RED nodes.

What is the Node generator?
Node generator is a command-line tool that can create custom nodes automatically. This tool provides functionality to generate the code of Node-RED node from Open API document like Swagger Codegen. In addition to the Open API document, it also supports JavaScript code in a function node as a source file. Using this tool, Node developers can easily develop and publish their custom nodes on the flow library to share them with other Node-RED users.

After Hitachi research & development group released this tool as open-source software, it has been managed as the sub-project of the Node-RED project under the OpenJS Foundation (Linux Foundation). Currently, the Node-RED development community has enhanced the functionality of this tool in a cooperative way.

As of now, not only Hitachi but also Node-RED user companies like Cisco and IBM have used this tool to develop their original nodes as you can see on the following websites.

What is the OpenAPI document?
OpenAPI document is a standard format to describe the specification of the REST API.

The OpenAPI document contains information about the description of the REST API, HTTP methods about how to access the REST API in YAML or JSON format as above example.

Generating Node-RED node from OpenAPI document
From now on, I will try to generate the Node-RED node from the OpenAPI document. In the following procedures, I will use the OpenAPI document of the REST API which retrieves the location information of the International Space Station (ISS).