generate needed types for http client

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
Василий Толстов 2021-01-14 14:27:41 +03:00
parent 4993c2ec68
commit 30994d5c62
2 changed files with 15 additions and 3 deletions

File diff suppressed because one or more lines are too long

View File

@ -4,6 +4,7 @@ package {{goPkgLastElement .File | splitArray ";" | last}}
import (
"context"
"fmt"
micro_client "github.com/unistack-org/micro/v3/client"
micro_server "github.com/unistack-org/micro/v3/server"
@ -78,6 +79,17 @@ func (c *{{$ServiceName | lowerFirst}}Service) {{.Name}}(ctx context.Context, re
{{- end}}
}
{{- if not (contains (json (openapiOption .)) "null") }}
{{- if (openapiOption .).Responses }}
{{ range $k, $v := (openapiOption .).Responses }}
// Error method to satisfy error interface
func (e *{{- (getMessageType $File $v.Schema.JsonSchema.Ref).Name }}) Error() string {
return fmt.Sprintf("%v", e)
}
{{- end }}
{{- end }}
{{- end }}
{{if or (.ServerStreaming) (.ClientStreaming)}}
type {{$ServiceName | lowerFirst}}Service{{.Name}} struct {
stream micro_client.Stream