{"modulePath":"github.com/oapi-codegen/oapi-codegen-exp/experimental","version":"v0.0.0-20260413235603-d24950bd28cc","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package templates\n\n## Variables\n\n```go\nvar ChiReceiverTemplates = map[string]ReceiverTemplate{\n\t\"receiver\": {\n\t\tName: \"receiver\",\n\t\tImports: []Import{\n\t\t\t{Path: \"encoding/json\"},\n\t\t\t{Path: \"fmt\"},\n\t\t\t{Path: \"net/http\"},\n\t\t\t{Path: \"net/url\"},\n\t\t},\n\t\tTemplate: \"server/chi/receiver.go.tmpl\",\n\t},\n}\n```\nChiReceiverTemplates contains receiver templates for Chi servers.\n\n```go\nvar ChiServerTemplates = map[string]ServerTemplate{\n\t\"interface\": {\n\t\tName: \"interface\",\n\t\tImports: []Import{\n\t\t\t{Path: \"net/http\"},\n\t\t},\n\t\tTemplate: \"server/chi/interface.go.tmpl\",\n\t},\n\t\"handler\": {\n\t\tName: \"handler\",\n\t\tImports: []Import{\n\t\t\t{Path: \"net/http\"},\n\t\t\t{Path: \"github.com/go-chi/chi/v5\"},\n\t\t},\n\t\tTemplate: \"server/chi/handler.go.tmpl\",\n\t},\n\t\"wrapper\": {\n\t\tName: \"wrapper\",\n\t\tImports: []Import{\n\t\t\t{Path: \"encoding/json\"},\n\t\t\t{Path: \"fmt\"},\n\t\t\t{Path: \"net/http\"},\n\t\t\t{Path: \"net/url\"},\n\t\t\t{Path: \"github.com/go-chi/chi/v5\"},\n\t\t},\n\t\tTemplate: \"server/chi/wrapper.go.tmpl\",\n\t},\n}\n```\nChiServerTemplates contains templates for Chi server generation.\n\n```go\nvar ClientTemplates = map[string]ClientTemplate{\n\t\"base\": {\n\t\tName: \"base\",\n\t\tImports: []Import{\n\t\t\t{Path: \"context\"},\n\t\t\t{Path: \"net/http\"},\n\t\t\t{Path: \"net/url\"},\n\t\t\t{Path: \"strings\"},\n\t\t},\n\t\tTemplate: \"client/base.go.tmpl\",\n\t},\n}\n```\nClientTemplates contains the base template for client generation.\n\n```go\nvar EchoReceiverTemplates = map[string]ReceiverTemplate{\n\t\"receiver\": {\n\t\tName: \"receiver\",\n\t\tImports: []Import{\n\t\t\t{Path: \"encoding/json\"},\n\t\t\t{Path: \"fmt\"},\n\t\t\t{Path: \"net/http\"},\n\t\t\t{Path: \"net/url\"},\n\t\t\t{Path: \"github.com/labstack/echo/v5\"},\n\t\t},\n\t\tTemplate: \"server/echo/receiver.go.tmpl\",\n\t},\n}\n```\nEchoReceiverTemplates contains receiver templates for Echo v5 servers.\n\n```go\nvar EchoServerTemplates = map[string]ServerTemplate{\n\t\"interface\": {\n\t\tName: \"interface\",\n\t\tImports: []Import{\n\t\t\t{Path: \"net/http\"},\n\t\t\t{Path: \"github.com/labstack/echo/v5\"},\n\t\t},\n\t\tTemplate: \"server/echo/interface.go.tmpl\",\n\t},\n\t\"handler\": {\n\t\tName: \"handler\",\n\t\tImports: []Import{\n\t\t\t{Path: \"github.com/labstack/echo/v5\"},\n\t\t},\n\t\tTemplate: \"server/echo/handler.go.tmpl\",\n\t},\n\t\"wrapper\": {\n\t\tName: \"wrapper\",\n\t\tImports: []Import{\n\t\t\t{Path: \"encoding/json\"},\n\t\t\t{Path: \"fmt\"},\n\t\t\t{Path: \"net/http\"},\n\t\t\t{Path: \"net/url\"},\n\t\t\t{Path: \"github.com/labstack/echo/v5\"},\n\t\t},\n\t\tTemplate: \"server/echo/wrapper.go.tmpl\",\n\t},\n}\n```\nEchoServerTemplates contains templates for Echo v5 server generation.\n\n```go\nvar EchoV4ReceiverTemplates = map[string]ReceiverTemplate{\n\t\"receiver\": {\n\t\tName: \"receiver\",\n\t\tImports: []Import{\n\t\t\t{Path: \"encoding/json\"},\n\t\t\t{Path: \"fmt\"},\n\t\t\t{Path: \"net/http\"},\n\t\t\t{Path: \"net/url\"},\n\t\t\t{Path: \"github.com/labstack/echo/v4\"},\n\t\t},\n\t\tTemplate: \"server/echo-v4/receiver.go.tmpl\",\n\t},\n}\n```\nEchoV4ReceiverTemplates contains receiver templates for Echo v4 servers.\n\n```go\nvar EchoV4ServerTemplates = map[string]ServerTemplate{\n\t\"interface\": {\n\t\tName: \"interface\",\n\t\tImports: []Import{\n\t\t\t{Path: \"net/http\"},\n\t\t\t{Path: \"github.com/labstack/echo/v4\"},\n\t\t},\n\t\tTemplate: \"server/echo-v4/interface.go.tmpl\",\n\t},\n\t\"handler\": {\n\t\tName: \"handler\",\n\t\tImports: []Import{\n\t\t\t{Path: \"github.com/labstack/echo/v4\"},\n\t\t},\n\t\tTemplate: \"server/echo-v4/handler.go.tmpl\",\n\t},\n\t\"wrapper\": {\n\t\tName: \"wrapper\",\n\t\tImports: []Import{\n\t\t\t{Path: \"encoding/json\"},\n\t\t\t{Path: \"fmt\"},\n\t\t\t{Path: \"net/http\"},\n\t\t\t{Path: \"net/url\"},\n\t\t\t{Path: \"github.com/labstack/echo/v4\"},\n\t\t},\n\t\tTemplate: \"server/echo-v4/wrapper.go.tmpl\",\n\t},\n}\n```\nEchoV4ServerTemplates contains templates for Echo v4 server generation.\n\n```go\nvar FiberReceiverTemplates = map[string]ReceiverTemplate{\n\t\"receiver\": {\n\t\tName: \"receiver\",\n\t\tImports: []Import{\n\t\t\t{Path: \"encoding/json\"},\n\t\t\t{Path: \"fmt\"},\n\t\t\t{Path: \"net/http\"},\n\t\t\t{Path: \"net/url\"},\n\t\t\t{Path: \"github.com/gofiber/fiber/v3\"},\n\t\t},\n\t\tTemplate: \"server/fiber/receiver.go.tmpl\",\n\t},\n}\n```\nFiberReceiverTemplates contains receiver templates for Fiber servers.\n\n```go\nvar FiberServerTemplates = map[string]ServerTemplate{\n\t\"interface\": {\n\t\tName: \"interface\",\n\t\tImports: []Import{\n\t\t\t{Path: \"github.com/gofiber/fiber/v3\"},\n\t\t},\n\t\tTemplate: \"server/fiber/interface.go.tmpl\",\n\t},\n\t\"handler\": {\n\t\tName: \"handler\",\n\t\tImports: []Import{\n\t\t\t{Path: \"github.com/gofiber/fiber/v3\"},\n\t\t},\n\t\tTemplate: \"server/fiber/handler.go.tmpl\",\n\t},\n\t\"wrapper\": {\n\t\tName: \"wrapper\",\n\t\tImports: []Import{\n\t\t\t{Path: \"encoding/json\"},\n\t\t\t{Path: \"fmt\"},\n\t\t\t{Path: \"net/http\"},\n\t\t\t{Path: \"net/url\"},\n\t\t\t{Path: \"github.com/gofiber/fiber/v3\"},\n\t\t},\n\t\tTemplate: \"server/fiber/wrapper.go.tmpl\",\n\t},\n}\n```\nFiberServerTemplates contains templates for Fiber server generation.\n\n```go\nvar GinReceiverTemplates = map[string]ReceiverTemplate{\n\t\"receiver\": {\n\t\tName: \"receiver\",\n\t\tImports: []Import{\n\t\t\t{Path: \"encoding/json\"},\n\t\t\t{Path: \"fmt\"},\n\t\t\t{Path: \"net/http\"},\n\t\t\t{Path: \"net/url\"},\n\t\t\t{Path: \"github.com/gin-gonic/gin\"},\n\t\t},\n\t\tTemplate: \"server/gin/receiver.go.tmpl\",\n\t},\n}\n```\nGinReceiverTemplates contains receiver templates for Gin servers.\n\n```go\nvar GinServerTemplates = map[string]ServerTemplate{\n\t\"interface\": {\n\t\tName: \"interface\",\n\t\tImports: []Import{\n\t\t\t{Path: \"net/http\"},\n\t\t\t{Path: \"github.com/gin-gonic/gin\"},\n\t\t},\n\t\tTemplate: \"server/gin/interface.go.tmpl\",\n\t},\n\t\"handler\": {\n\t\tName: \"handler\",\n\t\tImports: []Import{\n\t\t\t{Path: \"github.com/gin-gonic/gin\"},\n\t\t},\n\t\tTemplate: \"server/gin/handler.go.tmpl\",\n\t},\n\t\"wrapper\": {\n\t\tName: \"wrapper\",\n\t\tImports: []Import{\n\t\t\t{Path: \"encoding/json\"},\n\t\t\t{Path: \"fmt\"},\n\t\t\t{Path: \"net/http\"},\n\t\t\t{Path: \"net/url\"},\n\t\t\t{Path: \"github.com/gin-gonic/gin\"},\n\t\t},\n\t\tTemplate: \"server/gin/wrapper.go.tmpl\",\n\t},\n}\n```\nGinServerTemplates contains templates for Gin server generation.\n\n```go\nvar GorillaReceiverTemplates = map[string]ReceiverTemplate{\n\t\"receiver\": {\n\t\tName: \"receiver\",\n\t\tImports: []Import{\n\t\t\t{Path: \"encoding/json\"},\n\t\t\t{Path: \"fmt\"},\n\t\t\t{Path: \"net/http\"},\n\t\t\t{Path: \"net/url\"},\n\t\t},\n\t\tTemplate: \"server/gorilla/receiver.go.tmpl\",\n\t},\n}\n```\nGorillaReceiverTemplates contains receiver templates for Gorilla servers.\n\n```go\nvar GorillaServerTemplates = map[string]ServerTemplate{\n\t\"interface\": {\n\t\tName: \"interface\",\n\t\tImports: []Import{\n\t\t\t{Path: \"net/http\"},\n\t\t},\n\t\tTemplate: \"server/gorilla/interface.go.tmpl\",\n\t},\n\t\"handler\": {\n\t\tName: \"handler\",\n\t\tImports: []Import{\n\t\t\t{Path: \"net/http\"},\n\t\t\t{Path: \"github.com/gorilla/mux\"},\n\t\t},\n\t\tTemplate: \"server/gorilla/handler.go.tmpl\",\n\t},\n\t\"wrapper\": {\n\t\tName: \"wrapper\",\n\t\tImports: []Import{\n\t\t\t{Path: \"encoding/json\"},\n\t\t\t{Path: \"fmt\"},\n\t\t\t{Path: \"net/http\"},\n\t\t\t{Path: \"net/url\"},\n\t\t\t{Path: \"github.com/gorilla/mux\"},\n\t\t},\n\t\tTemplate: \"server/gorilla/wrapper.go.tmpl\",\n\t},\n}\n```\nGorillaServerTemplates contains templates for Gorilla server generation.\n\n```go\nvar InitiatorTemplates = map[string]InitiatorTemplate{\n\t\"initiator_base\": {\n\t\tName: \"initiator_base\",\n\t\tImports: []Import{\n\t\t\t{Path: \"context\"},\n\t\t\t{Path: \"net/http\"},\n\t\t},\n\t\tTemplate: \"initiator/base.go.tmpl\",\n\t},\n}\n```\nInitiatorTemplates contains the base template for initiator generation.\n\n```go\nvar IrisReceiverTemplates = map[string]ReceiverTemplate{\n\t\"receiver\": {\n\t\tName: \"receiver\",\n\t\tImports: []Import{\n\t\t\t{Path: \"encoding/json\"},\n\t\t\t{Path: \"fmt\"},\n\t\t\t{Path: \"net/http\"},\n\t\t\t{Path: \"net/url\"},\n\t\t\t{Path: \"github.com/kataras/iris/v12\"},\n\t\t},\n\t\tTemplate: \"server/iris/receiver.go.tmpl\",\n\t},\n}\n```\nIrisReceiverTemplates contains receiver templates for Iris servers.\n\n```go\nvar IrisServerTemplates = map[string]ServerTemplate{\n\t\"interface\": {\n\t\tName: \"interface\",\n\t\tImports: []Import{\n\t\t\t{Path: \"net/http\"},\n\t\t\t{Path: \"github.com/kataras/iris/v12\"},\n\t\t},\n\t\tTemplate: \"server/iris/interface.go.tmpl\",\n\t},\n\t\"handler\": {\n\t\tName: \"handler\",\n\t\tImports: []Import{\n\t\t\t{Path: \"github.com/kataras/iris/v12\"},\n\t\t},\n\t\tTemplate: \"server/iris/handler.go.tmpl\",\n\t},\n\t\"wrapper\": {\n\t\tName: \"wrapper\",\n\t\tImports: []Import{\n\t\t\t{Path: \"encoding/json\"},\n\t\t\t{Path: \"fmt\"},\n\t\t\t{Path: \"net/http\"},\n\t\t\t{Path: \"net/url\"},\n\t\t\t{Path: \"github.com/kataras/iris/v12\"},\n\t\t},\n\t\tTemplate: \"server/iris/wrapper.go.tmpl\",\n\t},\n}\n```\nIrisServerTemplates contains templates for Iris server generation.\n\n```go\nvar SenderTemplates = map[string]SenderTemplate{\n\t\"sender_interface\": {\n\t\tName: \"sender_interface\",\n\t\tImports: []Import{\n\t\t\t{Path: \"context\"},\n\t\t\t{Path: \"io\"},\n\t\t\t{Path: \"net/http\"},\n\t\t},\n\t\tTemplate: \"sender/interface.go.tmpl\",\n\t},\n\t\"sender_methods\": {\n\t\tName: \"sender_methods\",\n\t\tImports: []Import{\n\t\t\t{Path: \"context\"},\n\t\t\t{Path: \"io\"},\n\t\t\t{Path: \"net/http\"},\n\t\t},\n\t\tTemplate: \"sender/methods.go.tmpl\",\n\t},\n\t\"sender_request_builders\": {\n\t\tName: \"sender_request_builders\",\n\t\tImports: []Import{\n\t\t\t{Path: \"bytes\"},\n\t\t\t{Path: \"encoding/json\"},\n\t\t\t{Path: \"fmt\"},\n\t\t\t{Path: \"io\"},\n\t\t\t{Path: \"net/http\"},\n\t\t\t{Path: \"net/url\"},\n\t\t\t{Path: \"strings\"},\n\t\t},\n\t\tTemplate: \"sender/request_builders.go.tmpl\",\n\t},\n\t\"sender_simple\": {\n\t\tName: \"sender_simple\",\n\t\tImports: []Import{\n\t\t\t{Path: \"context\"},\n\t\t\t{Path: \"encoding/json\"},\n\t\t\t{Path: \"fmt\"},\n\t\t\t{Path: \"io\"},\n\t\t\t{Path: \"net/http\"},\n\t\t},\n\t\tTemplate: \"sender/simple.go.tmpl\",\n\t},\n}\n```\nSenderTemplates contains templates shared between client and initiator generators.\n\n```go\nvar SharedServerTemplates = map[string]ServerTemplate{\n\t\"errors\": {\n\t\tName: \"errors\",\n\t\tImports: []Import{\n\t\t\t{Path: \"fmt\"},\n\t\t},\n\t\tTemplate: \"server/errors.go.tmpl\",\n\t},\n\t\"param_types\": {\n\t\tName:     \"param_types\",\n\t\tImports:  []Import{},\n\t\tTemplate: \"server/param_types.go.tmpl\",\n\t},\n}\n```\nSharedServerTemplates contains templates shared across all server implementations.\n\n```go\nvar StdHTTPReceiverTemplates = map[string]ReceiverTemplate{\n\t\"receiver\": {\n\t\tName: \"receiver\",\n\t\tImports: []Import{\n\t\t\t{Path: \"encoding/json\"},\n\t\t\t{Path: \"fmt\"},\n\t\t\t{Path: \"net/http\"},\n\t\t\t{Path: \"net/url\"},\n\t\t},\n\t\tTemplate: \"server/stdhttp/receiver.go.tmpl\",\n\t},\n}\n```\nStdHTTPReceiverTemplates contains receiver templates for StdHTTP servers.\n\n```go\nvar StdHTTPServerTemplates = map[string]ServerTemplate{\n\t\"interface\": {\n\t\tName: \"interface\",\n\t\tImports: []Import{\n\t\t\t{Path: \"net/http\"},\n\t\t},\n\t\tTemplate: \"server/stdhttp/interface.go.tmpl\",\n\t},\n\t\"handler\": {\n\t\tName: \"handler\",\n\t\tImports: []Import{\n\t\t\t{Path: \"net/http\"},\n\t\t},\n\t\tTemplate: \"server/stdhttp/handler.go.tmpl\",\n\t},\n\t\"wrapper\": {\n\t\tName: \"wrapper\",\n\t\tImports: []Import{\n\t\t\t{Path: \"encoding/json\"},\n\t\t\t{Path: \"fmt\"},\n\t\t\t{Path: \"net/http\"},\n\t\t\t{Path: \"net/url\"},\n\t\t},\n\t\tTemplate: \"server/stdhttp/wrapper.go.tmpl\",\n\t},\n}\n```\nStdHTTPServerTemplates contains templates for StdHTTP server generation.\n\n```go\nvar TemplateFS embed.FS\n```\nTemplateFS contains all embedded template files. The files/\\* pattern recursively includes all files in subdirectories.\n\n## Functions\n\n```go\nfunc Funcs() template.FuncMap\n```\nFuncs returns the template function map for server templates.\n\n```go\nfunc PathToChiPattern(path string) string\n```\nPathToChiPattern converts an OpenAPI path template to a Chi-compatible pattern. OpenAPI: /users/{user\\_id}/posts/{post\\_id} Chi: /users/{user\\_id}/posts/{post\\_id}\n\n```go\nfunc PathToEchoPattern(path string) string\n```\nPathToEchoPattern converts an OpenAPI path template to an Echo-compatible pattern. OpenAPI: /users/{user\\_id}/posts/{post\\_id} Echo: /users/:user\\_id/posts/:post\\_id\n\n```go\nfunc PathToFiberPattern(path string) string\n```\nPathToFiberPattern converts an OpenAPI path template to a Fiber-compatible pattern. OpenAPI: /users/{user\\_id}/posts/{post\\_id} Fiber: /users/:user\\_id/posts/:post\\_id\n\n```go\nfunc PathToGinPattern(path string) string\n```\nPathToGinPattern converts an OpenAPI path template to a Gin-compatible pattern. OpenAPI: /users/{user\\_id}/posts/{post\\_id} Gin: /users/:user\\_id/posts/:post\\_id\n\n```go\nfunc PathToGorillaPattern(path string) string\n```\nPathToGorillaPattern converts an OpenAPI path template to a Gorilla Mux-compatible pattern. OpenAPI: /users/{user\\_id}/posts/{post\\_id} Gorilla: /users/{user\\_id}/posts/{post\\_id}\n\n```go\nfunc PathToIrisPattern(path string) string\n```\nPathToIrisPattern converts an OpenAPI path template to an Iris-compatible pattern. OpenAPI: /users/{user\\_id}/posts/{post\\_id} Iris: /users/:user\\_id/posts/:post\\_id\n\n```go\nfunc PathToStdHTTPPattern(path string) string\n```\nPathToStdHTTPPattern converts an OpenAPI path template to a Go 1.22+ std http pattern. OpenAPI: /users/{user\\_id}/posts/{post\\_id} StdHTTP: /users/{user\\_id}/posts/{post\\_id} Special case: \"/\" becomes \"/{$}\" to match only the root path.\n\n```go\nfunc ToGoIdentifier(s string) string\n```\nToGoIdentifier converts a string to a valid Go identifier. This is a simple version for template usage.\n\n## Types\n\n```go\ntype ClientTemplate struct {\n\tName     string   // Template name (e.g., \"base\")\n\tImports  []Import // Required imports for this template\n\tTemplate string   // Template path in embedded FS\n}\n```\nClientTemplate defines a template for client generation.\n\n```go\ntype Import struct {\n\tPath  string\n\tAlias string // empty if no alias\n}\n```\nImport represents a Go import with optional alias.\n\n```go\ntype InitiatorTemplate struct {\n\tName     string   // Template name (e.g., \"initiator_base\")\n\tImports  []Import // Required imports for this template\n\tTemplate string   // Template path in embedded FS\n}\n```\nInitiatorTemplate defines a template for initiator (webhook/callback sender) generation.\n\n```go\ntype ReceiverTemplate struct {\n\tName     string   // Template name (e.g., \"receiver\")\n\tImports  []Import // Required imports for this template\n\tTemplate string   // Template path in embedded FS\n}\n```\nReceiverTemplate defines a template for receiver (webhook/callback) generation.\n\n```go\ntype SenderTemplate struct {\n\tName     string   // Template name (e.g., \"sender_interface\")\n\tImports  []Import // Required imports for this template\n\tTemplate string   // Template path in embedded FS\n}\n```\nSenderTemplate defines a template shared between client and initiator generation.\n\n```go\ntype ServerTemplate struct {\n\tName     string   // Template name (e.g., \"interface\", \"handler\")\n\tImports  []Import // Required imports for this template\n\tTemplate string   // Template path in embedded FS\n}\n```\nServerTemplate defines a template for server generation.\n\n","path":"github.com/oapi-codegen/oapi-codegen-exp/experimental/codegen/internal/templates","name":"templates","synopsis":"","isRedistributable":true}
