naming

package
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 5, 2026 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Overview

Package naming provides string conversion utilities for mapping OpenAPI operation identifiers to Go and MCP naming conventions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeduplicateNames

func DeduplicateNames(names []string) []string

DeduplicateNames appends numeric suffixes (_2, _3, …) to resolve collisions in a list of names. The first occurrence keeps its original name; subsequent duplicates get incrementing suffixes.

func OperationDomain

func OperationDomain(operationID, httpMethod, path string) string

OperationDomain derives a domain/action name from an OpenAPI operation. It prefers the operationID (converted to snake_case). When operationID is empty, it falls back to a combination of HTTP method and path segments.

func ToPascalCase

func ToPascalCase(s string) string

ToPascalCase converts a snake_case string to PascalCase. It recognizes common acronyms and uppercases them fully (e.g., "pet_id" → "PetID").

func ToSnakeCase

func ToSnakeCase(s string) string

ToSnakeCase converts a camelCase or PascalCase string to snake_case. It handles acronyms (e.g., "HTTPMethod" → "http_method") and consecutive uppercase runs.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL