The following section covers the components of Go frameworks and their library components that NightVision’s API Discovery capability can detect and use to generate OpenAPI documentation. If a component that you use is not supported, please get in touch with our support team at support@nightviz.ai, and we can add this as a new feature.
Major-version import suffixes are handled automatically: a package imported as github.com/labstack/echo/v4, github.com/gofiber/fiber/v2, or github.com/go-chi/chi/v5 is recognized the same as its unversioned import path, so the tables below apply regardless of the module major version in use.
Imported as github.com/labstack/echo/v4. The verb methods are shared between the Echo instance and any Group created from it, so e.GET(...) and group.GET(...) are both recognized.
| Library Component | Description |
|---|
| New | Function to create a new Echo instance. |
| Echo.GET | Method to register a handler for HTTP GET requests. |
| Echo.POST | Method to register a handler for HTTP POST requests. |
| Echo.PUT | Method to register a handler for HTTP PUT requests. |
| Echo.DELETE | Method to register a handler for HTTP DELETE requests. |
| Echo.PATCH | Method to register a handler for HTTP PATCH requests. |
| Echo.OPTIONS | Method to register a handler for HTTP OPTIONS requests. |
| Echo.HEAD | Method to register a handler for HTTP HEAD requests. |
| Echo.CONNECT | Method to register a handler for HTTP CONNECT requests. |
| Echo.TRACE | Method to register a handler for HTTP TRACE requests. |
| Echo.Any | Method to register a handler for all standard HTTP methods. |
| Echo.Match | Method to register a handler for an explicit list of HTTP methods. |
| Echo.Add | Method to register a handler for a method supplied as a string. |
| Echo.Group | Method to create a sub-router that shares a common route prefix. |
| Context.Param | Method to get a path parameter from the URL. |
| Context.QueryParam | Method to get a query parameter from the URL. |
| Context.FormValue | Method to get a form value from the request body. |
| Context.Bind | Method to bind the request body to a struct. |
Imported as github.com/gofiber/fiber/v2.
| Library Component | Description |
|---|
| New | Function to create a new App instance. |
| App.Get | Method to register a handler for HTTP GET requests. |
| App.Post | Method to register a handler for HTTP POST requests. |
| App.Put | Method to register a handler for HTTP PUT requests. |
| App.Delete | Method to register a handler for HTTP DELETE requests. |
| App.Patch | Method to register a handler for HTTP PATCH requests. |
| App.Head | Method to register a handler for HTTP HEAD requests. |
| App.Options | Method to register a handler for HTTP OPTIONS requests. |
| App.Connect | Method to register a handler for HTTP CONNECT requests. |
| App.Trace | Method to register a handler for HTTP TRACE requests. |
| App.All | Method to register a handler for all standard HTTP methods. |
| App.Add | Method to register a handler for a method supplied as a string. |
| App.Group | Method to create a sub-router that shares a common route prefix. |
| App.Route | Method to build routes for a shared prefix. |
| Ctx.Params | Method to get a path parameter from the URL. |
| Ctx.Query | Method to get a query parameter from the URL. |
| Ctx.FormValue | Method to get a form value from the request body. |
| Ctx.BodyParser | Method to bind the request body to a struct. |
| Ctx.QueryParser | Method to bind query parameters to a struct. |
Imported as github.com/go-chi/chi/v5.
| Library Component | Description |
|---|
| NewRouter | Function to create a new Mux router. |
| NewMux | Function to create a new Mux router. |
| URLParam | Function to read a path parameter from the request. |
| Mux.Get | Method to register a handler for HTTP GET requests. |
| Mux.Post | Method to register a handler for HTTP POST requests. |
| Mux.Put | Method to register a handler for HTTP PUT requests. |
| Mux.Delete | Method to register a handler for HTTP DELETE requests. |
| Mux.Patch | Method to register a handler for HTTP PATCH requests. |
| Mux.Head | Method to register a handler for HTTP HEAD requests. |
| Mux.Options | Method to register a handler for HTTP OPTIONS requests. |
| Mux.Connect | Method to register a handler for HTTP CONNECT requests. |
| Mux.Trace | Method to register a handler for HTTP TRACE requests. |
| Mux.HandleFunc | Method to register a handler for all HTTP methods on a pattern. |
| Mux.Handle | Method to register an http.Handler for all methods on a pattern. |
| Mux.MethodFunc | Method to register a handler for a method supplied as a string. |
| Mux.Method | Method to register an http.Handler for a method supplied as a string. |
| Mux.Route | Method to create a sub-router mounted at a pattern. |
| Mux.Group | Method to create an inline group that shares middleware. |
| Mux.Mount | Method to attach another handler or router under a pattern. |
| Mux.With | Method to add inline middleware for an endpoint. |
| Library Component | Description |
|---|
| New | Function to create a new HTTP router instance. |
| Router.PATCH | Method to handle HTTP PATCH requests. |
| Router.ServeHTTP | Method to serve HTTP requests, implementing the http.Handler interface. |
| Router.GET | Method to handle HTTP GET requests. |
| Router.POST | Method to handle HTTP POST requests. |
| Router.PUT | Method to handle HTTP PUT requests. |
| Router.DELETE | Method to handle HTTP DELETE requests. |
| Router.OPTIONS | Method to handle HTTP OPTIONS requests. |
NightVision follows the command trees registered through these CLI frameworks so that routes registered inside a command handler are discovered.
| Library Component | Description |
|---|
NewApp | Function to create a new CLI application instance. |
App | Represents a CLI application in the Urfave CLI library. |
App.Run | Method to run the CLI application. |
Command | Command represents a subcommands and commands for a cli.App |
| Library Component | Description |
|---|
| Command | Represents a command in the Serpent CLI library. |
| Command.Invoke | Method to begin an invocation for the command. |
| Command.AddSubcommands | Method to attach child commands to this command. |
| Invocation.WithOS | Method that configures the invocation with OS arguments and streams. |
| Invocation.Run | Method to dispatch the matched command and its subcommands. |
NightVision runs the constructors and functions wired through an fx application so that routes registered by a wired function are discovered.
| Library Component | Description |
|---|
| New | Function to construct an fx application from a set of options. |
| Module | Function to group options into a named module. |
| Options | Function to bundle multiple options into one. |
| Invoke | Function to register functions that fx runs at application start. |
| Provide | Function to register constructors that supply the application’s dependencies. |
| Annotate | Function to attach annotations to a constructor or invoked function. |
| Annotated | Struct that wraps a constructor with annotations via its Target field. |
NightVision reads authentication guards on Go routes and records them as OpenAPI security schemes. See the Framework Support Index for how schemes and the x-unsound marker are represented. A route is recognized as secured when a documented auth library is used, or when a middleware or handler reads a credential header and rejects unauthenticated requests with a 401/403.
Resolved by import path, so the scheme is read directly from the library:
| Library | OpenAPI Security Scheme |
|---|
github.com/golang-jwt/jwt, github.com/labstack/echo-jwt, labstack/echo middleware.JWT, github.com/appleboy/gin-jwt, github.com/gofiber/jwt (jwtware), github.com/gofiber/contrib/jwt, github.com/go-chi/jwtauth | HTTP bearer (JWT) |
github.com/gin-gonic/gin gin.BasicAuth, labstack/echo middleware.BasicAuth, github.com/gofiber/fiber/middleware/basicauth | HTTP basic |
github.com/gofiber/keyauth, labstack/echo middleware.KeyAuth | Bearer, or API key in a header, query parameter, or cookie, per the KeyLookup/AuthScheme configuration |
go-chi/jwtauth’s Verifier alone does not secure a route (it only parses the token into the request context); the paired Authenticator middleware is what rejects unauthenticated requests.
When no documented library is matched, a route is secured if a middleware or handler reads a credential and challenges unauthenticated requests. These derivations are flagged x-unsound because enforcement is inferred from behavior rather than read from a library:
| Pattern | OpenAPI Security Scheme |
|---|
Reads the Authorization header (or (*http.Request).BasicAuth()) and returns 401/403 | HTTP bearer by default; HTTP basic or digest when the code compares the value against a "Basic "/"Digest "/"Bearer " scheme prefix |
Reads an API-key header (X-API-Key, X-Auth-Token, Api-Key, and similar) and returns 401/403 | API key (header) |
gorilla/mux Headers("Authorization", "") or HeadersRegexp("Authorization", "^Bearer") route matchers | HTTP bearer, or the scheme named by the regular expression |
Go auth extraction records the scheme and transport only; role and scope names are not extracted.
| Scheme key | OpenAPI type |
|---|
bearerAuth | http, scheme bearer, bearerFormat JWT |
basicAuth | http, scheme basic |
digestAuth | http, scheme digest |
apiKey / apiKeyQuery | apiKey in a header (default name X-API-Key) or query parameter (default name api_key) |
sessionAuth | apiKey in a cookie (default name session) |