cesarParra / apexdocs

Node.js tool to generate documentation for your Salesforce Apex Classes.
https://www.npmjs.com/package/@cparra/apexdocs
MIT License
101 stars 18 forks source link

Don't parse escaped annotations within comments on methods and variables #93

Closed pozil closed 9 months ago

pozil commented 9 months ago

Hi @cesarParra this issue is a follow up on #88. I just realized that while you deployed a fix for escaped annotations within class-level comments, the issue persists on method/variable comments.

For example, generating doc for the following code:

/**
 * @description Demonstrates the `@future` syntax and usage
 * @group Async Apex Recipes
 */
public with sharing class AtFutureRecipes {
    /**
     * This class features a 'circuit breaker' variable. While this is not a
     * pattern I routinely turn to, it is a valuable pattern for testing code
     * that is otherwise hard to test. For instance, `@future` methods must be
     * static void methods...
     */
    @testVisible
    private static Boolean testCircuitBreaker = false;
}

will crash with this error:

10/4/2023, 4:25:35 PM: AtFutureRecipes - Doc comment parsing error. Level: Field
10/4/2023, 4:25:35 PM: Comment:
 /**
   * This class features a 'circuit breaker' variable. While this is not a
   * pattern I routinely turn to, it is a valuable pattern for testing code
   * that is otherwise hard to test. For instance, `@future` methods must be
   * static void methods...
   */
10/4/2023, 4:25:35 PM: Exception: Error parsing Apex doc. Line 4:53 - mismatched input '`@future`' expecting {NAME, NEWLINE, SPACE, TEXT_CONTENT, '*', '/', JAVADOC_END, '{@', '{', '}'}
cesarParra commented 9 months ago

I have identified the issue. The gap is with description blocks without the preceding @description tag. Working on a fix.

pozil commented 9 months ago

Awesome, thanks a lot. I'll add the description tag in the meantime.

cesarParra commented 9 months ago

Addressed in v2.17.1 https://www.npmjs.com/package/@cparra/apexdocs/v/2.17.1