Skip to content

SigNoz is an open-source, OpenTelemetry-native observability platform for your team and their AI agents. Get logs, metrics, and traces in one tool with features like APM, distributed tracing, log management, infra monitoring, etc. Combined with SigNoz MCP and a native AI teammate (in SigNoz Cloud) it helps you build more resilient apps.

fix(openapi): make the error and status as mandatory (#10391)

Vikrant Gupta465e07de838b
diff --git a/docs/api/openapi.yml b/docs/api/openapi.yml
index bc2a255cd7..2f66818a3c 100644
--- a/docs/api/openapi.yml
+++ b/docs/api/openapi.yml
@@ -326,6 +326,9 @@ components:
type: string
url:
type: string
+ required:
+ - code
+ - message
type: object
ErrorsResponseerroradditional:
properties:
@@ -1661,6 +1664,9 @@ components:
$ref: '#/components/schemas/ErrorsJSON'
status:
type: string
+ required:
+ - status
+ - error
type: object
RoletypesGettableResources:
properties:
diff --git a/frontend/src/api/generated/services/sigNoz.schemas.ts b/frontend/src/api/generated/services/sigNoz.schemas.ts
index 59d1f78a7e..9ee79ae687 100644
--- a/frontend/src/api/generated/services/sigNoz.schemas.ts
+++ b/frontend/src/api/generated/services/sigNoz.schemas.ts
@@ -436,7 +436,7 @@ export interface ErrorsJSONDTO {
/**
* @type string
*/
- code?: string;
+ code: string;
/**
* @type array
*/
@@ -444,7 +444,7 @@ export interface ErrorsJSONDTO {
/**
* @type string
*/
- message?: string;
+ message: string;
/**
* @type string
*/
@@ -1985,11 +1985,11 @@ export enum Querybuildertypesv5VariableTypeDTO {
text = 'text',
}
export interface RenderErrorResponseDTO {
- error?: ErrorsJSONDTO;
+ error: ErrorsJSONDTO;
/**
* @type string
*/
- status?: string;
+ status: string;
}
/**
diff --git a/frontend/src/container/ForgotPassword/index.tsx b/frontend/src/container/ForgotPassword/index.tsx
index 799e35168b..8168b7a144 100644
--- a/frontend/src/container/ForgotPassword/index.tsx
+++ b/frontend/src/container/ForgotPassword/index.tsx
@@ -48,7 +48,9 @@ function ForgotPassword({
}
try {
- ErrorResponseHandlerV2(mutationError as AxiosError<ErrorV2Resp>);
+ ErrorResponseHandlerV2(
+ (mutationError as unknown) as AxiosError<ErrorV2Resp>,
+ );
} catch (apiError) {
return apiError as APIError;
}
diff --git a/frontend/src/container/IngestionSettings/MultiIngestionSettings.tsx b/frontend/src/container/IngestionSettings/MultiIngestionSettings.tsx
index c3eb5f507e..07fe440ec5 100644
--- a/frontend/src/container/IngestionSettings/MultiIngestionSettings.tsx
+++ b/frontend/src/container/IngestionSettings/MultiIngestionSettings.tsx
@@ -342,7 +342,7 @@ function MultiIngestionSettings(): JSX.Element {
useEffect(() => {
if (isError) {
- showErrorNotification(notifications, error as AxiosError);
+ showErrorNotification(notifications, (error as unknown) as AxiosError);
}
}, [error, isError, notifications]);
diff --git a/frontend/src/container/OnboardingV2Container/IngestionDetails/IngestionDetails.tsx b/frontend/src/container/OnboardingV2Container/IngestionDetails/IngestionDetails.tsx
index 95e86642f6..6b55149106 100644
--- a/frontend/src/container/OnboardingV2Container/IngestionDetails/IngestionDetails.tsx
+++ b/frontend/src/container/OnboardingV2Container/IngestionDetails/IngestionDetails.tsx
@@ -86,9 +86,9 @@ export default function OnboardingIngestionDetails(): JSX.Element {
<div className="ingestion-endpoint-section-error-container">
<Typography.Text className="ingestion-endpoint-section-error-text error">
<TriangleAlert size={14} />{' '}
- {(error as AxiosError<RenderErrorResponseDTO>)?.response?.data?.error
- ?.message ||
- (error as AxiosError)?.message ||
+ {((error as unknown) as AxiosError<RenderErrorResponseDTO>)?.response
+ ?.data?.error.message ||
+ ((error as unknown) as AxiosError)?.message ||
'Something went wrong'}
</Typography.Text>
diff --git a/frontend/src/container/OrganizationSettings/AuthDomain/index.tsx b/frontend/src/container/OrganizationSettings/AuthDomain/index.tsx
index 0d16df8cc0..f5da31466b 100644
--- a/frontend/src/container/OrganizationSettings/AuthDomain/index.tsx
+++ b/frontend/src/container/OrganizationSettings/AuthDomain/index.tsx
@@ -110,7 +110,7 @@ function AuthDomain(): JSX.Element {
let errorResult: APIError | null = null;
try {
ErrorResponseHandlerV2(
- errorFetchingAuthDomainListResponse as AxiosError<ErrorV2Resp>,
+ (errorFetchingAuthDomainListResponse as unknown) as AxiosError<ErrorV2Resp>,
);
} catch (error) {
errorResult = error as APIError;
diff --git a/pkg/errors/http.go b/pkg/errors/http.go
index adc2fff22e..25a77fc40f 100644
--- a/pkg/errors/http.go
+++ b/pkg/errors/http.go
@@ -6,8 +6,8 @@ import (
)
type JSON struct {
- Code string `json:"code"`
- Message string `json:"message"`
+ Code string `json:"code" required:"true"`
+ Message string `json:"message" required:"true"`
Url string `json:"url,omitempty"`
Errors []responseerroradditional `json:"errors,omitempty"`
}
diff --git a/pkg/http/render/render.go b/pkg/http/render/render.go
index 505563bb74..c0d0fb793b 100644
--- a/pkg/http/render/render.go
+++ b/pkg/http/render/render.go
@@ -21,8 +21,8 @@ type SuccessResponse struct {
}
type ErrorResponse struct {
- Status string `json:"status"`
- Error *errors.JSON `json:"error"`
+ Status string `json:"status" required:"true"`
+ Error *errors.JSON `json:"error" required:"true"`
}
func Success(rw http.ResponseWriter, httpCode int, data interface{}) {