Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jsii-docgen seems to use javadoc syntax instead of tsdoc #1498

Open
TimothyJones opened this issue Nov 20, 2024 · 0 comments
Open

jsii-docgen seems to use javadoc syntax instead of tsdoc #1498

TimothyJones opened this issue Nov 20, 2024 · 0 comments
Labels
bug Something isn't working p2

Comments

@TimothyJones
Copy link

TimothyJones commented Nov 20, 2024

Version: [email protected] (via [email protected])

Originally opened against jsii-docgen here


tsdoc and javadoc have slightly different syntax.

For example, tsdoc wants a hyphen at the start of @param descriptions, while javadoc does not:

tsdoc
 * @param first - The first parameter
javadoc:
 * @param first The first parameter

I've got automated tooling to enforce tsdoc syntax, but because jsii-docgen assumes the javadoc syntax, then the documentation ends up with errant - characters at the start of each parameter.

Another difference is in links. For example, tsdoc links use | to separate the text from the target, but javadoc does not.

tsdoc   {@link SomeClass | click here}
javadoc {@link SomeClass click here}

However, the generated remarks sections when using -l typescript -f json re-print the links in javadoc syntax, even if the format is typescript.

Reproduction

I've created this repository illustrating both this issue, and the other one I reported at the same time.

Parameter issue:

The relevant part for this issue is the parsing of this line:

    /**
     * This documents a constructor
     * 
     * @param someParameter - this documents the parameter
     */

Which results in this line in the assembly, which is from this segment:

        "parameters": [
          {
            "docs": {
              "summary": "- this documents the parameter."
            },
            "name": "someParameter",
            "type": {
              "primitive": "string"
            }
          }
        ]

(note that the summary inappropriately starts with "- ")

@link issue

Also, in the generated json documentation for typescript, this line is in javadoc syntax -

{@link https://github.com/cdklabs/jsii-docgen/issues/1634 this link}

Which seems odd, as it was originally from a properly formed tsdoc comment here.

{@link https://github.com/cdklabs/jsii-docgen/issues/1634 | this link}

I'm not sure if there are other tsdoc / javadoc issues like these two, these are just the two I noticed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working p2
Projects
None yet
Development

No branches or pull requests

2 participants