Skip to content

Commit ac0b799

Browse files
author
Сергей Волков
committed
fix: better typings for ParsedRoute interface
1 parent caccd4b commit ac0b799

File tree

2 files changed

+68
-4
lines changed

2 files changed

+68
-4
lines changed

src/schema-routes/schema-routes.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -818,7 +818,7 @@ export class SchemaRoutes {
818818
method,
819819
usageSchema,
820820
parsedSchemas,
821-
) => {
821+
): ParsedRoute => {
822822
const { security: globalSecurity } = usageSchema;
823823
const { moduleNameIndex, moduleNameFirstTag, extractRequestParams } =
824824
this.config;

types/index.ts

Lines changed: 67 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -514,12 +514,76 @@ export type RawRouteInfo = {
514514
consumes?: string[];
515515
};
516516

517+
export interface ParsedRouteRequest {
518+
contentTypes?: string[];
519+
formData?: boolean;
520+
headers?: {
521+
name: string | null;
522+
optional: boolean | undefined;
523+
type: Record<string, any>;
524+
};
525+
isQueryBody?: boolean;
526+
method?: string;
527+
parameters?: Record<string, unknown>[];
528+
path?: string;
529+
pathParams?: Record<string, unknown>;
530+
payload?: { name: string | null; optional?: boolean; type: string };
531+
query?: Record<string, unknown>;
532+
requestParams?: Record<string, unknown> | null;
533+
security?: boolean;
534+
}
535+
536+
export interface ParsedRouteResponse {
537+
contentTypes?: string[];
538+
errorType?: string;
539+
fullTypes?: string;
540+
type?: string;
541+
}
542+
517543
export interface ParsedRoute {
518544
id: string;
519-
jsDocLines: string;
520545
namespace: string;
521-
request: Request;
522-
response: Response;
546+
// biome-ignore lint/suspicious/noExplicitAny: TODO
547+
routeParams?: Record<string, any>;
548+
requestBodyInfo?: {
549+
// biome-ignore lint/suspicious/noExplicitAny: TODO
550+
paramName: any;
551+
// biome-ignore lint/suspicious/noExplicitAny: TODO
552+
contentTypes: any[];
553+
contentKind: string;
554+
// biome-ignore lint/suspicious/noExplicitAny: TODO
555+
schema: any;
556+
// biome-ignore lint/suspicious/noExplicitAny: TODO
557+
type: any;
558+
// biome-ignore lint/suspicious/noExplicitAny: TODO
559+
required: any;
560+
};
561+
responseBodyInfo?: {
562+
// biome-ignore lint/suspicious/noExplicitAny: TODO
563+
contentTypes: any[];
564+
// biome-ignore lint/suspicious/noExplicitAny: TODO
565+
responses: any[];
566+
// biome-ignore lint/suspicious/noExplicitAny: TODO
567+
success?: Record<string, any>;
568+
// biome-ignore lint/suspicious/noExplicitAny: TODO
569+
error?: Record<string, any>;
570+
// biome-ignore lint/suspicious/noExplicitAny: TODO
571+
full?: Record<string, any>;
572+
};
573+
// biome-ignore lint/suspicious/noExplicitAny: TODO
574+
specificArgs?: Record<string, any>;
575+
// biome-ignore lint/suspicious/noExplicitAny: TODO
576+
queryObjectSchema?: Record<string, any>;
577+
// biome-ignore lint/suspicious/noExplicitAny: TODO
578+
pathObjectSchema?: Record<string, any>;
579+
// biome-ignore lint/suspicious/noExplicitAny: TODO
580+
headersObjectSchema?: Record<string, any>;
581+
// biome-ignore lint/suspicious/noExplicitAny: TODO
582+
responseBodySchema?: Record<string, any>;
583+
requestBodySchema?: Record<string, any>;
584+
specificArgNameResolver?: Record<string, any>;
585+
request: ParsedRouteRequest;
586+
response: ParsedRouteResponse;
523587
routeName: RouteNameInfo;
524588
raw: RawRouteInfo;
525589
}

0 commit comments

Comments
 (0)