Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions cli/module_generate/_templates/go/tmpl-module.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// where this resource appears in the robot's JSON configuration
// where this resource appears in the machine'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
Expand Down
12 changes: 9 additions & 3 deletions cli/module_generate/scripts/tmpl-module
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// where this resource appears in the robot's JSON configuration
// where this resource appears in the machine'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
Expand Down
Loading