import ts from "typescript" ; import type { OpenApi } from "../../../types" ; import { Factory } from "../../TsGenerator" ; import * as PathItem from "../components/PathItem" ; import * as Reference from "../components/Reference" ; import * as ConverterContext from "../ConverterContext" ; import * as Guard from "../Guard" ; import * as ToTypeNode from "../toTypeNode" ; import type * as Walker from "../Walker" ; export const generateStatements = ( entryPoint , currentPoint , store , factory , paths , context , converterContext ) : void => { const statements = [ ] ; Object . entries ( paths ) . forEach ( ( [ requestUri , pathItem ] ) => { if ( ! requestUri . startsWith ( "/" ) ) { throw new Error ( `Not start slash: ${ requestUri }` ) ; } if ( Guard . isReference ( pathItem ) ) { const reference = Reference . generate < OpenApi . PathItem > ( entryPoint , currentPoint , pathItem ) ; if ( reference . type === "local" ) { statements . push ( PathItem . generateStatements ( entryPoint , currentPoint , store , factory , requestUri , store . getPathItem ( reference . path ) , context , converterContext ) ) ; } else { statements . push ( PathItem . generateStatements ( entryPoint , reference . referencePoint , store , factory , requestUri , reference . data , context , converterContext ) ) ; } } else { statements . push ( PathItem . generateStatements ( entryPoint , currentPoint , store , factory , requestUri , pathItem , context , converterContext ) ) ; } } ) ; store . addAdditionalStatement ( statements . flat ( ) ) ; } ;