Standardize JSON tags to camelCase across all structs · Entire
Standardize JSON tags to camelCase across all structs
cc2de54→main·
Soph·3mo ago·10 files·+155 added/-155 removed
Convert all existing snake_case JSON tags to camelCase and add camelCase tags to previously untagged public API types. This establishes a consistent JSON convention across the codebase following standard Go ecosystem practices.
Output types (Result, ProbeResult, FetchResult, BranchPlan, etc.) and input types (Endpoint, RefMapping, SyncPolicy, etc.) now all use camelCase. Custom MarshalJSON methods updated to match.
Auth/OAuth response structs in internal/auth/entiredb.go are intentionally left unchanged as they match external API formats.
Sessions
Changes
10
cmd
git-sync-bench
Mmain.go+28/-28
git-sync
Mmain_test.go+30/-30
internal
gitproto
Mtarget_features.go+4/-4
planner
Mtypes.go+8/-8
syncer
Mmeasurement.go+5/-5
Mstats.go+2/-2
Msyncer.go+20/-20
pkg/gitsync
internalbridge
Mmodel.go+21/-21
Mtypes.go+31/-31
unstable
Mclient.go+6/-6
28 unmodified lines
...
Type Definitions
// RunSummary holds the summary for a single run of a benchmark.
type runSummary struct {
Index int `json:"index"`
TargetPath string `json:"target_path"`
TargetURL string `json:"target_url"`
WallMillis int64 `json:"wall_millis"`
Result unstable.Result `json:"result"`
Error string `json:"error,omitempty"`
}
// AggregateSummary holds the aggregate results of multiple runs.
type aggregateSummary struct {
SuccessfulRuns int `json:"successful_runs"`
FailedRuns int `json:"failed_runs"`
BatchedRuns int `json:"batched_runs"`
MinWallMillis int64 `json:"min_wall_millis"`
MaxWallMillis int64 `json:"max_wall_millis"`
AvgWallMillis float64 `json:"avg_wall_millis"`
MinSyncElapsedMillis int64 `json:"min_sync_elapsed_millis"`
MaxSyncElapsedMillis int64 `json:"max_sync_elapsed_millis"`
AvgSyncElapsedMillis float64 `json:"avg_sync_elapsed_millis"`
... other fields ...
}
// BenchmarkReport holds the final report of a benchmark run.
type benchmarkReport struct {
Scenario scenario `json:"scenario"`
SourceURL string `json:"source_url"`
Repeat int `json:"repeat"`
KeepTargets bool `json:"keep_targets"`
WorkDir string `json:"work_dir"`
Config benchmarkConfig `json:"config"`
Aggregate aggregateSummary `json:"aggregate"`
Runs []runSummary `json:"runs"`
}
// BenchmarkConfig holds the configuration for running the benchmark.
type benchmarkConfig struct {
SourceURL string `json:"source_url"`
Scope gitsync.RefScope `json:"scope"`
Policy gitsync.SyncPolicy `json:"policy"`
Options unstable.AdvancedOptions `json:"options"`
}
// and other types as necessary...
// FetchResult holds the outcome of a fetch operation.
type FetchResult struct {
SourceURL string `json:"source_url"`
RequestedMode string `json:"requested_mode"`
Protocol string `json:"protocol"`
Wants []RefInfo `json:"wants"`
Haves []plumbing.Hash `json:"haves"`
FetchedObjects int `json:"fetched_objects"`
Stats Stats `json:"stats"`
Measurement Measurement `json:"measurement"`
}