Skip to content

Commit 9e24db1

Browse files
committed
fix(wire-format): flip meshkit JSON tags to canonical camelCase (Phase 7c)
Per the ecosystem-wide identifier-naming contract (camelCase on the wire, snake_case in the database, ORM is the boundary — see meshery/schemas/AGENTS.md), flip all snake_case `json:` tags on wire-facing meshkit types to camelCase. `db:` tags are preserved as snake_case; `yaml:` tags on config structs are preserved as their existing snake_case (yaml files are user-facing config, not a Meshery API wire contract). The meshkit Event type is the load-bearing change: it is embedded into meshery-cloud's EventResult and meshery server's events stream, so its snake_case keys (acted_upon, user_id, system_id, created_at, ...) were leaking out of every downstream API even after Phase 4 flipped the local cloud types. With this change, every meshkit-emitted event field is camelCase end-to-end. Files flipped: - models/events/events.go (11 tags: actedUpon, userId, systemId, operationId, createdAt, updatedAt, deletedAt; plus the four EventsFilter tags sortOn, actedUpon, userId, systemId) - models/catalog/v1alpha1/catalog.go (4 tags: contentClass, publishedVersion, patternCaveats, patternInfo) - database/database.go (3 tags: createdAt, updatedAt, deletedAt on the shared Model) - tracing/tracing.go (2 tags: serviceName, serviceVersion — yaml: kept snake_case for config files) - utils/kubernetes/kubernetes.go (1 tag: dynamicKubeClient) - models/smi_conformance.go (1 tag: mesheryId) - generators/github/package.go (1 tag: sourceUrl) Docs updated: - docs/event-streaming.md excerpt updated to reflect camelCase JSON tags on the canonical Event struct. Explicitly excluded (NOT flipped) per scope: - cmd/errorutil/internal/{component,error}/*.go — internal output schema for the errorutil tool (consumed by CI / `make error`); not a wire contract. - utils/walker/github.go — github API mirror; 3rd-party wire contract. - utils/csv/csv_test.go — `person_age` is a CSV column header in a test fixture, not a json wire contract. Cross-repo follow-ups required after meshkit releases a tag containing this change: - meshery: bump go.mod meshkit dep; UI consumers of /api/system/events must read camelCase (actedUpon, userId, systemId, createdAt, ...). - meshery-cloud: bump go.mod meshkit dep; the embedded Event in EventResult now emits camelCase, so the cloud UI events table must read camelCase. - meshery-extensions: bump go.mod meshkit dep; verify catalog/event surfaces. Verification: - `go build ./...` clean - `go vet ./...` clean - `go test -count=1 ./...` all packages pass Signed-off-by: Lee Calcote <leecalcote@gmail.com>
1 parent 35b4486 commit 9e24db1

8 files changed

Lines changed: 30 additions & 30 deletions

File tree

database/database.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ type Options struct {
2727

2828
type Model struct {
2929
ID string `json:"id,omitempty" gorm:"primarykey"`
30-
CreatedAt string `json:"created_at,omitempty" gorm:"index"`
31-
UpdatedAt string `json:"updated_at,omitempty" gorm:"index"`
32-
DeletedAt string `json:"deleted_at,omitempty" gorm:"index"`
30+
CreatedAt string `json:"createdAt,omitempty" gorm:"index"`
31+
UpdatedAt string `json:"updatedAt,omitempty" gorm:"index"`
32+
DeletedAt string `json:"deletedAt,omitempty" gorm:"index"`
3333
}
3434

3535
type Handler struct {

docs/event-streaming.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -113,22 +113,22 @@ locally.
113113
// models/events/events.go (excerpt)
114114
type Event struct {
115115
ID ID `db:"id" json:"id"`
116-
UserID *UserID `db:"user_id" json:"user_id,omitempty"`
117-
SystemID SystemID `db:"system_id" json:"system_id"`
118-
OperationID OperationID `db:"operation_id" json:"operation_id"`
116+
UserID *UserID `db:"user_id" json:"userId,omitempty"`
117+
SystemID SystemID `db:"system_id" json:"systemId"`
118+
OperationID OperationID `db:"operation_id" json:"operationId"`
119119

120120
Category string `db:"category" json:"category"`
121121
Action string `db:"action" json:"action"`
122122
Description string `db:"description" json:"description"`
123123
Severity EventSeverity `db:"severity" json:"severity"`
124124
Status EventStatus `db:"status" json:"status"`
125125

126-
ActedUpon core.Uuid `db:"acted_upon" json:"acted_upon"`
126+
ActedUpon core.Uuid `db:"acted_upon" json:"actedUpon"`
127127
Metadata map[string]interface{} `db:"metadata" json:"metadata" gorm:"type:bytes;serializer:json"`
128128

129-
CreatedAt CreatedAt `db:"created_at" json:"created_at"`
130-
UpdatedAt UpdatedAt `db:"updated_at" json:"updated_at"`
131-
DeletedAt *DeletedAt `db:"deleted_at" json:"deleted_at,omitempty"`
129+
CreatedAt CreatedAt `db:"created_at" json:"createdAt"`
130+
UpdatedAt UpdatedAt `db:"updated_at" json:"updatedAt"`
131+
DeletedAt *DeletedAt `db:"deleted_at" json:"deletedAt,omitempty"`
132132
}
133133

134134
type EventSeverity string // alert | critical | debug | emergency | error | informational | warning | success

generators/github/package.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ type GitHubPackage struct {
2121
branch string
2222
repository string
2323
version string
24-
SourceURL string `yaml:"source_url" json:"source_url"`
24+
SourceURL string `yaml:"source_url" json:"sourceUrl"`
2525
}
2626

2727
func (gp GitHubPackage) GetVersion() string {

models/catalog/v1alpha1/catalog.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,18 @@ import (
99

1010
// CatalogData defines model for catalog_data.
1111
type CatalogData struct {
12-
ContentClass ContentClass `json:"content_class,omitempty"`
12+
ContentClass ContentClass `json:"contentClass,omitempty"`
1313
//Tracks the specific content version that has been made available in the Catalog
14-
PublishedVersion string `json:"published_version"`
14+
PublishedVersion string `json:"publishedVersion"`
1515

1616
// Compatibility A list of technologies included in or implicated by this design; a list of relevant technology tags.
1717
Compatibility []CatalogDataCompatibility `json:"compatibility"`
1818

1919
// PatternCaveats Specific stipulations to consider and known behaviors to be aware of when using this design.
20-
PatternCaveats string `json:"pattern_caveats"`
20+
PatternCaveats string `json:"patternCaveats"`
2121

2222
// PatternInfo Purpose of the design along with its intended and unintended uses.
23-
PatternInfo string `json:"pattern_info"`
23+
PatternInfo string `json:"patternInfo"`
2424

2525
// Contains reference to the dark and light mode snapshots of the catalog.
2626
SnapshotURL []string `json:"imageURL,omitempty"` // this will require updating exisitng catalog data as well. updated the json tag to match previous key name, so changes will not be required in exisitng catgalogs

models/events/events.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ type DeletedAt = time.Time
3434
// Event Defines model for event_trackers
3535
type Event struct {
3636
// ActedUpon UUID of the entity on which the event was performed.
37-
ActedUpon core.Uuid `db:"acted_upon" json:"acted_upon"`
37+
ActedUpon core.Uuid `db:"acted_upon" json:"actedUpon"`
3838

3939
// Action Action taken on the resource.
4040
Action string `db:"action" json:"action"`
@@ -43,10 +43,10 @@ type Event struct {
4343
Category string `db:"category" json:"category"`
4444

4545
// CreatedAt Timestamp when the resource was created.
46-
CreatedAt CreatedAt `db:"created_at" json:"created_at"`
46+
CreatedAt CreatedAt `db:"created_at" json:"createdAt"`
4747

4848
// DeletedAt Timestamp when the resource was deleted.
49-
DeletedAt *DeletedAt `db:"deleted_at" json:"deleted_at,omitempty"`
49+
DeletedAt *DeletedAt `db:"deleted_at" json:"deletedAt,omitempty"`
5050

5151
// Description A summary/receipt of event that occurred.
5252
Description string `db:"description" json:"description"`
@@ -55,18 +55,18 @@ type Event struct {
5555
// Metadata Contains meaningful information, specific to the type of event.
5656
// Structure of metadata can be different for different events.
5757
Metadata map[string]interface{} `db:"metadata" json:"metadata" gorm:"type:bytes;serializer:json"`
58-
OperationID OperationID `db:"operation_id" json:"operation_id"`
58+
OperationID OperationID `db:"operation_id" json:"operationId"`
5959

6060
// Severity A set of seven standard event levels.
6161
Severity EventSeverity `db:"severity" json:"severity"`
6262

6363
// Status Status for the event.
6464
Status EventStatus `db:"status" json:"status"`
65-
SystemID SystemID `db:"system_id" json:"system_id"`
65+
SystemID SystemID `db:"system_id" json:"systemId"`
6666

6767
// UpdatedAt Timestamp when the resource was updated.
68-
UpdatedAt UpdatedAt `db:"updated_at" json:"updated_at"`
69-
UserID *UserID `db:"user_id" json:"user_id,omitempty"`
68+
UpdatedAt UpdatedAt `db:"updated_at" json:"updatedAt"`
69+
UserID *UserID `db:"user_id" json:"userId,omitempty"`
7070
}
7171

7272
// EventSeverity A set of seven standard event levels.
@@ -89,16 +89,16 @@ type EventsFilter struct {
8989
Status EventStatus `json:"status"`
9090
Severity []string `json:"severity"`
9191
// SortOn Field on which records are sorted
92-
SortOn string `json:"sort_on"`
92+
SortOn string `json:"sortOn"`
9393

9494
// ActedUpon UUID of the entity on which the event was performed.
95-
ActedUpon []string `json:"acted_upon"`
95+
ActedUpon []string `json:"actedUpon"`
9696

9797
// UserID UUIDs of users to filter events by.
98-
UserID []string `json:"user_id"`
98+
UserID []string `json:"userId"`
9999

100100
// SystemID UUIDs of systems to filter events by.
101-
SystemID []string `json:"system_id"`
101+
SystemID []string `json:"systemId"`
102102
}
103103

104104
// ID defines model for id.

models/smi_conformance.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ type Specification struct {
1515

1616
// SmiResult - represents the results from Meshery smi conformance test run
1717
type SmiResult struct {
18-
ID uuid.UUID `json:"meshery_id,omitempty" db:"id"`
18+
ID uuid.UUID `json:"mesheryId,omitempty" db:"id"`
1919
Date string `json:"datetime,omitempty" dc:"datetime"`
2020
ServiceMesh string `json:"servicemesh,omitempty" db:"servicemesh"`
2121
ServiceMeshVersion string `json:"servicemeshversion,omitempty" db:"servicemeshversion"`

tracing/tracing.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ import (
1616
// Config holds the configuration parameters for tracing
1717
type Config struct {
1818
// ServiceName is the name of the service being traced
19-
ServiceName string `yaml:"service_name" json:"service_name"`
19+
ServiceName string `yaml:"service_name" json:"serviceName"`
2020
// ServiceVersion is the version of the service
21-
ServiceVersion string `yaml:"service_version" json:"service_version"`
21+
ServiceVersion string `yaml:"service_version" json:"serviceVersion"`
2222
// Environment is the deployment environment (e.g., "production", "staging", "development")
2323
Environment string `yaml:"environment" json:"environment"`
2424
// Endpoint is the OTLP collector endpoint (e.g., "localhost:4317")

utils/kubernetes/kubernetes.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
type Client struct {
1010
RestConfig rest.Config `json:"restconfig,omitempty"`
1111
KubeClient *kubernetes.Clientset `json:"kubeclient,omitempty"`
12-
DynamicKubeClient dynamic.Interface `json:"dynamic_kubeclient,omitempty"`
12+
DynamicKubeClient dynamic.Interface `json:"dynamicKubeClient,omitempty"`
1313
}
1414

1515
func New(kubeconfig []byte) (*Client, error) {

0 commit comments

Comments
 (0)