Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

this might need to be changed to be more deterministic #71

Open
github-actions bot opened this issue Oct 17, 2023 · 0 comments
Open

this might need to be changed to be more deterministic #71

github-actions bot opened this issue Oct 17, 2023 · 0 comments
Assignees
Labels

Comments

@github-actions
Copy link
Contributor

cases sorted alphabetically. It's not exported and won't stick around.

https://api.github.com/gogrlx/grlx/blob/7ac33a5c0dc7b3900a3d9ee13c6389ac95a61dad/ingredients/file/file.go#L54

	}, nil
}

func (f File) validate() error {
	set, err := f.PropertiesForMethod(f.method)
	if err != nil {
		return err
	}
	propSet, err := ingredients.PropMapToPropSet(set)
	if err != nil {
		return err
	}
	for _, v := range propSet {
		if v.IsReq {
			if v.Key == "name" {
				name, ok := f.params[v.Key].(string)
				if !ok {
					return types.ErrMissingName
				}
				if name == "" {
					return types.ErrMissingName
				}

			} else {
				// TODO: this might need to be changed to be more deterministic
				if _, ok := f.params[v.Key]; !ok {
					return fmt.Errorf("missing required property %s", v.Key)
				}
			}
		}
	}
	return nil
}

// this is a helper func to replace fallthroughs so I can keep the
// cases sorted alphabetically. It's not exported and won't stick around.
// TODO remove undef func
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant