@@ -10,13 +10,18 @@ import {
1010 autocorrectRef ,
1111 getSchemaNameByRef ,
1212 getSchemaRef ,
13- getUniqueOperationName ,
14- getUniqueOperationNamesWithoutSplitByTags ,
1513 isMediaTypeAllowed ,
1614 isParamMediaTypeAllowed ,
15+ isPathExcluded ,
1716} from "../utils/openapi.utils" ;
17+ import {
18+ getOperationsByTag ,
19+ getUniqueOperationName ,
20+ getUniqueOperationNamesWithoutSplitByTags ,
21+ isOperationExcluded ,
22+ } from "../utils/operation.utils" ;
1823import { snakeToCamel } from "../utils/string.utils" ;
19- import { formatTag , getOperationsByTag , getOperationTag } from "../utils/tag.utils" ;
24+ import { formatTag , getOperationTag } from "../utils/tag.utils" ;
2025import {
2126 getBodyZodSchemaName ,
2227 getResponseZodSchemaName ,
@@ -26,18 +31,17 @@ import {
2631import { DependencyGraph , getOpenAPISchemaDependencyGraph } from "./openapi/getOpenAPISchemaDependencyGraph" ;
2732import { getDeepSchemaRefObjs , getSchemaRefObjs } from "./openapi/getSchemaRefObjs" ;
2833import { ZodSchema } from "./zod/ZodSchema.class" ;
34+ import { resolveExtractedEnumZodSchemaNames } from "./zod/enumExtraction/resolveExtractedEnumZodSchemaNames" ;
35+ import { resolveExtractedEnumZodSchemaTags } from "./zod/enumExtraction/resolveExtractedEnumZodSchemaTags" ;
36+ import { updateExtractedEnumZodSchemaData } from "./zod/enumExtraction/updateExtractedEnumZodSchemaData" ;
2937import { getEnumZodSchemasFromOpenAPIDoc } from "./zod/getZodSchemasFromOpenAPIDoc" ;
30- import {
31- resolveExtractedEnumZodSchemaNames ,
32- resolveExtractedEnumZodSchemaTags ,
33- updateExtractedEnumZodSchemaData ,
34- } from "./zod/updateExtractedEnumZodSchemaData" ;
3538
3639interface SchemaData {
3740 ref : string ;
3841 name : string ;
3942 zodSchemaName : string ;
4043 tags : string [ ] ;
44+ deepRefOperations : OperationObject [ ] ;
4145}
4246
4347interface ZodSchemaData {
@@ -110,6 +114,10 @@ export class SchemaResolver {
110114 return this . docSchemas [ getSchemaNameByRef ( ref ) ] as OpenAPIV3 . SchemaObject ;
111115 }
112116
117+ getSchemaDataByName ( name : string ) {
118+ return this . schemaData . find ( ( data ) => data . name === name ) ;
119+ }
120+
113121 getZodSchemaNameByRef ( ref : string ) {
114122 const zodSchemaName =
115123 this . getSchemaDataByRef ( autocorrectRef ( ref ) ) ?. zodSchemaName ??
@@ -284,17 +292,20 @@ export class SchemaResolver {
284292 const correctRef = autocorrectRef ( ref ) ;
285293 const name = getSchemaNameByRef ( correctRef ) ;
286294 const zodSchemaName = getZodSchemaName ( name , this . options . schemaSuffix ) ;
287- this . schemaData . push ( { ref : correctRef , name, zodSchemaName, tags : [ ] } ) ;
295+ this . schemaData . push ( { ref : correctRef , name, zodSchemaName, tags : [ ] , deepRefOperations : [ ] } ) ;
288296 } ) ;
289297
290298 for ( const path in this . openApiDoc . paths ) {
299+ if ( isPathExcluded ( path , this . options ) ) {
300+ continue ;
301+ }
302+
291303 const pathItemObj = this . openApiDoc . paths [ path ] as OpenAPIV3 . PathItemObject ;
292304
293305 const pathItem = pick ( pathItemObj , ALLOWED_METHODS ) ;
294306 for ( const method in pathItem ) {
295307 const operation = pathItem [ method as keyof typeof pathItem ] as OperationObject | undefined ;
296-
297- if ( ! operation || ( operation . deprecated && ! this . options . withDeprecatedEndpoints ) ) {
308+ if ( ! operation || isOperationExcluded ( operation , this . options ) ) {
298309 continue ;
299310 }
300311
@@ -380,6 +391,7 @@ export class SchemaResolver {
380391 const schemaData = this . getSchemaDataByRef ( schemaRef ) ;
381392 if ( schemaData ) {
382393 schemaData . tags . push ( tag ) ;
394+ schemaData . deepRefOperations . push ( operation ) ;
383395 }
384396 } ) ;
385397 }
0 commit comments