Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pkg/codegen/codegen.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down Expand Up @@ -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)
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/codegen/operations.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/codegen/operations_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Loading