export const parameterName = ( operationId ) : string => `Parameter$${ operationId }` ; export const requestBodyName = ( operationId ) : string => `RequestBody$${ operationId }` ; export const argumentParamsTypeDeclaration = ( operationId ) : string => `Params$${ operationId }` ; export const responseName = ( operationId , statusCode ) : string => `Response$${ operationId }$Status$${ statusCode }` ; export const requestContentType = ( operationId ) : string => `RequestContentType$${ operationId }` ; export const responseContentType = ( operationId ) : string => `ResponseContentType$${ operationId }` ; export const isAvailableVariableName = ( text ) : boolean => { return /^[A-Za-z_0-9\s]+$/ . test ( text ) ; } ; export const escapeText = ( text ) : string => { if ( isAvailableVariableName ( text ) ) { return text ; } return `"${ text }"` ; } ; /** TODO escapeTextにマージする */ export const escapeText2 = ( text ) : { escaped : boolean ; text : string ; } => { if ( isAvailableVariableName ( text ) ) { return { escaped : false , text : text , } ; } return { escaped : true , text : `"${ text }"` , } ; } ;