Skip to content

Commit 3529a4c

Browse files
fix(crawler): Mark all the top level config fields as omitempty (#160)
1 parent d135fe3 commit 3529a4c

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

api/crawler/types.go

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -47,30 +47,30 @@ type Crawler struct {
4747

4848
// Config is a Crawler configuration.
4949
type Config struct {
50-
AppID string `json:"appId"`
51-
APIKey string `json:"apiKey"`
52-
IndexPrefix string `json:"indexPrefix"`
53-
Schedule string `json:"schedule"`
54-
StartUrls []string `json:"startUrls"`
55-
Sitemaps []string `json:"sitemaps"`
50+
AppID string `json:"appId,omitempty"`
51+
APIKey string `json:"apiKey,omitempty"`
52+
IndexPrefix string `json:"indexPrefix,omitempty"`
53+
Schedule string `json:"schedule,omitempty"`
54+
StartUrls []string `json:"startUrls,omitempty"`
55+
Sitemaps []string `json:"sitemaps,omitempty"`
5656

5757
ExclusionPatterns []string `json:"exclusionPatterns,omitempty"`
5858
IgnoreQueryParams []string `json:"ignoreQueryParams,omitempty"`
59-
RenderJavaScript bool `json:"renderJavaScript"`
60-
RateLimit int `json:"rateLimit"`
59+
RenderJavaScript bool `json:"renderJavaScript,omitempty"`
60+
RateLimit int `json:"rateLimit,omitempty"`
6161
ExtraUrls []string `json:"extraUrls,omitempty"`
62-
MaxDepth int `json:"maxDepth"`
63-
MaxURLs int `json:"maxUrls"`
62+
MaxDepth int `json:"maxDepth,omitempty"`
63+
MaxURLs int `json:"maxUrls,omitempty"`
6464

65-
IgnoreRobotsTxtRules bool `json:"ignoreRobotsTxtRules"`
66-
IgnoreNoIndex bool `json:"ignoreNoIndex"`
67-
IgnoreNoFollowTo bool `json:"ignoreNoFollowTo"`
68-
IgnoreCanonicalTo bool `json:"ignoreCanonicalTo"`
65+
IgnoreRobotsTxtRules bool `json:"ignoreRobotsTxtRules,omitempty"`
66+
IgnoreNoIndex bool `json:"ignoreNoIndex,omitempty"`
67+
IgnoreNoFollowTo bool `json:"ignoreNoFollowTo,omitempty"`
68+
IgnoreCanonicalTo bool `json:"ignoreCanonicalTo,omitempty"`
6969

70-
SaveBackup bool `json:"saveBackup"`
71-
InitialIndexSettings map[string]*search.Settings `json:"initialIndexSettings"`
70+
SaveBackup bool `json:"saveBackup,omitempty"`
71+
InitialIndexSettings map[string]*search.Settings `json:"initialIndexSettings,omitempty"`
7272

73-
Actions []*Action `json:"actions"`
73+
Actions []*Action `json:"actions,omitempty"`
7474
}
7575

7676
// Action is a Crawler configuration action.

0 commit comments

Comments
 (0)