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

Method GetValues

pkg/codegen/schema.go:217–229  ·  view source on GitHub ↗

GetValues generates enum names in a way to minimize global conflicts

()

Source from the content-addressed store, hash-verified

215
216// GetValues generates enum names in a way to minimize global conflicts
217func (e *EnumDefinition) GetValues() map[string]string {
218 // in case there are no conflicts, it's safe to use the values as-is
219 if !e.PrefixTypeName {
220 return e.Schema.EnumValues
221 }
222 // If we do have conflicts, we will prefix the enum's typename to the values.
223 newValues := make(map[string]string, len(e.Schema.EnumValues))
224 for k, v := range e.Schema.EnumValues {
225 newName := e.TypeName + UppercaseFirstCharacter(k)
226 newValues[newName] = v
227 }
228 return newValues
229}
230
231type Constants struct {
232 // SecuritySchemeProviderNames holds all provider names for security schemes.

Callers 1

GenerateEnumsFunction · 0.80

Calls 1

UppercaseFirstCharacterFunction · 0.85

Tested by

no test coverage detected