apigen

module
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2026 License: MIT

README

Syfon API Generation

apigen is the committed OpenAPI generation output for Syfon.

Overview

Syfon uses oapi-codegen with Fiber v3 templates, not the stock Gin runtime. The generated packages under apigen/* are committed to the repository so the runtime boundary is visible in code review.

The generator configs live in apigen/specs/:

  • oapi-drs.yaml
  • oapi-internal.yaml
  • oapi-lfs.yaml
  • oapi-metrics.yaml
  • oapi-bucket.yaml

Each config points at local user templates in apigen/templates/:

Fiber templates
  • templates/fiber/fiber-interface.tmpl
    • Generates the server interface that receives fiber.Ctx plus typed params.
    • This is the main Fiber-specific replacement for the default interface template.
  • templates/fiber/fiber-middleware.tmpl
    • Generates the Fiber route wrapper that extracts path/query/header/cookie values.
    • It turns raw Fiber request data into typed operation parameters.
Strict templates
  • templates/strict/strict-fiber.tmpl
    • Generates strict request objects.
    • Builds the request body wrapper used by NewStrictHandler(...).
    • Handles Fiber body parsing, multipart readers, and response visiting.
  • templates/strict/strict-fiber-interface.tmpl
    • Generates strict server interfaces and response object types.
    • This is the layer the service implementations satisfy.
Regeneration

Use make gen from the repo root when changing:

  • the OpenAPI specs in apigen/api/*.openapi.yaml
  • the Fiber templates in apigen/templates/*
  • the generator configs in apigen/specs/*

The generated code is then consumed by:

  • cmd/server
  • internal/api/internaldrs
  • internal/api/lfs
  • internal/api/metrics
  • internal/api/routeutil
Upstream reference

The upstream generator docs are here:

oapi-codegen

Directories

Path Synopsis
client
bucketapi
Package bucketapi provides primitives to interact with the openapi HTTP API.
Package bucketapi provides primitives to interact with the openapi HTTP API.
drs
Package drs provides primitives to interact with the openapi HTTP API.
Package drs provides primitives to interact with the openapi HTTP API.
internalapi
Package internalapi provides primitives to interact with the openapi HTTP API.
Package internalapi provides primitives to interact with the openapi HTTP API.
lfsapi
Package lfsapi provides primitives to interact with the openapi HTTP API.
Package lfsapi provides primitives to interact with the openapi HTTP API.
metricsapi
Package metricsapi provides primitives to interact with the openapi HTTP API.
Package metricsapi provides primitives to interact with the openapi HTTP API.
Package model provides primitives to interact with the openapi HTTP API.
Package model provides primitives to interact with the openapi HTTP API.
server
bucketapi
Package bucketapi provides primitives to interact with the openapi HTTP API.
Package bucketapi provides primitives to interact with the openapi HTTP API.
drs
Package drs provides primitives to interact with the openapi HTTP API.
Package drs provides primitives to interact with the openapi HTTP API.
internalapi
Package internalapi provides primitives to interact with the openapi HTTP API.
Package internalapi provides primitives to interact with the openapi HTTP API.
lfsapi
Package lfsapi provides primitives to interact with the openapi HTTP API.
Package lfsapi provides primitives to interact with the openapi HTTP API.
metricsapi
Package metricsapi provides primitives to interact with the openapi HTTP API.
Package metricsapi provides primitives to interact with the openapi HTTP API.

Jump to

Keyboard shortcuts

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