-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
The template added in #1774 breaks when there is one import mapping of value "-":
{{ if .ImportMapping }}
pathPrefix := path.Dir(pathToFile)
{{ end }}
{{ range $key, $value := .ImportMapping }}
{{ range $key, $value := .ImportMapping }}{{- if ne $value.Path "-"}}
for rawPath, rawFunc := range {{ $value.Name }}.PathToRawSpec(path.Join(pathPrefix, "{{ $key }}")) {
if _, ok := res[rawPath]; ok {
// it is not possible to compare functions in golang, so always overwrite the old value
}
res[rawPath] = rawFunc
}
{{- end }}
{{- end }}{{- end }}
return resResults in this generated code:
// Constructs a synthetic filesystem for resolving external references when loading openapi specifications.
func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) {
res := make(map[string]func() ([]byte, error))
if len(pathToFile) > 0 {
res[pathToFile] = rawSpec
}
pathPrefix := path.Dir(pathToFile)
return res
}And this error
go build
gen.go:366:2: declared and not used: pathPrefix
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working