From 777bbfd7141b056467af796bcd232d958187e559 Mon Sep 17 00:00:00 2001 From: "n.nakhostin" Date: Mon, 8 Sep 2025 10:24:51 +0330 Subject: [PATCH] Refactor API Response Structure to Use Inline Data Field - Updated the APIResponse struct to change the Data field to use inline JSON representation, enhancing the response format. - Removed the Meta field from the SuccessWithMeta function, simplifying the success response handling. - This change improves the clarity and consistency of API responses, aligning with best practices for response structures. --- pkg/response/response.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/pkg/response/response.go b/pkg/response/response.go index 240c8a9..722ea49 100644 --- a/pkg/response/response.go +++ b/pkg/response/response.go @@ -12,9 +12,8 @@ import ( type APIResponse struct { Success bool `json:"success"` Message string `json:"message,omitempty"` - Data interface{} `json:"data,omitempty"` + Data interface{} `json:",inline"` Error *APIError `json:"error,omitempty"` - Meta *Meta `json:"meta,omitempty"` } // APIError represents error details in API response @@ -55,7 +54,6 @@ func SuccessWithMeta(c echo.Context, data interface{}, meta *Meta, message strin Success: true, Message: message, Data: data, - Meta: meta, }) }