fixup templates
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
		
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							| @@ -1335,7 +1335,7 @@ func openapiOption(m *descriptor.MethodDescriptorProto) *openapi_options.Operati | |||||||
|  |  | ||||||
| 	ext, err := proto.GetExtension(m.Options, openapi_options.E_Openapiv2Operation) | 	ext, err := proto.GetExtension(m.Options, openapi_options.E_Openapiv2Operation) | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		panic(err.Error()) | 		return nil | ||||||
| 	} | 	} | ||||||
| 	opts, ok := ext.(*openapi_options.Operation) | 	opts, ok := ext.(*openapi_options.Operation) | ||||||
| 	if !ok { | 	if !ok { | ||||||
|   | |||||||
							
								
								
									
										1
									
								
								main.go
									
									
									
									
									
								
							
							
						
						
									
										1
									
								
								main.go
									
									
									
									
									
								
							| @@ -55,6 +55,7 @@ func main() { | |||||||
| 		all               = false | 		all               = false | ||||||
| 		singlePackageMode = false | 		singlePackageMode = false | ||||||
| 		fileMode          = false | 		fileMode          = false | ||||||
|  | 		//components        = "" | ||||||
| 	) | 	) | ||||||
| 	if parameter := g.Request.GetParameter(); parameter != "" { | 	if parameter := g.Request.GetParameter(); parameter != "" { | ||||||
| 		for _, param := range strings.Split(parameter, ",") { | 		for _, param := range strings.Split(parameter, ",") { | ||||||
|   | |||||||
| @@ -40,18 +40,22 @@ func (c *{{$ServiceName | lowerFirst}}Service) {{.Name}}(ctx context.Context, op | |||||||
|   {{- else -}} |   {{- else -}} | ||||||
| func (c *{{$ServiceName | lowerFirst}}Service) {{.Name}}(ctx context.Context, req *{{$reqMethod}}, opts ...micro_client.CallOption) (*{{$rspMethod}}, error) { | func (c *{{$ServiceName | lowerFirst}}Service) {{.Name}}(ctx context.Context, req *{{$reqMethod}}, opts ...micro_client.CallOption) (*{{$rspMethod}}, error) { | ||||||
|   {{- end }} |   {{- end }} | ||||||
|  |     {{- if not (contains (json (openapiOption .)) "null") }} | ||||||
|     {{- if (openapiOption .).Responses }} |     {{- if (openapiOption .).Responses }} | ||||||
|     errmap := make(map[string]interface{}, {{ len (openapiOption .).Responses}}) |     errmap := make(map[string]interface{}, {{ len (openapiOption .).Responses}}) | ||||||
|     {{- range $k, $v := (openapiOption .).Responses }} |     {{- range $k, $v := (openapiOption .).Responses }} | ||||||
|     errmap["{{$k}}"] = &{{- (getMessageType $File $v.Schema.JsonSchema.Ref).Name }}{} |     errmap["{{$k}}"] = &{{- (getMessageType $File $v.Schema.JsonSchema.Ref).Name }}{} | ||||||
|     {{- end }} |     {{- end }} | ||||||
|     {{- end }} |     {{- end }} | ||||||
|  |     {{- end }} | ||||||
|     nopts := append(opts, |     nopts := append(opts, | ||||||
|       micro_client_http.Method("{{httpVerb .}}"),  |       micro_client_http.Method("{{httpVerb .}}"),  | ||||||
|       micro_client_http.Path("{{httpPath .}}"), |       micro_client_http.Path("{{httpPath .}}"), | ||||||
|  |       {{- if not (contains (json (openapiOption .)) "null") }} | ||||||
|       {{- if (openapiOption .).Responses }} |       {{- if (openapiOption .).Responses }} | ||||||
|       micro_client_http.ErrorMap(errmap), |       micro_client_http.ErrorMap(errmap), | ||||||
|       {{- end }} |       {{- end }} | ||||||
|  |       {{- end }} | ||||||
|     ) |     ) | ||||||
|   {{- if or (.ServerStreaming) (.ClientStreaming)}} |   {{- if or (.ServerStreaming) (.ClientStreaming)}} | ||||||
|     stream, err := c.c.Stream(ctx, c.c.NewRequest(c.name, "{{$ServiceName}}.{{.Name}}", &{{$reqMethod}}{}), nopts...) |     stream, err := c.c.Stream(ctx, c.c.NewRequest(c.name, "{{$ServiceName}}.{{.Name}}", &{{$reqMethod}}{}), nopts...) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user