naming

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToGoFieldName

func ToGoFieldName(s string) string

ToGoFieldName converts any OpenAPI identifier to a valid Go exported identifier in PascalCase for use as a struct field name. Unlike ToGoName, it does not escape Go reserved words because struct fields are accessed via selectors (e.g., obj.Type) which never conflict with keywords.

func ToGoName

func ToGoName(s string) string

ToGoName converts any OpenAPI identifier to a valid Go exported identifier in PascalCase.

func ToGoParamName

func ToGoParamName(s string) string

ToGoParamName converts any OpenAPI identifier to a valid Go unexported identifier in camelCase.

Types

type Namer

type Namer struct {
	// contains filtered or unexported fields
}

Namer handles conversion of OpenAPI identifiers to Go identifiers and tracks used names to prevent collisions.

func NewNamer

func NewNamer() *Namer

func (*Namer) RegisterName

func (n *Namer) RegisterName(name string) string

RegisterName registers a name and returns it. If the name has already been registered, a numeric suffix is appended to make it unique.

Jump to

Keyboard shortcuts

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