Skip to content

docs: incorrect descriptions for inherited class members #22766

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

Merged
merged 1 commit into from
May 24, 2021

Conversation

crisbeto
Copy link
Member

In #22482 some changes were made that switched the doc rendering from description to content in an attempt to expose the descriptions for inherited class members. It turns out that content is actually the description of the member including @param and @returns tags which we don't want to show either.

After some investigation, it turns out that the root cause of the descriptions not being shown is that dgeni won't assign a description if the base class isn't exported.

These changes resolve the issue by falling back to content if there is no description and stripping out the JSDoc tags from it manually.

@crisbeto crisbeto added P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent docs This issue is related to documentation merge safe target: patch This PR is targeted for the next patch release labels May 24, 2021
@crisbeto crisbeto requested a review from devversion May 24, 2021 12:51
@crisbeto crisbeto requested a review from a team as a code owner May 24, 2021 12:51
@google-cla google-cla bot added the cla: yes PR author has agreed to Google's Contributor License Agreement label May 24, 2021
Copy link
Member

@devversion devversion left a comment

Choose a reason for hiding this comment

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

I've looked more into this as it surprised me that the Dgeni TS package would process inherited classes differently. It looks like the docs miss the description field because we manually construct the ClassExportDoc for inherited classes, and these docs are not processed e.g. by the dgeni-packages/jsdoc processors, hence missing the various tag field and description.

I wonder if there is a better solution to this; this is definitely better than using content for now, but it's rather a workaround for a more general problem that could cause issues in other places (e.g. if we test for JSDoc tags elsewhere).

Could you update the comment with a TODO in merge-inherited-properties.ts?

@crisbeto
Copy link
Member Author

I agree that it's a hacky solution and I'll add the TODO, but I'm not sure that the explanation is correct. I was testing against the classes that extend from MatDatepickerInputBase which isn't exported publicly. I noticed that when I export it, the description magically starts working again.

In angular#22482 some changes were made that switched the doc rendering from `description` to `content` in an attempt to expose the descriptions for inherited class members. It turns out that `content` is actually the description of the member including `@param` and `@returns` tags which we don't want to show either.

After some investigation, it turns out that the root cause of the descriptions not being shown is that dgeni won't assign a `description` if the base class isn't exported.

These changes resolve the issue by falling back to `content` if there is no `description` and stripping out the JSDoc tags from it manually.
@crisbeto crisbeto added the action: merge The PR is ready for merge by the caretaker label May 24, 2021
@devversion
Copy link
Member

devversion commented May 24, 2021

@crisbeto If MatDatepickerInputHarnessBase is exported, then Dgeni will pick it up directly within the readTypeScriptModules processor and it will be processed as usual with the jsdoc/ngdoc processor. If it's not exported though, then Dgeni will never come across this symbol and never generate an ApiDoc for it.

To solve this, we have a custom processor that visits e.g. MatDatepickerInputHarness and resolves it's inherited class. i.e. the harness base class. We then create the ClassExportDoc our self. The problem now is that this doc has been created manually after the JSDoc/NGdoc processors from dgeni-packages have already run.. hence the @description tag etc. is not set as property on the ApiDoc. See the jsdoc processor responsible for the description field. I have an idea how we can fix this long-term but it's involving more changes to our Dgeni setup.

@wagnermaciel wagnermaciel merged commit 897e739 into angular:master May 24, 2021
wagnermaciel pushed a commit that referenced this pull request May 24, 2021
In #22482 some changes were made that switched the doc rendering from `description` to `content` in an attempt to expose the descriptions for inherited class members. It turns out that `content` is actually the description of the member including `@param` and `@returns` tags which we don't want to show either.

After some investigation, it turns out that the root cause of the descriptions not being shown is that dgeni won't assign a `description` if the base class isn't exported.

These changes resolve the issue by falling back to `content` if there is no `description` and stripping out the JSDoc tags from it manually.

(cherry picked from commit 897e739)
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Jun 24, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker cla: yes PR author has agreed to Google's Contributor License Agreement docs This issue is related to documentation P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants