import { VdmParameter } from '../../vdm-types' ; import { isNullableProperty } from '../../generator-utils' ; import { parameterDescription } from '../description-util' ; import { EdmxNamed , EdmxParameter } from '../../edmx-parser/common' ; import { SwaggerPath } from '../../swagger-parser' ; import { ServiceNameFormatter } from '../../service-name-formatter' ; import { EdmxFunctionImportV2 as EdmxFunctionImportV2 } from '../../edmx-parser/v2' ; import { EdmxActionImport , EdmxFunctionImportV4 as EdmxFunctionImportV4 } from '../../edmx-parser/v4' ; import { getTypeMappingActionFunction } from '../edmx-to-vdm-util' ; internal export function getActionImportParameters ( edmxActionImport , edmxParameters , swaggerDefinition , formatter ) { return getParameter ( edmxActionImport , edmxParameters , swaggerDefinition , formatter ) ; } internal export function getFunctionImportParameters ( edmxFunctionImport , edmxParameters , swaggerDefinition , formatter ) { return getParameter ( edmxFunctionImport , edmxParameters , swaggerDefinition , formatter ) ; } function getParameter < T extends EdmxNamed > ( edmxActionFunctionImport , edmxParameters , swaggerDefinition , formatter ) { return edmxParameters . map ( p => { const swaggerParameter = swaggerDefinition ? swaggerDefinition . parameters . find ( param => param . name === p . Name ) : undefined ; const typeMapping = getTypeMappingActionFunction ( p . Type ) ; return { originalName : p . Name , parameterName : formatter . originalToParameterName ( edmxActionFunctionImport . Name , p . Name ) , edmType : typeMapping . edmType , jsType : typeMapping . jsType , fieldType : typeMapping . fieldType , nullable : isNullableProperty ( p ) , description : parameterDescription ( p , swaggerParameter ) } ; } ) ; }