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

Fix @externalDocumentation rendering #2263

Closed

Conversation

msosnicki
Copy link
Contributor

Background

Currently the key and value from the @externalDocumentation trait is taken in the wrong order, leading to rendering of the following:

<a href="External docs">https://external.docs/structureTrait</a>
  • What do these changes do?
  • Why are they important?

Testing

  • How did you test these changes? Added unit test

Links

  • Links to additional context, if necessary
  • Issue #, if applicable (see here for a list of keywords to use for linking issues)

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@msosnicki msosnicki requested a review from a team as a code owner April 29, 2024 06:49
@msosnicki msosnicki requested a review from haydenbaker April 29, 2024 06:49
String expectedStructureExternalDocs = "<a href=\"https://external.docs/structureTrait\">External docs</a>";
assertTrue(fileStringOptional.get().contains(expectedStructureExternalDocs));
// String expectedFieldExternalDocs = "<a href=\"https://external.docs/structureTrait#fieldA\">External docs</a>";
// assertTrue(fileStringOptional.get().contains(expectedFieldExternalDocs));
Copy link
Contributor Author

@msosnicki msosnicki Apr 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made these just for demonstration purposes, can revert as this is not related to this PR. Uncommenting these lines will make the test fail, even though there is

    @externalDocumentation(
        "External docs": "https://external.docs/structureTrait#fieldA"
    )
    fieldA: String

To make it work, it has to contain a documentation section:

    /// some other docs
    @externalDocumentation(
        "External docs": "https://external.docs/structureTrait#fieldA"
    )
    fieldA: String

I believe this is because how the interceptors are implemented, the ExternalDocsInterceptor has

    @Override
    public Class<JavaDocSection> sectionType() {
        return JavaDocSection.class;
    }

but this condition does not hold in the failing case.

I can raise an issue if you also feel that this is a problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant