|
|
|
@ -43,7 +43,7 @@ func generateFileContent(gen *protogen.Plugin, file *protogen.File, g *protogen. |
|
|
|
|
index := 0 |
|
|
|
|
for _, enum := range file.Enums { |
|
|
|
|
skip := genErrorsReason(gen, file, g, enum) |
|
|
|
|
if skip == false { |
|
|
|
|
if !skip { |
|
|
|
|
index++ |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -70,7 +70,7 @@ func genErrorsReason(gen *protogen.Plugin, file *protogen.File, g *protogen.Gene |
|
|
|
|
enumCode = int(ok) |
|
|
|
|
} |
|
|
|
|
// If the current enumeration does not contain 'errors.code'
|
|
|
|
|
//or the code value exceeds the range, the current enum will be skipped
|
|
|
|
|
// or the code value exceeds the range, the current enum will be skipped
|
|
|
|
|
if enumCode > 600 || enumCode < 0 { |
|
|
|
|
panic(fmt.Sprintf("Enum '%s' range must be greater than 0 and less than or equal to 600", string(v.Desc.Name()))) |
|
|
|
|
} |
|
|
|
@ -81,7 +81,7 @@ func genErrorsReason(gen *protogen.Plugin, file *protogen.File, g *protogen.Gene |
|
|
|
|
Name: string(enum.Desc.Name()), |
|
|
|
|
Value: string(v.Desc.Name()), |
|
|
|
|
CamelValue: Case2Camel(string(v.Desc.Name())), |
|
|
|
|
HttpCode: enumCode, |
|
|
|
|
HTTPCode: enumCode, |
|
|
|
|
} |
|
|
|
|
ew.Errors = append(ew.Errors, err) |
|
|
|
|
} |
|
|
|
|