fix(xerrors): rename MarshalJSON field platformCode → platform_code

JSON tag on the anonymous struct inside MarshalJSON corrected from
`json:"platformCode,omitempty"` to `json:"platform_code,omitempty"` to
match the OpenAPI spec snake_case convention. All error responses that
serialize *Err directly now emit "platform_code" instead of "platformCode".
PR.md added to .gitignore.
This commit is contained in:
2026-05-21 19:29:06 -06:00
parent 55c038f1b8
commit e24cbadf71
4 changed files with 17 additions and 7 deletions

View File

@@ -312,8 +312,8 @@ func TestErr_MarshalJSON_PlatformCode(t *testing.T) {
if jsonErr = json.Unmarshal(b, &out); jsonErr != nil {
t.Fatalf("unmarshal error: %v", jsonErr)
}
if out["platformCode"] != "EMPLOYEE_NOT_FOUND" {
t.Errorf("json platformCode = %v, want EMPLOYEE_NOT_FOUND", out["platformCode"])
if out["platform_code"] != "EMPLOYEE_NOT_FOUND" {
t.Errorf("json platform_code = %v, want EMPLOYEE_NOT_FOUND", out["platform_code"])
}
})
@@ -323,8 +323,8 @@ func TestErr_MarshalJSON_PlatformCode(t *testing.T) {
if jsonErr != nil {
t.Fatalf("MarshalJSON error: %v", jsonErr)
}
if strings.Contains(string(b), "platformCode") {
t.Errorf("json should omit platformCode when empty, got: %s", b)
if strings.Contains(string(b), "platform_code") {
t.Errorf("json should omit platform_code when empty, got: %s", b)
}
})
}