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

Method SanitizedParamName

pkg/codegen/operations.go:198–200  ·  view source on GitHub ↗

SanitizedParamName returns the parameter name sanitized to be a valid Go identifier. This is needed for routers like net/http's ServeMux where path wildcards (e.g. {name}) must be valid Go identifiers. For the original OpenAPI parameter name (e.g. for error messages or JSON tags), use ParamName.

()

Source from the content-addressed store, hash-verified

196// wildcards (e.g. {name}) must be valid Go identifiers. For the original
197// OpenAPI parameter name (e.g. for error messages or JSON tags), use ParamName.
198func (pd ParameterDefinition) SanitizedParamName() string {
199 return SanitizeGoIdentifier(pd.ParamName)
200}
201
202func (pd ParameterDefinition) GoVariableName() string {
203 name := LowercaseFirstCharacters(pd.GoName())

Callers

nothing calls this directly

Calls 1

SanitizeGoIdentifierFunction · 0.85

Tested by

no test coverage detected