fix: Improve EnumValue documentation

This commit is contained in:
Myzel394 2024-07-29 21:26:35 +02:00
parent b897906b51
commit cf2b01b08f
No known key found for this signature in database
GPG Key ID: DEC4AAB876F73185

View File

@ -22,6 +22,10 @@ type EnumValue struct {
} }
func (v EnumValue) GetTypeDescription() []string { func (v EnumValue) GetTypeDescription() []string {
if len(v.Values) == 1 {
return []string{fmt.Sprintf("'%s'", v.Values[0])}
}
lines := make([]string, len(v.Values)+1) lines := make([]string, len(v.Values)+1)
lines[0] = "Enum of:" lines[0] = "Enum of:"
@ -78,7 +82,7 @@ func (v ArrayValue) GetTypeDescription() []string {
subValue := v.SubValue.(Value) subValue := v.SubValue.(Value)
return append( return append(
[]string{"An Array separated by " + v.Separator + " of:"}, []string{fmt.Sprintf("An Array separated by '%s' of:", v.Separator)},
subValue.GetTypeDescription()..., subValue.GetTypeDescription()...,
) )
} }