github.com/tickoalcantara12/micro/v3@v3.0.0-20221007104245-9d75b9bcbab9/cmd/protoc-gen-openapi/converter/schema_paths.go (about) 1 package converter 2 3 import ( 4 "fmt" 5 "strings" 6 ) 7 8 func urlPath(microServiceName, protoServiceName, methodName string) string { 9 return fmt.Sprintf("/%s/%s/%s", microServiceName, protoServiceName, methodName) 10 } 11 12 func protoServiceName(inputType string) string { 13 protoServiceNameComponents := strings.Split(inputType, ".") 14 return protoServiceNameComponents[len(protoServiceNameComponents)-1] 15 } 16 17 func messageSchemaPath(schemaName string) string { 18 return fmt.Sprintf("#/components/schemas/%s", schemaName) 19 } 20 21 func requestBodyName(serviceName, methodName string) string { 22 return fmt.Sprintf("%s%sRequest", serviceName, methodName) 23 } 24 25 func requestBodySchemaPath(requestBodyName string) string { 26 return fmt.Sprintf("#/components/requestBodies/%s", requestBodyName) 27 } 28 29 func responseBodyName(serviceName, methodName string) string { 30 return fmt.Sprintf("%s%sResponse", serviceName, methodName) 31 } 32 33 func responseBodySchemaPath(responseBodyName string) string { 34 return fmt.Sprintf("#/components/responses/%s", responseBodyName) 35 }