Repository navigation
ApiExtractor now creates ApiDocumentation after all members have been created - #81
Conversation
Pete Gonzalez (octogonz)
left a comment
There was a problem hiding this comment.
Overall looks good, assuming you fix the various issues
|
|
||
| this.package = new ApiPackage(this, rootFile); | ||
| this.package = new ApiPackage(this, rootFile); // construct members | ||
| this.package.resolveReferences(); // creates ApiDocumentation |
There was a problem hiding this comment.
Do you need to update the Gulp task? This is a breaking API change
There was a problem hiding this comment.
We don't this change is contained within the Extractor.analyze() function so it is hidden to the Gulp task.
|
|
||
| /** | ||
| * We need the extractor to access the package that this ApiItem | ||
| * belongs to in order to resolve references. |
There was a problem hiding this comment.
Can we obtain that via ApiItem.package.extractor?
There was a problem hiding this comment.
ApiItem doesn't have a package property.
| TypeLiteral = 9 | ||
| } | ||
|
|
||
| /** |
There was a problem hiding this comment.
Maybe reference the resolveReferences() stage
| */ | ||
| Unresolved = 0, | ||
| /** | ||
| * The refernces of this ApiItem are in the process of being resolved. |
There was a problem hiding this comment.
Maybe clarify "inside a recursive call to ApiItem.resolveReferences()"
| @virtual | ||
| protected onResolveReferences(): void { | ||
| this.documentation = new ApiDocumentation(this, this.extractor.docItemLoader, this.extractor, this.reportError); | ||
| // this.collectTypeReferences(this); |
| protected onResolveReferences(): void { | ||
| super.onResolveReferences(); | ||
| this.memberItems.forEach(apiItem => { | ||
| apiItem.resolveReferences(); // <==== crawling tree |
There was a problem hiding this comment.
crawling tree?
| this.params = []; | ||
| for (const param of methodDeclaration.parameters) { | ||
| const declarationSymbol: ts.Symbol = TypeScriptHelpers.tryGetSymbolForDeclaration(param); | ||
| const docComment: string = declarationSymbol && this.documentation && this.documentation.paramDocs ? |
There was a problem hiding this comment.
Could you run this on sp-core-library and make sure the output JSON doesn't have any diff from the last release? That would help confirm that we don't need this code.
| * | ||
| * @param memberName - the name of the member ApiItem | ||
| */ | ||
| protected getMemberItem(memberName: string): ApiItem { |
There was a problem hiding this comment.
Is this used in this PR?
| * | ||
| * @param memberName - the name of the member we want to ensure has documentation created. | ||
| */ | ||
| public resolveReferencesOnItem(memberName: string): ApiItem { |
There was a problem hiding this comment.
This looks weird. Maybe we should bump it to the next PR if nothing is using it.
| /* tslint:disable:no-constant-condition */ | ||
|
|
||
| import * as ts from 'typescript'; | ||
| import { virtual } from '@microsoft/decorators/lib/virtual'; |
There was a problem hiding this comment.
Don't use path-based imports
Dan Gaeta (dgaeta)
left a comment
There was a problem hiding this comment.
Response to comments
|
|
||
| /** | ||
| * We need the extractor to access the package that this ApiItem | ||
| * belongs to in order to resolve references. |
There was a problem hiding this comment.
ApiItem doesn't have a package property.
…eferences ApiExtractor now creates ApiDocumentation after all members have been created
…resolve-references ApiExtractor now creates ApiDocumentation after all members have been created
Refactored the creation of documention for ApiItems to occur after the abstract syntax tree has been created. This will be useful for implementing local API reference inheritdocs.