Repository navigation
Description
Overview of the issue
When using a custom decorator on a class already decorated with @Component(), compodoc does not read its angular specific properties
The following component does not output its @Inputs and @Outputs because of the extra @Example decorator
@Example({path: "combo-box"})
@Component({...})
export class ComboBox {
@Input() prop = "value";
}
Workaround
Make sure @Component() is the first in the decorator chain
@Component({...})
@Example({path: "combo-box"})
export class ComboBox {
@Input() prop = "value";
}
Operating System, Node.js, npm, compodoc version(s)
Not OS specific, using compodoc version 1.1.11.
Angular configuration, a package.json file in the root folder
{
"name": "vcd-ui-common",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e",
"lint-fix": "tslint --fix \"src/**/*.ts\" --exclude \"src/main/*.ts\"",
"compodoc": "compodoc src/components/ -p tsconfig.json -e json"
},
"private": true,
"dependencies": {
"@angular/animations": "8.2.8",
"@angular/common": "8.2.8",
"@angular/compiler": "8.2.8",
"@angular/core": "8.2.8",
"@angular/forms": "8.2.8",
"@angular/platform-browser": "8.2.8",
"@angular/platform-browser-dynamic": "8.2.8",
"@angular/router": "8.2.8",
"@clr/angular": "2.2.1",
"@clr/ui": "2.2.1",
"@clr/icons": "2.2.1",
"rxjs": "6.4.0",
"tslib": "1.10.0",
"zone.js": "0.9.1",
"@webcomponents/custom-elements": "1.0.0"
},
"husky": {
"hooks": {
"pre-commit": "pretty-quick --staged"
}
},
"devDependencies": {
"@angular-devkit/build-angular": "0.803.9",
"@angular/cli": "8.3.9",
"@angular/compiler-cli": "8.2.8",
"@angular/language-service": "8.2.8",
"@compodoc/compodoc": "1.1.11",
"@types/jasmine": "3.3.8",
"@types/jasminewd2": "2.0.3",
"@types/node": "8.9.4",
"codelyzer": "5.0.0",
"husky": "3.0.9",
"jasmine-core": "3.4.0",
"jasmine-spec-reporter": "4.2.1",
"karma": "4.1.0",
"karma-chrome-launcher": "2.2.0",
"karma-coverage-istanbul-reporter": "2.0.1",
"karma-jasmine": "2.0.1",
"karma-jasmine-html-reporter": "1.4.0",
"prettier": "1.18.2",
"pretty-quick": "2.0.0",
"protractor": "5.4.0",
"ts-node": "7.0.0",
"tslint": "5.15.0",
"typescript": "3.5.3"
}
}
Compodoc installed globally or locally ?
Locally, run through npm run compodoc
If possible sourcecode of the file where it breaks
Doesn't break, just doesn't recognize @Component
If possible your terminal logs before the error
Motivation for or Use Case
I am creating an angular examples app that uses annotations to register components to be showcased.
Reproduce the error
Using the sample component above, run compodoc -e json and notice that the output does not show anything for the components["ComboBox"]inputsClass array
Related issues
Did not find any
Suggest a Fix
It looks like the code that parses the annotations needs to look at all the annotation for a class, not just the first one.
See
| if (classDeclaration.decorators) { |
The loop over decorators for a class only ever looks at the first one. If it's not a directive/component/pipe it just treats it as a regular class without ever checking the other attributes
Activity
juanmendes commentedon Nov 14, 2019
I know the guidelines said to create a branch and a merge request but I was not allowed to push to a custom branch in compodoc so I created a PR. #872
pburgmer commentedon Nov 20, 2019
Same happens if I decorate a pipe with @pipe and @Injectable. Compodoc then ignores the pipe decorator and only generates the documentation for the injectable. There is a link in the menu for the pipe, but I get an 404
juanmendes commentedon Nov 25, 2019
@pburgmer My fix wouldn't fix that, it just ignores unrecognized decorators. It does not add support for two angular decorators. As much as it's kind of related, it probably deserves its own issue.
stale commentedon Jan 24, 2020
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
juanmendes commentedon Jan 30, 2020
Not stale, there's a pending PR
stale commentedon Mar 30, 2020
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
stale commentedon Apr 6, 2020
This issue has been automatically closed because it has not had recent activity. Please file a new issue if you are encountering a similar or related problem. Thank you for your contributions.
lock commentedon Jun 24, 2020
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem. Why locking ? Having issues with the most up-to-date context.
vogloblinsky commentedon Oct 14, 2021
Fixed by 3814299