diff --git a/pkg/codegen/codegen.go b/pkg/codegen/codegen.go index 0923d6e0..1d0c8ea5 100644 --- a/pkg/codegen/codegen.go +++ b/pkg/codegen/codegen.go @@ -232,7 +232,7 @@ func collectOperationDefinitions(model *v3high.Document, options ParseOptions) ( pathParamsDef *TypeDefinition ) - operationID, err := createOperationID(method, path, operation.OperationId) + operationID, err := CreateOperationID(method, path, operation.OperationId) if err != nil { return nil, fmt.Errorf("error creating operation ID: %w", err) } @@ -586,7 +586,7 @@ func collectWebhookDefinitions(model *v3high.Document, options ParseOptions) ([] for webhookName, pathItem := range model.Webhooks.FromOldest() { for method, operation := range pathItem.GetOperations().FromOldest() { - operationID, err := createOperationID(method, "/webhooks/"+webhookName, operation.OperationId) + operationID, err := CreateOperationID(method, "/webhooks/"+webhookName, operation.OperationId) if err != nil { return nil, nil, fmt.Errorf("error creating webhook operation ID: %w", err) } diff --git a/pkg/codegen/operations.go b/pkg/codegen/operations.go index 0900ab12..49092720 100644 --- a/pkg/codegen/operations.go +++ b/pkg/codegen/operations.go @@ -101,10 +101,10 @@ func filterParameterDefinitionByType(params []ParameterDefinition, in string) [] return out } -// createOperationID generates a unique operation ID based on the HTTP method and path. +// CreateOperationID generates a unique operation ID based on the HTTP method and path. // If the initial value is provided, it will be used. // The resulting operation ID is a camel-cased string. -func createOperationID(method, path, initial string) (string, error) { +func CreateOperationID(method, path, initial string) (string, error) { if initial != "" { return typeNamePrefix(initial) + nameNormalizer(initial), nil } diff --git a/pkg/codegen/operations_test.go b/pkg/codegen/operations_test.go index 05a467b2..6463951c 100644 --- a/pkg/codegen/operations_test.go +++ b/pkg/codegen/operations_test.go @@ -75,7 +75,7 @@ func TestCreateOperationID(t *testing.T) { } for _, test := range suite { - got, err := createOperationID(test.method, test.path, "") + got, err := CreateOperationID(test.method, test.path, "") if err != nil { if !test.wantErr { t.Fatalf("did not expected error but got %v", err)