function docline(field, fieldName, scopePropName) {
  /* eslint-disable sonarjs/cognitive-complexity */
  const getType = (f) => f.type() || 'string';
  const getDescription = (f) => f.description() ? ` - ${f.description().replace(/\r?\n|\r/g, '')}` : '';
  const getDefault = (f, type) => (f.default() && type === 'string') ? `'${f.default()}'` : f.default();
  const getPName = (pName) => pName ? `${pName}.` : '';

  const buildLineCore = (type, def, pName, fName) => {
    const paramName = `${pName}${fName}`;
    const defaultValue = def !== undefined ? `=${def}` : '';
    return `* @param {${type}} ${paramName}${defaultValue}`;
  };
  
  const buildLine = (f, fName, pName) => {
    const type = getType(f);
    const def = getDefault(f, type);
    const line = buildLineCore(type, def, getPName(pName), fName);
    return line + (type === 'object' ? '' : getDescription(f));
  };

  const buildObjectLines = (f, fName, pName) => {
    const properties = f.properties();
    const mainLine = buildLine(f, fName, pName);

    return `${mainLine  }\n${  Object.keys(properties).map((propName) =>
      buildLine(properties[propName], propName, `${getPName(pName)}${fName}`)
    ).join('\n')}`;
  };

  return getType(field) === 'object'
    ? buildObjectLines(field, fieldName, scopePropName)
    : buildLine(field, fieldName, scopePropName);
}
Generate JSDoc from message properties of the header and the payload

@example
docline(
 Schema {
    _json: {
      type: 'integer',
      minimum: 0,
      maximum: 100,
      'x-parser-schema-id': '<anonymous-schema-3>'
    }
  },
  my-app-header,
  options.message.headers
)

Returned value will be ->  * @param {integer} options.message.headers.my-app-header

@field {object} - Property object
@fieldName {string} - Name of documented property
@scopePropName {string} - Name of param for JSDocs
@returns {string} JSDoc compatible entry