OpenAPI Comment Parser for developers aims to make good API documentation easy to write and read.
APIs are essential to programming, but they can get complicated. IBM has launched a new tool for developers that should make writing API documentation a bit easier: The OpenAPI Comment Parser.
"Developers need instructions on how to use your API and they need a way to try it out. Good documentation handles both," IBM developer advocate Nicholas Bourdakos said in a blog post about the new developer tool.
OpenAPI is a specification that was built as a language-agnostic interface for RESTful APIs, "which allows both humans and computers to discover and understand the capabilities of the service without access to source code, documentation, or through network traffic inspection," said API tool maintainer Swagger.
The Comment Parser is designed to work around a problem that Bourdakos said is common for developers working with the OpenAPI specification: OpenAPI specs for recording comments have to be built and maintained manually, which means they often get forgotten and become bloated and useless.
SEE: Quick Glossary: DevOps (TechRepublic Premium)
"The goal of OpenAPI Comment Parser is to give developers a way to generate this OpenAPI spec from comments inline with their code," Bourdakos said.
The OpenAPI spec under the Comment Parser lives inside the code, broken up into smaller pieces that can be more easily updated because the need to go searching through a giant spec file is eliminated. "On average, this new format has been shown to reduce the amount of spec needed to be written by 50%," Bourdakos said.
Bourdakos gives a demonstration of how the OpenAPI Comment Parser works in a video, where he uses Docusaurus along with the Comment Parser to make an API documentation site. The graphical layout of the site pulls OpenAPI spec comments from his code and lays it out in an easy-to-see fashion using markdown.
The Docusaurus interface makes comments easy to see, search, and review, and because they're written in-line with the code, thanks to the Parser, a developer who needs to make changes to a particular section can simply update that comment.
The Comment Parser, Bourdakos said, is designed to make developer's lives easier by eliminating superfluous documentation code. Not only does this save time, but it also makes the code itself more manageable, he said.
SEE: Top 5 programming languages for systems admins to learn (free PDF) (TechRepublic)
Documentation generation by the Comment Parser can also be used to test the API, so developers can spend "less time waiting for a frontend to be built or having to rely on other tools in order to test drive their API," Bourdakos said.
IBM's OpenAPI Comment Parser was built for use with Node.js, but its command line interface will work with any language that uses a similar comment style. IBM will be adding support for additional "popular languages" in the future.
In the meantime, Devs that use Node.js or a language with a similar commenting format can now try the OpenAPI Comment Parser.
- Listen to TechRepublic's Dynamic Developer podcast (TechRepublic)
- How to become a developer: A cheat sheet (TechRepublic)
- Microservices: A cheat sheet (free PDF) (TechRepublic)
- Hiring Kit: .Net developer (TechRepublic Premium)
- Programming languages: Developers reveal most loved, most loathed, what pays best (ZDNet)
- It takes work to keep your data private online. These apps can help (CNET)
- Programming languages and developer career resources (TechRepublic on Flipboard)