Skip to content

Commit c82801c

Browse files
feat: add camelCase json tags to all model structs (#184)
Add json struct tags alongside existing yaml tags to all model types. This enables proper JSON serialization with camelCase field names while preserving snake_case yaml serialization for config files. Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 06b0c32 commit c82801c

File tree

5 files changed

+69
-69
lines changed

5 files changed

+69
-69
lines changed

pkg/models/code.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
package models
22

33
type Code struct {
4-
EnableFailBuilds *bool `yaml:"enable_fail_builds,omitempty"`
5-
Ignore []CodeIgnore `yaml:"ignore,omitempty"`
4+
EnableFailBuilds *bool `json:"enableFailBuilds,omitempty" yaml:"enable_fail_builds,omitempty"`
5+
Ignore []CodeIgnore `json:"ignore,omitempty" yaml:"ignore,omitempty"`
66
}
77

88
type CodeIgnore struct {
9-
Reason string `yaml:"reason,omitempty"`
10-
Expiry string `yaml:"expiry,omitempty"`
9+
Reason string `json:"reason,omitempty" yaml:"reason,omitempty"`
10+
Expiry string `json:"expiry,omitempty" yaml:"expiry,omitempty"`
1111

1212
// matchers
13-
CWEs []int `yaml:"cwes,omitempty"`
14-
RuleIDs []string `yaml:"rule_ids,omitempty"`
15-
Dirs []string `yaml:"dirs,omitempty"`
13+
CWEs []int `json:"cwes,omitempty" yaml:"cwes,omitempty"`
14+
RuleIDs []string `json:"ruleIds,omitempty" yaml:"rule_ids,omitempty"`
15+
Dirs []string `json:"dirs,omitempty" yaml:"dirs,omitempty"`
1616

1717
// global config only
18-
Repositories []string `yaml:"repositories,omitempty"`
18+
Repositories []string `json:"repositories,omitempty" yaml:"repositories,omitempty"`
1919

2020
// TODO deprecate
21-
Paths []string `yaml:"paths,omitempty"`
21+
Paths []string `json:"paths,omitempty" yaml:"paths,omitempty"`
2222
}

pkg/models/dependencies.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
package models
22

33
type Dependencies struct {
4-
EnableFailBuilds *bool `yaml:"enable_fail_builds,omitempty"`
5-
Ignore []DependenciesIgnore `yaml:"ignore,omitempty"`
4+
EnableFailBuilds *bool `json:"enableFailBuilds,omitempty" yaml:"enable_fail_builds,omitempty"`
5+
Ignore []DependenciesIgnore `json:"ignore,omitempty" yaml:"ignore,omitempty"`
66
}
77

88
type DependenciesIgnore struct {
9-
Reason string `yaml:"reason,omitempty"`
10-
Expiry string `yaml:"expiry,omitempty"`
9+
Reason string `json:"reason,omitempty" yaml:"reason,omitempty"`
10+
Expiry string `json:"expiry,omitempty" yaml:"expiry,omitempty"`
1111

1212
// matchers
13-
CVEs []string `yaml:"cves,omitempty"`
14-
Dirs []string `yaml:"dirs,omitempty"`
13+
CVEs []string `json:"cves,omitempty" yaml:"cves,omitempty"`
14+
Dirs []string `json:"dirs,omitempty" yaml:"dirs,omitempty"`
1515

1616
// global config only
17-
Repositories []string `yaml:"repositories,omitempty"`
17+
Repositories []string `json:"repositories,omitempty" yaml:"repositories,omitempty"`
1818

1919
// TODO deprecate
20-
Paths []string `yaml:"paths,omitempty"`
20+
Paths []string `json:"paths,omitempty" yaml:"paths,omitempty"`
2121
}

pkg/models/integrations.go

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,38 @@
11
package models
22

33
type Integrations struct {
4-
Jira *Jira `yaml:"jira,omitempty"`
4+
Jira *Jira `json:"jira,omitempty" yaml:"jira,omitempty"`
55
}
66

77
type Jira struct {
8-
Disabled bool `yaml:"disabled,omitempty"`
9-
Enabled *bool `yaml:"enabled,omitempty"`
10-
ProjectKey string `yaml:"project_key,omitempty"`
11-
IssueType string `yaml:"issue_type,omitempty"`
12-
SeverityThreshold string `yaml:"severity_threshold,omitempty"`
13-
PriorityThreshold string `yaml:"priority_threshold,omitempty"`
14-
OnFixTransition string `yaml:"on_fix_transition,omitempty"`
15-
CommentOnClose *bool `yaml:"comment_on_close,omitempty"`
16-
Labels []string `yaml:"labels,omitempty"`
17-
TitleTemplate string `yaml:"title_template,omitempty"`
18-
DescriptionTemplate string `yaml:"description_template,omitempty"`
19-
Priorities *Priorities `yaml:"priorities,omitempty"`
20-
Assignee *Assignee `yaml:"assignee,omitempty"`
8+
Disabled bool `json:"disabled,omitempty" yaml:"disabled,omitempty"`
9+
Enabled *bool `json:"enabled,omitempty" yaml:"enabled,omitempty"`
10+
ProjectKey string `json:"projectKey,omitempty" yaml:"project_key,omitempty"`
11+
IssueType string `json:"issueType,omitempty" yaml:"issue_type,omitempty"`
12+
SeverityThreshold string `json:"severityThreshold,omitempty" yaml:"severity_threshold,omitempty"`
13+
PriorityThreshold string `json:"priorityThreshold,omitempty" yaml:"priority_threshold,omitempty"`
14+
OnFixTransition string `json:"onFixTransition,omitempty" yaml:"on_fix_transition,omitempty"`
15+
CommentOnClose *bool `json:"commentOnClose,omitempty" yaml:"comment_on_close,omitempty"`
16+
Labels []string `json:"labels,omitempty" yaml:"labels,omitempty"`
17+
TitleTemplate string `json:"titleTemplate,omitempty" yaml:"title_template,omitempty"`
18+
DescriptionTemplate string `json:"descriptionTemplate,omitempty" yaml:"description_template,omitempty"`
19+
Priorities *Priorities `json:"priorities,omitempty" yaml:"priorities,omitempty"`
20+
Assignee *Assignee `json:"assignee,omitempty" yaml:"assignee,omitempty"`
2121
}
2222

2323
// Mapping of Nullify Finding severities to Jira Priorities.
2424
// The user can specify the priority of the issue based on the severity.
2525
type Priorities struct {
26-
Critical string `yaml:"critical,omitempty"`
27-
High string `yaml:"high,omitempty"`
28-
Medium string `yaml:"medium,omitempty"`
29-
Low string `yaml:"low,omitempty"`
30-
Urgent string `yaml:"urgent,omitempty"`
31-
Important string `yaml:"important,omitempty"`
32-
Negligible string `yaml:"negligible,omitempty"`
26+
Critical string `json:"critical,omitempty" yaml:"critical,omitempty"`
27+
High string `json:"high,omitempty" yaml:"high,omitempty"`
28+
Medium string `json:"medium,omitempty" yaml:"medium,omitempty"`
29+
Low string `json:"low,omitempty" yaml:"low,omitempty"`
30+
Urgent string `json:"urgent,omitempty" yaml:"urgent,omitempty"`
31+
Important string `json:"important,omitempty" yaml:"important,omitempty"`
32+
Negligible string `json:"negligible,omitempty" yaml:"negligible,omitempty"`
3333
}
3434

3535
type Assignee struct {
36-
Name string `yaml:"name,omitempty"`
37-
ID string `yaml:"id,omitempty"`
36+
Name string `json:"name,omitempty" yaml:"name,omitempty"`
37+
ID string `json:"id,omitempty" yaml:"id,omitempty"`
3838
}

pkg/models/models.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,25 @@ package models
22

33
type Configuration struct {
44
// git platform options
5-
EnableFailBuilds *bool `yaml:"enable_fail_builds,omitempty"`
6-
EnablePullRequestReviews *bool `yaml:"enable_pull_request_reviews,omitempty"`
7-
EnableIssueDashboards *bool `yaml:"enable_issue_dashboards,omitempty"`
5+
EnableFailBuilds *bool `json:"enableFailBuilds,omitempty" yaml:"enable_fail_builds,omitempty"`
6+
EnablePullRequestReviews *bool `json:"enablePullRequestReviews,omitempty" yaml:"enable_pull_request_reviews,omitempty"`
7+
EnableIssueDashboards *bool `json:"enableIssueDashboards,omitempty" yaml:"enable_issue_dashboards,omitempty"`
88

9-
SeverityThreshold string `yaml:"severity_threshold,omitempty"`
10-
PriorityThreshold string `yaml:"priority_threshold,omitempty"`
9+
SeverityThreshold string `json:"severityThreshold,omitempty" yaml:"severity_threshold,omitempty"`
10+
PriorityThreshold string `json:"priorityThreshold,omitempty" yaml:"priority_threshold,omitempty"`
1111

12-
IgnoreDirs []string `yaml:"ignore_dirs,omitempty"`
13-
IgnorePaths []string `yaml:"ignore_paths,omitempty"`
12+
IgnoreDirs []string `json:"ignoreDirs,omitempty" yaml:"ignore_dirs,omitempty"`
13+
IgnorePaths []string `json:"ignorePaths,omitempty" yaml:"ignore_paths,omitempty"`
1414

15-
Integrations Integrations `yaml:"integrations,omitempty"`
15+
Integrations Integrations `json:"integrations,omitempty" yaml:"integrations,omitempty"`
1616

1717
// features
18-
Code Code `yaml:"code"`
19-
Dependencies Dependencies `yaml:"dependencies"`
20-
Secrets Secrets `yaml:"secrets"`
18+
Code Code `json:"code" yaml:"code"`
19+
Dependencies Dependencies `json:"dependencies" yaml:"dependencies"`
20+
Secrets Secrets `json:"secrets" yaml:"secrets"`
2121

2222
// TODO deprecate
23-
SecretsWhitelist []string `yaml:"secrets_whitelist,omitempty"`
23+
SecretsWhitelist []string `json:"secretsWhitelist,omitempty" yaml:"secrets_whitelist,omitempty"`
2424
}
2525

2626
func (c *Configuration) GetEnableFailBuilds() bool {

pkg/models/secrets.go

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,33 @@
11
package models
22

33
type Secrets struct {
4-
EnableFailBuilds *bool `yaml:"enable_fail_builds,omitempty"`
5-
Ignore []SecretsIgnore `yaml:"ignore,omitempty"`
6-
CustomPatterns map[string]SecretsCustomPattern `yaml:"custom_patterns,omitempty"`
7-
CustomPatternsOverrideGlobal bool `yaml:"custom_patterns_override_global,omitempty"`
4+
EnableFailBuilds *bool `json:"enableFailBuilds,omitempty" yaml:"enable_fail_builds,omitempty"`
5+
Ignore []SecretsIgnore `json:"ignore,omitempty" yaml:"ignore,omitempty"`
6+
CustomPatterns map[string]SecretsCustomPattern `json:"customPatterns,omitempty" yaml:"custom_patterns,omitempty"`
7+
CustomPatternsOverrideGlobal bool `json:"customPatternsOverrideGlobal,omitempty" yaml:"custom_patterns_override_global,omitempty"`
88
}
99

1010
type SecretsIgnore struct {
11-
Reason string `yaml:"reason,omitempty"`
12-
Expiry string `yaml:"expiry,omitempty"`
11+
Reason string `json:"reason,omitempty" yaml:"reason,omitempty"`
12+
Expiry string `json:"expiry,omitempty" yaml:"expiry,omitempty"`
1313

1414
// matchers
15-
Value string `yaml:"value,omitempty"`
16-
Pattern string `yaml:"pattern,omitempty"`
17-
SHA256 string `yaml:"sha256,omitempty"`
15+
Value string `json:"value,omitempty" yaml:"value,omitempty"`
16+
Pattern string `json:"pattern,omitempty" yaml:"pattern,omitempty"`
17+
SHA256 string `json:"sha256,omitempty" yaml:"sha256,omitempty"`
1818

1919
// global config only
20-
Repositories []string `yaml:"repositories,omitempty"`
20+
Repositories []string `json:"repositories,omitempty" yaml:"repositories,omitempty"`
2121

2222
// TODO deprecate
23-
Paths []string `yaml:"paths,omitempty"`
23+
Paths []string `json:"paths,omitempty" yaml:"paths,omitempty"`
2424
}
2525

2626
type SecretsCustomPattern struct {
27-
Description *string `yaml:"description,omitempty"`
28-
SecretRegex string `yaml:"secret_regex,omitempty"`
29-
SecretRegexGroup *int `yaml:"secret_regex_group,omitempty"`
30-
Entropy *float32 `yaml:"entropy,omitempty"`
31-
PathRegex *string `yaml:"path_regex,omitempty"`
32-
Keywords []string `yaml:"keywords,omitempty"`
27+
Description *string `json:"description,omitempty" yaml:"description,omitempty"`
28+
SecretRegex string `json:"secretRegex,omitempty" yaml:"secret_regex,omitempty"`
29+
SecretRegexGroup *int `json:"secretRegexGroup,omitempty" yaml:"secret_regex_group,omitempty"`
30+
Entropy *float32 `json:"entropy,omitempty" yaml:"entropy,omitempty"`
31+
PathRegex *string `json:"pathRegex,omitempty" yaml:"path_regex,omitempty"`
32+
Keywords []string `json:"keywords,omitempty" yaml:"keywords,omitempty"`
3333
}

0 commit comments

Comments
 (0)