// UnmarshalYAML implements yaml.v2 Unmarshaler interface.
UnmarshalYAML implements yaml.v2 Unmarshaler interface.
// UnmarshalYAML implements yaml . v2 Unmarshaler interface .
func (r *RPCNamesCaseOption) UnmarshalYAML(unmarshal func(interface{}) error) error {
	var option struct {
		Convention string `yaml:"convention"`
	}
	if err := unmarshal(&option); err != nil {
		return err
	}
	if 0 < len(option.Convention) {
		supportConventions := map[string]ConventionType{
			"lower_camel_case": ConventionLowerCamel,
			"upper_snake_case": ConventionUpperSnake,
			"lower_snake_case": ConventionLowerSnake,
		}
		convention, ok := supportConventions[option.Convention]
		if !ok {
			var list []string
			for k := range supportConventions {
				list = append(list, k)
			}
			return fmt.Errorf("%s is an invalid name convention. valid options are [%s]",
				option.Convention, strings.Join(list, ","))
		}
		r.Convention = convention
	}
	return nil
}
func ( r * RPCNamesCaseOption ) UnmarshalYAML ( unmarshal func ( interface { } ) error ) error { var option struct { Convention string `yaml:"convention"` } if err := unmarshal ( & option ) ; err != nil { return err } if 0 < len ( option . Convention ) { supportConventions := map [ string ] ConventionType { " " : ConventionLowerCamel , " " : ConventionUpperSnake , " " : ConventionLowerSnake , } convention , ok := supportConventions [ option . Convention ] if ! ok { var list [ ] string for k := range supportConventions { list = append ( list , k ) } return fmt . Errorf ( " " , option . Convention , strings . Join ( list , " " ) ) } r . Convention = convention } return nil }
UnmarshalYAML implements yaml.v2 Unmarshaler interface.
UnmarshalYAML implements yaml . v2 Unmarshaler interface .