Nowadays, building HTTP APIs for external use without delivering an OpenAPI spec is like shipping IKEA furniture without assembly instructions.
OpenAPI serves as an instruction manual for your API and is an open standard that can be interpreted by various tools to display information on how to interact with your API.
Today, we are excited to announce that Fiberplane has added automagical support for OpenAPI specs generated with Hono’s Zod OpenAPI extension, building an IKEA-grade catalog for your APIs directly into Fiberplane Studio!
OpenAPI Support in Fiberplane
Fiberplane’s initial support for OpenAPI specs integrates API documentation into Studio, providing a central place to test, debug, and verify your Hono APIs.
On one hand, the OpenAPI spec helps design the correct payload. On the other hand, it helps you verify if the schemas and routes are correctly defined with Zod and fine-tune your application’s API spec.
The Fiberplane client library now detects OpenAPI specs generated by OpenAPIHono
apps, and Fiberplane Studio displays the corresponding docs.
When an OpenAPI definition is detected, a new tab in Studio will show a given route’s docs.
You can view the expected responses and reference the required input parameters along with their types, making it simple to craft test payloads for your API.
Leveraging Hono Zod
Let’s look at how to set this up. First, create your Hono app with OpenAPI support:
The application can then use Zod schemas to define request and response parameters and bodies:
Next, you can leverage Zod to define the routes of your API and use the schemas you’ve defined:
Use the route in your application:
Generate OpenAPI docs from your application by adding:
And that’s it! You’ve now added OpenAPI support to your Hono application. Your documentation will automatically update whenever you change your code, and Studio will leverage your spec to provide a better development experience. Try it out by visiting the /doc
endpoint of your application!
That’s a wrap for today. Keep an eye out for our final Mega Launch Week release tomorrow.