Fix bug in dartgen: Increase the processing logic when route.RequestType is empty
This commit is contained in:
@@ -38,7 +38,7 @@ import '../data/{{with .Service}}{{.Name}}{{end}}.dart';
|
|||||||
///
|
///
|
||||||
/// request: {{with .RequestType}}{{.Name}}{{end}}
|
/// request: {{with .RequestType}}{{.Name}}{{end}}
|
||||||
/// response: {{with .ResponseType}}{{.Name}}{{end}}
|
/// response: {{with .ResponseType}}{{.Name}}{{end}}
|
||||||
Future {{normalizeHandlerName .Handler}}(
|
Future {{normalizeHandlerName .Handler}}(
|
||||||
{{if hasUrlPathParams $Route}}{{extractPositionalParamsFromPath $Route}},{{end}}
|
{{if hasUrlPathParams $Route}}{{extractPositionalParamsFromPath $Route}},{{end}}
|
||||||
{{if ne .Method "get"}}{{with .RequestType}}{{.Name}} request,{{end}}{{end}}
|
{{if ne .Method "get"}}{{with .RequestType}}{{.Name}} request,{{end}}{{end}}
|
||||||
{Function({{with .ResponseType}}{{.Name}}{{end}})? ok,
|
{Function({{with .ResponseType}}{{.Name}}{{end}})? ok,
|
||||||
|
|||||||
@@ -194,6 +194,10 @@ func extractPositionalParamsFromPath(route spec.Route) string {
|
|||||||
|
|
||||||
func makeDartRequestUrlPath(route spec.Route) string {
|
func makeDartRequestUrlPath(route spec.Route) string {
|
||||||
path := route.Path
|
path := route.Path
|
||||||
|
if route.RequestType == nil {
|
||||||
|
return `"` + path + `"`
|
||||||
|
}
|
||||||
|
|
||||||
ds, ok := route.RequestType.(spec.DefineStruct)
|
ds, ok := route.RequestType.(spec.DefineStruct)
|
||||||
if !ok {
|
if !ok {
|
||||||
return path
|
return path
|
||||||
|
|||||||
Reference in New Issue
Block a user