oaswrap/spec — reverse-engineered prompt
Reverse engineered prompt
Build me a small Go library that lets developers define an API in code and generate a clean OpenAPI 3 spec from it. I want it to feel code first, so routes, groups, request bodies, responses, parameters, tags, servers, and security can be registered in Go instead of writing YAML by hand. It should work on its own for static spec generation, but also have optional adapters for common Go web routers so people can keep route registration and docs together.
Please support output as both YAML and pretty JSON, validation of the generated document, and reflection from Go structs for request, response, and parameter schemas using struct tags. It should handle modern OpenAPI versions, default to 3.1, and allow choosing 3.0 or 3.2 when needed. Include escape hatches for low level OpenAPI control, custom schema hooks, and stable output that is good for snapshot style tests.
Add a solid README, a quick start example, adapter examples, and tests that prove the generated spec is deterministic. Look up current OpenAPI details online if needed.
Want more depth? Deep Reverse