swaglay

module
v0.0.11 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 10, 2026 License: LGPL-3.0

README

SwagLay - Swagger Overlay

High performance wrapper for swagger documentation in golang.

GoDoc

Usage

See example fiber project here.

Features
  • Fast: Documentation is generated transparently before announcing roots and does not appear anywhere further on
  • OpenAPI 3 generation. All registered routes are collected in a global rest.API and can be exported with Api.Spec().
  • Generic route registration: Define handlers with input and output types using helpers like RegisterHandlerIO or Fiber adapter functions such as GetIO. The library automatically registers the models in the API specification.
  • Context aware DTOs. Structs implementing AwareCtx receive the current request context allowing handlers to access request data directly.
  • Support GET, POST, PUT, DELETE methods
    • Automatically decode and validate query string(GET and DELETE)
    • Automatically decode and validate JSON body(POST and PUT)
  • Customisable schemas. Use rest.ModelOpts like WithDescription, WithNullable or WithEnumValues to fine tune the generated schema.
  • Custom Error handling
    • Common errors
    • Validation errors
Examples
Documentation

The library revolves around a global instance of Api created via SetupApi. Handlers are registered using the generic helper functions from. Once all handlers have been added, call Api.Spec() to get the value of openapi3.T and represent it as JSON.

How to test.
make run_tests

# If coverage needed
make run_coverage_test

Directories

Path Synopsis
pkg

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL