MCPcopy Index your code
hub / github.com/oapi-codegen/oapi-codegen / generateDefaultOperationID

Function generateDefaultOperationID

pkg/codegen/operations.go:898–914  ·  view source on GitHub ↗
(opName string, requestPath string)

Source from the content-addressed store, hash-verified

896}
897
898func generateDefaultOperationID(opName string, requestPath string) (string, error) {
899 if opName == "" {
900 return "", fmt.Errorf("operation name cannot be an empty string")
901 }
902 if requestPath == "" {
903 return "", fmt.Errorf("request path cannot be an empty string")
904 }
905
906 operationID := strings.ToLower(opName)
907 for part := range strings.SplitSeq(requestPath, "/") {
908 if part != "" {
909 operationID = operationID + "-" + part
910 }
911 }
912
913 return nameNormalizer(operationID), nil
914}
915
916// GenerateBodyDefinitions turns the Swagger body definitions into a list of our body
917// definitions which will be used for code generation.

Callers 2

OperationDefinitionsFunction · 0.85

Calls

no outgoing calls

Tested by 1