import { unixEOL , titleFormat } from '@sap-cloud-sdk/util' ; import { endWithDot , ensureString } from '../generator-utils' ; import { EdmxDocumented , EdmxEntitySetBase , EdmxParameter , EdmxProperty , JoinedEntityMetadata } from '../edmx-parser/common' ; import { SwaggerDescribed , SwaggerPath , SwaggerPathParameter , SwaggerProperty } from '../swagger-parser' ; internal export function longDescription ( documented , described ? ) { let docs = '' ; if ( documented . Documentation ) { const summary = ensureString ( documented . Documentation . Summary ) ; const longDesc = ensureString ( documented . Documentation . LongDescription ) ; docs = `${ summary }${ unixEOL }${ longDesc }` . trim ( ) ; } if ( ! docs && described ) { docs = ensureString ( described . description ) ; } return endWithDot ( docs . trim ( ) ) ; } internal export function shortPropertyDescription ( property , swaggerProperty ? ) { const desc = property [ 'sap:quickinfo' ] || property [ 'sap:label' ] || swaggerProperty ?. title || '' ; return endWithDot ( desc . trim ( ) ) ; } internal export function propertyDescription ( property , swaggerProperty ? ) { const short = shortPropertyDescription ( property , swaggerProperty ) ; const long = longDescription ( property , swaggerProperty ) ; return `${ short }${ unixEOL }${ long }` . trim ( ) ; } internal export function parameterDescription ( parameter , swaggerParameter ? ) { const short = endWithDot ( titleFormat ( parameter . Name ) ) ; const long = longDescription ( parameter , swaggerParameter ) ; return endWithDot ( ( long || short ) . trim ( ) ) ; } internal export function functionImportDescription ( swaggerDefinition , originalName ) { return endWithDot ( swaggerDefinition ?. summary || titleFormat ( originalName ) ) ; } internal export function actionImportDescription ( swaggerDefinition , originalName ) { return functionImportDescription ( swaggerDefinition , originalName ) ; } internal export function entityDescription ( entity , className ) { return ( entity . entityType [ 'sap:label' ] || entity . swaggerDefinition ?. title || titleFormat ( className ) ) ; }