I recently dedicated a bit of free time to trying out the huma/sqlc/goose Go stack recommended by Blain Smith.

The tl;dr on that particular experiment is that the components work just about as well as advertised.1

But in the course of reading/learning about huma, I stumbled upon restish: a CLI tool that “learns” REST APIs from openapi specs (which, not to put too fine a point on it, huma assembles and exposes as JSON for you), and then lets you talk to them from the command line - complete with proper shell tab-completion… output prettification… the works! It has the potential to simplify a lot of (what were previously) curl+jq workflows.

And naturally, restish is written in Go - using spf13/cobra for its command-line parsing & dynamic completions-generation, and using the “charmbracelet cinematic universe” to render its prettified outputs. 🥰

 


Footnotes:
  1. The only speedbump I hit was related to making huma play nice with sessionup (the session-management package I was using): sessionup’s API deals - quite reasonably, imo - in the http.ResponseWriter and *http.Request primitives that the standard-library’s net/http package exposes. But huma tries to abstract away from those primitives in favor of its own, higher-level ones. So in order to be able to access sessionup’s API from inside huma’s handlers, I had to write a custom huma middleware that grabbed the http.ResponseWriter and *http.Request objects and placed them on the request context exposed by huma, so they are then accessible inside a huma handler.