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

Fix the broken validation on slice structs #636

Merged
merged 1 commit into from
May 27, 2022
Merged
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
16 changes: 8 additions & 8 deletions integration_test/common/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,12 @@ type LogFields struct {
Name string `yaml:"name" validate:"required"`
ValueRegex string `yaml:"value_regex"`
Type string `yaml:"type" validate:"required"`
Description string `yaml:"description" validate:"required"`
Description string `yaml:"description"`
}

type ExpectedLog struct {
LogName string `yaml:"log_name" validate:"required"`
Fields []*LogFields `yaml:"fields" validate:"required"`
Fields []*LogFields `yaml:"fields" validate:"required,dive"`
}

type MinimumSupportedAgentVersion struct {
Expand All @@ -64,18 +64,18 @@ type MinimumSupportedAgentVersion struct {

type ConfigurationFields struct {
Name string `yaml:"name" validate:"required"`
Default string `yaml:"default" validate:"required"`
Default string `yaml:"default"`
Description string `yaml:"description" validate:"required"`
}

type InputConfiguration struct {
Type string `yaml:"type" validate:"required"`
Fields []*ConfigurationFields `yaml:"fields" validate:"required"`
Fields []*ConfigurationFields `yaml:"fields" validate:"required,dive"`
}

type ConfigurationOptions struct {
LogsConfiguration []*InputConfiguration `yaml:"logs" validate:"required_without=MetricsConfiguration"`
MetricsConfiguration []*InputConfiguration `yaml:"metrics" validate:"required_without=LogsConfiguration"`
LogsConfiguration []*InputConfiguration `yaml:"logs" validate:"required_without=MetricsConfiguration,dive"`
MetricsConfiguration []*InputConfiguration `yaml:"metrics" validate:"required_without=LogsConfiguration,dive"`
}

type IntegrationMetadata struct {
Expand All @@ -87,8 +87,8 @@ type IntegrationMetadata struct {
Description string `yaml:"description" validate:"required"`
ConfigurationOptions *ConfigurationOptions `yaml:"configuration_options" validate:"required"`
ConfigureIntegration string `yaml:"configure_integration"`
ExpectedLogs []*ExpectedLog `yaml:"expected_logs"`
ExpectedMetrics []*ExpectedMetric `yaml:"expected_metrics"`
ExpectedLogs []*ExpectedLog `yaml:"expected_logs" validate:"dive"`
ExpectedMetrics []*ExpectedMetric `yaml:"expected_metrics" validate:"dive"`
MinimumSupportedAgentVersion MinimumSupportedAgentVersion `yaml:"minimum_supported_agent_version"`
SupportedAppVersion []string `yaml:"supported_app_version" validate:"required,unique,min=1"`
RestartAfterInstall bool `yaml:"restart_after_install"`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ expected_metrics:
value_type: INT64
kind: GAUGE
monitored_resource: gce_instance
labels: {}
expected_logs:
- log_name: jetty_access
fields:
Expand Down