openapi

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2026 License: MIT Imports: 5 Imported by: 0

README

GoModularAuth OpenAPI Plugin (gomodularauth-openapi)

Go Reference

The OpenAPI Plugin dynamically inspects registered GoModularAuth plugins to generate complete OpenAPI 3.0 specifications.

Installation

go get github.com/BladiCreator/go-modular-auth/plugins/openapi

Quick Start

package main

import (
	"fmt"

	auth "github.com/BladiCreator/go-modular-auth"
	adaptermem "github.com/BladiCreator/go-modular-auth/adapters/memory"
	"github.com/BladiCreator/go-modular-auth/plugins/openapi"
)

func main() {
	engine, _ := auth.New(auth.Config{
		Adapter: adaptermem.NewAdapter(),
		Plugins: []auth.PluginModule{
			openapi.New(openapi.WithTitle("Platform Authentication API")),
		},
	})

	gen, _ := auth.Get[openapi.OpenAPIGenerator](engine)

	// Generate JSON specification
	jsonBytes, _ := gen.GenerateJSON(true)
	fmt.Println(string(jsonBytes))
}

Detailed guide: doc/plugins/openapi.md.

Documentation

Overview

Package openapi provides OpenAPI schema generation capabilities (reserved module).

Index

Constants

View Source
const PluginID = "openapi"

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Title       string
	Version     string
	Description string
}

type Module

type Module struct {
	// contains filtered or unexported fields
}

func New

func New(opts ...Option) *Module

func (*Module) ID

func (m *Module) ID() string

func (*Module) Init

func (m *Module) Init(h *auth.Host) error

type OpenAPIGenerator

type OpenAPIGenerator interface {
	Generate() (*spec.Document, error)
	GenerateJSON(indent bool) ([]byte, error)
}

type Option

type Option func(*Config)

func WithDescription

func WithDescription(desc string) Option

func WithTitle

func WithTitle(title string) Option

func WithVersion

func WithVersion(v string) Option

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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