Files
Gumble-Backend/api/templates/server/builder.gotmpl
Zane Walker 7e940c83a7
Some checks failed
Build & Test / build-test (push) Has been cancelled
Build & Test / swagger-codegen-cli (push) Has been cancelled
CodeQL / Analyze (go) (push) Has been cancelled
(Feat): Initial Commit
2026-07-03 19:41:31 +05:30

50 lines
1.6 KiB
Go Template

// Code generated by go-swagger; DO NOT EDIT.
{{ if .Copyright -}}// {{ comment .Copyright -}}{{ end }}
package types
{{ $package := "types" }}
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
// NewSwaggerSpec creates a new SwaggerSpec instance
func NewSwaggerSpec() *SwaggerSpec {
spec := &SwaggerSpec{
Handlers: make(map[string]map[string]bool),
}
if len(spec.Handlers) == 0 {
spec.initHandlerCache()
}
return spec
}
/*SwaggerSpec {{ if .Info }}{{ if .Info.Description }}{{.Info.Description}}{{ else }}the {{ humanize .Name }} API{{ end }}{{ end }} */
type SwaggerSpec struct {
Handlers map[string]map[string]bool
}
func ({{.ReceiverName}} *SwaggerSpec) initHandlerCache() {
{{- if .Operations }}
{{.ReceiverName}}.Handlers = make(map[string]map[string]bool)
// https://swagger.io/specification/v2/ fixed fields: GET, PUT, POST, DELETE, OPTIONS, HEAD, PATCH
{{.ReceiverName}}.Handlers["GET"] = make(map[string]bool)
{{.ReceiverName}}.Handlers["PUT"] = make(map[string]bool)
{{.ReceiverName}}.Handlers["POST"] = make(map[string]bool)
{{.ReceiverName}}.Handlers["DELETE"] = make(map[string]bool)
{{.ReceiverName}}.Handlers["OPTIONS"] = make(map[string]bool)
{{.ReceiverName}}.Handlers["HEAD"] = make(map[string]bool)
{{.ReceiverName}}.Handlers["PATCH"] = make(map[string]bool)
{{ range .Operations }}
{{.ReceiverName}}.Handlers[{{ printf "%q" (upper .Method) }}][{{ if eq .Path "/" }}""{{ else }}{{ printf "%q" (cleanPath .Path) }}{{ end }}] = true
{{- end }}
{{- end }}
}