forked from loafle/openapi-generator-original
fix: go-server unresolved function NewstringFromValue for enums (#17316)
* fix: go-server unresolved function NewstringFromValue for enums * fix: go-server change isRef to isEnumRef in controller-api template
This commit is contained in:
@@ -181,20 +181,20 @@ func (c *{{classname}}Controller) {{nickname}}(w http.ResponseWriter, r *http.Re
|
||||
{{^isLong}}
|
||||
{{^isInteger}}
|
||||
{{^isDateTime}}
|
||||
{{^isEnumOrRef}}
|
||||
{{^isEnumRef}}
|
||||
{{paramName}}Param := {{#routers}}{{#mux}}params["{{baseName}}"]{{/mux}}{{#chi}}chi.URLParam(r, "{{baseName}}"){{/chi}}{{/routers}}
|
||||
if {{paramName}}Param == "" {
|
||||
c.errorHandler(w, r, &RequiredError{"{{baseName}}"}, nil)
|
||||
return
|
||||
}
|
||||
{{/isEnumOrRef}}
|
||||
{{#isEnumOrRef}}
|
||||
{{/isEnumRef}}
|
||||
{{#isEnumRef}}
|
||||
{{paramName}}Param, err := New{{dataType}}FromValue({{#routers}}{{#mux}}params["{{baseName}}"]{{/mux}}{{#chi}}chi.URLParam(r, "{{baseName}}"){{/chi}}{{/routers}})
|
||||
if err != nil {
|
||||
c.errorHandler(w, r, &ParsingError{Err: err}, nil)
|
||||
return
|
||||
}
|
||||
{{/isEnumOrRef}}
|
||||
{{/isEnumRef}}
|
||||
{{/isDateTime}}
|
||||
{{/isInteger}}
|
||||
{{/isLong}}
|
||||
@@ -423,24 +423,24 @@ func (c *{{classname}}Controller) {{nickname}}(w http.ResponseWriter, r *http.Re
|
||||
{{^required}}
|
||||
var {{paramName}}Param {{dataType}}
|
||||
if query.Has("{{baseName}}") {
|
||||
{{^isEnumOrRef}}
|
||||
{{^isEnumRef}}
|
||||
{{paramName}}Param = query.Get("{{baseName}}")
|
||||
{{/isEnumOrRef}}
|
||||
{{#isEnumOrRef}}
|
||||
{{/isEnumRef}}
|
||||
{{#isEnumRef}}
|
||||
var err error
|
||||
{{paramName}}Param, err = New{{dataType}}FromValue(query.Get("{{baseName}}"))
|
||||
if err != nil {
|
||||
c.errorHandler(w, r, &ParsingError{Err: err}, nil)
|
||||
return
|
||||
}
|
||||
{{/isEnumOrRef}}
|
||||
{{/isEnumRef}}
|
||||
}
|
||||
{{/required}}
|
||||
{{#required}}
|
||||
{{^isEnumOrRef}}
|
||||
{{^isEnumRef}}
|
||||
{{paramName}}Param := query.Get("{{baseName}}")
|
||||
{{/isEnumOrRef}}
|
||||
{{#isEnumOrRef}}
|
||||
{{/isEnumRef}}
|
||||
{{#isEnumRef}}
|
||||
if !query.Has("{{baseName}}"){
|
||||
c.errorHandler(w, r, &RequiredError{"{{baseName}}"}, nil)
|
||||
return
|
||||
@@ -450,7 +450,7 @@ func (c *{{classname}}Controller) {{nickname}}(w http.ResponseWriter, r *http.Re
|
||||
c.errorHandler(w, r, &ParsingError{Err: err}, nil)
|
||||
return
|
||||
}
|
||||
{{/isEnumOrRef}}
|
||||
{{/isEnumRef}}
|
||||
{{/required}}
|
||||
{{/defaultValue}}
|
||||
{{/isDateTime}}
|
||||
|
||||
Reference in New Issue
Block a user