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

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

* fix(openapi): fix the frontend types
This commit is contained in:
Vikrant Gupta
2026-02-23 16:47:24 +05:30
committed by GitHub
parent c04f664e2f
commit 465e07de83
8 changed files with 22 additions and 14 deletions

View File

@@ -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:

View File

@@ -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;
}
/**

View File

@@ -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;
}

View File

@@ -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]);

View File

@@ -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>

View File

@@ -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;

View File

@@ -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"`
}

View File

@@ -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{}) {