import ts from "typescript" ; import type { OpenApi } from "../../../types" ; import { Factory } from "../../TsGenerator" ; import * as ConverterContext from "../ConverterContext" ; import * as ToTypeNode from "../toTypeNode" ; import type * as Walker from "../Walker" ; import * as MediaType from "./MediaType" ; export const generateInterface = ( entryPoint , currentPoint , factory , name , requestBody , context , converterContext ) : ts . InterfaceDeclaration => { const contentSignatures = MediaType . generatePropertySignatures ( entryPoint , currentPoint , factory , requestBody . content || { } , context , converterContext ) ; return factory . InterfaceDeclaration . create ( { export : true , name , members : contentSignatures , } ) ; } ; export const generateNamespace = ( entryPoint , currentPoint , store , factory , parentName , name , requestBody , context , converterContext ) : void => { const escapeName = converterContext . escapeDeclarationText ( name ) ; const basePath = `${ parentName }/${ name }` ; store . addStatement ( basePath , { kind : "namespace" , name : converterContext . escapeDeclarationText ( escapeName ) , comment : requestBody . description , } ) ; store . addStatement ( `${ basePath }/Content` , { kind : "interface" , name : "Content" , value : generateInterface ( entryPoint , currentPoint , factory , "Content" , requestBody , context , converterContext ) , } ) ; } ;