Merged in feature/s3integration (pull request #47)
Set Up S3 integration * cfginterfaceandfirsts3funcs * addlocalstack * generallypassesfullsuite * addedmultipleattemptedpings * cleanup * stabiliseplusskip
This commit is contained in:
+11
-3
@@ -17,13 +17,15 @@ type Spec struct {
|
||||
Description string
|
||||
InfoInstanceName string
|
||||
SwaggerTemplate string
|
||||
LeftDelim string
|
||||
RightDelim string
|
||||
}
|
||||
|
||||
// ReadDoc parses SwaggerTemplate into swagger document.
|
||||
func (i *Spec) ReadDoc() string {
|
||||
i.Description = strings.ReplaceAll(i.Description, "\n", "\\n")
|
||||
|
||||
tpl, err := template.New("swagger_info").Funcs(template.FuncMap{
|
||||
tpl := template.New("swagger_info").Funcs(template.FuncMap{
|
||||
"marshal": func(v interface{}) string {
|
||||
a, _ := json.Marshal(v)
|
||||
|
||||
@@ -37,13 +39,19 @@ func (i *Spec) ReadDoc() string {
|
||||
|
||||
return strings.ReplaceAll(str, "\\\\\"", "\\\\\\\"")
|
||||
},
|
||||
}).Parse(i.SwaggerTemplate)
|
||||
})
|
||||
|
||||
if i.LeftDelim != "" && i.RightDelim != "" {
|
||||
tpl = tpl.Delims(i.LeftDelim, i.RightDelim)
|
||||
}
|
||||
|
||||
parsed, err := tpl.Parse(i.SwaggerTemplate)
|
||||
if err != nil {
|
||||
return i.SwaggerTemplate
|
||||
}
|
||||
|
||||
var doc bytes.Buffer
|
||||
if err = tpl.Execute(&doc, i); err != nil {
|
||||
if err = parsed.Execute(&doc, i); err != nil {
|
||||
return i.SwaggerTemplate
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user