Contract-first API with DTOs, validation, and server-side OpenAPI post-processing
Add dedicated request/response DTOs for all controllers, replacing raw JsonNode parameters with validated types. Move OpenAPI path-prefix stripping and ProcessorNode children injection into OpenApiCustomizer beans so the spec served at /api/v1/api-docs is already clean — eliminating the need for the ui/scripts/process-openapi.mjs post-processing script. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,12 +1,6 @@
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import { api } from '../client';
|
||||
import type {
|
||||
SearchRequest,
|
||||
ExecutionStats,
|
||||
ExecutionSummary,
|
||||
StatsTimeseries,
|
||||
ExecutionDetail,
|
||||
} from '../schema-types';
|
||||
import type { SearchRequest } from '../types';
|
||||
|
||||
export function useExecutionStats(timeFrom: string | undefined, timeTo: string | undefined) {
|
||||
return useQuery({
|
||||
@@ -21,7 +15,7 @@ export function useExecutionStats(timeFrom: string | undefined, timeTo: string |
|
||||
},
|
||||
});
|
||||
if (error) throw new Error('Failed to load stats');
|
||||
return data as unknown as ExecutionStats;
|
||||
return data!;
|
||||
},
|
||||
enabled: !!timeFrom,
|
||||
placeholderData: (prev) => prev,
|
||||
@@ -37,7 +31,7 @@ export function useSearchExecutions(filters: SearchRequest, live = false) {
|
||||
body: filters,
|
||||
});
|
||||
if (error) throw new Error('Search failed');
|
||||
return data as unknown as { data: ExecutionSummary[]; total: number; offset: number; limit: number };
|
||||
return data!;
|
||||
},
|
||||
placeholderData: (prev) => prev,
|
||||
refetchInterval: live ? 5_000 : false,
|
||||
@@ -58,7 +52,7 @@ export function useStatsTimeseries(timeFrom: string | undefined, timeTo: string
|
||||
},
|
||||
});
|
||||
if (error) throw new Error('Failed to load timeseries');
|
||||
return data as unknown as StatsTimeseries;
|
||||
return data!;
|
||||
},
|
||||
enabled: !!timeFrom,
|
||||
placeholderData: (prev) => prev,
|
||||
@@ -74,7 +68,7 @@ export function useExecutionDetail(executionId: string | null) {
|
||||
params: { path: { executionId: executionId! } },
|
||||
});
|
||||
if (error) throw new Error('Failed to load execution detail');
|
||||
return data as unknown as ExecutionDetail;
|
||||
return data!;
|
||||
},
|
||||
enabled: !!executionId,
|
||||
});
|
||||
@@ -96,7 +90,7 @@ export function useProcessorSnapshot(
|
||||
},
|
||||
);
|
||||
if (error) throw new Error('Failed to load snapshot');
|
||||
return data as unknown as Record<string, string>;
|
||||
return data!;
|
||||
},
|
||||
enabled: !!executionId && index !== null,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user