ignore empty param renames when creating the spec, not after

This commit is contained in:
Adrien Marquès 2020-03-29 19:33:26 +02:00
parent b48c1d07bf
commit db4429b329
Signed by: xdrm-brackets
GPG Key ID: D75243CA236D825E
1 changed files with 6 additions and 6 deletions

View File

@ -17,6 +17,9 @@ func makeSpec(service config.Service) spec {
}
for _, param := range service.Input {
if len(param.Rename) < 1 {
continue
}
// make a pointer if optional
if param.Optional {
spec.Input[param.Rename] = reflect.PtrTo(param.ExtractType)
@ -26,6 +29,9 @@ func makeSpec(service config.Service) spec {
}
for _, param := range service.Output {
if len(param.Rename) < 1 {
continue
}
spec.Output[param.Rename] = param.ExtractType
}
@ -53,9 +59,6 @@ func (s spec) checkInput(fnv reflect.Value) error {
// check for invalid param
for name, ptype := range s.Input {
if len(name) < 1 {
continue
}
if name[0] == strings.ToLower(name)[0] {
return fmt.Errorf("%s: %w", name, ErrUnexportedName)
}
@ -108,9 +111,6 @@ func (s spec) checkOutput(fnv reflect.Value) error {
// fail on invalid output
for name, ptype := range s.Output {
if len(name) < 1 {
continue
}
if name[0] == strings.ToLower(name)[0] {
return fmt.Errorf("%s: %w", name, ErrUnexportedName)
}