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:
@@ -188,12 +188,12 @@ func (e *Err) ErrorContext() map[string]any {
|
||||
}
|
||||
|
||||
// MarshalJSON implements [json.Marshaler].
|
||||
// Output: {"code":"NOT_FOUND","platformCode":"EMPLOYEE_NOT_FOUND","message":"...","fields":{...}}
|
||||
// platformCode and fields are omitted when empty.
|
||||
// Output: {"code":"NOT_FOUND","platform_code":"IDG-USR-0004","message":"...","fields":{...}}
|
||||
// platform_code and fields are omitted when empty.
|
||||
func (e *Err) MarshalJSON() ([]byte, error) {
|
||||
return json.Marshal(struct {
|
||||
Code string `json:"code"`
|
||||
PlatformCode string `json:"platformCode,omitempty"`
|
||||
PlatformCode string `json:"platform_code,omitempty"`
|
||||
Message string `json:"message"`
|
||||
Fields map[string]any `json:"fields,omitempty"`
|
||||
}{
|
||||
|
||||
Reference in New Issue
Block a user