From 763c2acc22177a5e041a8397697587e75a2a5110 Mon Sep 17 00:00:00 2001 From: Dhriti Naidu Date: Mon, 8 Sep 2025 16:45:07 -0400 Subject: [PATCH] improved validate docstring to explain more clearly --- cli/module_generate/_templates/go/tmpl-module.go | 12 +++++++++--- cli/module_generate/scripts/tmpl-module | 12 +++++++++--- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/cli/module_generate/_templates/go/tmpl-module.go b/cli/module_generate/_templates/go/tmpl-module.go index cf6cde93fee..a233bbdee44 100644 --- a/cli/module_generate/_templates/go/tmpl-module.go +++ b/cli/module_generate/_templates/go/tmpl-module.go @@ -35,9 +35,15 @@ type Config struct { } // Validate ensures all parts of the config are valid and important fields exist. -// Returns implicit dependencies based on the config. -// The path is the JSON path in your robot's config (not the `Config` struct) to the -// resource being validated; e.g. "components.0". +// Returns three values: +// 1. Required dependencies: other resources that must exist for this resource to work. +// 2. Optional dependencies: other resources that may exist but are not required. +// 3. An error if any Config fields are missing or invalid. +// +// The `path` parameter indicates +// where this resource appears in the robot's JSON configuration +// (for example, "components.0"). You can use it in error messages +// to indicate which resource has a problem. func (cfg *Config) Validate(path string) ([]string, []string, error) { // Add config validation code here return nil, nil, nil diff --git a/cli/module_generate/scripts/tmpl-module b/cli/module_generate/scripts/tmpl-module index 6a2def5e39b..5e58cfda61a 100644 --- a/cli/module_generate/scripts/tmpl-module +++ b/cli/module_generate/scripts/tmpl-module @@ -36,9 +36,15 @@ type Config struct { } // Validate ensures all parts of the config are valid and important fields exist. -// Returns implicit required (first return) and optional (second return) dependencies based on the config. -// The path is the JSON path in your robot's config (not the `Config` struct) to the -// resource being validated; e.g. "components.0". +// Returns three values: +// 1. Required dependencies: other resources that must exist for this resource to work. +// 2. Optional dependencies: other resources that may exist but are not required. +// 3. An error if any Config fields are missing or invalid. +// +// The `path` parameter indicates +// where this resource appears in the robot's JSON configuration +// (for example, "components.0"). You can use it in error messages +// to indicate which resource has a problem. func (cfg *Config) Validate(path string) ([]string, []string, error) { // Add config validation code here return nil, nil, nil