Skip to content

[BUG] Could not generate doc with typed Object as 'data' in Angular Routes #661

Closed

Description

@lutzvahl
Overview of the issue
Operating System, Node.js, npm, compodoc version(s)
Angular configuration, a package.json file in the root folder

"dependencies": {
"@angular/common": "^6.1.6",
"@angular/compiler": "^6.1.6",
"@angular/core": "^6.1.6",
"@angular/forms": "^6.1.6",
"@angular/http": "^6.1.6",
"@angular/platform-browser": "^6.1.6",
"@angular/platform-browser-dynamic": "^6.1.6",
"@angular/router": "^6.1.6",
"@ng-bootstrap/ng-bootstrap": "^3.2.0",
"core-js": "^2.5.7",
"fingerprintjs2": "^1.8.1",
"font-awesome": "^4.7.0",
"linqts": "^1.12.0",
"moment": "^2.22.2",
"ng2-charts": "^1.6.0",
"ngx-bootstrap": "^3.0.1",
"object-assign": "^4.1.1",
"rxjs": "^6.3.1",
"stacktrace-js": "^2.0.0",
"typescript": "^2.9.2",
"zone.js": "^0.8.26"
},
"devDependencies": {
"@angular-builders/custom-webpack": "^2.3.0",
"@angular-devkit/architect": "^0.7.5",
"@angular-devkit/build-angular": "^0.7.5",
"@angular-devkit/core": "^0.7.5",
"@angular/cli": "^6.1.5",
"@angular/compiler-cli": "^6.1.6",
"@compodoc/compodoc": "^1.1.5",
"@types/angular": "^1.5.16",
"@types/angular-resource": "^1.5.6",
"@types/angular-route": "^1.3.2",
"@types/angular-sanitize": "^1.3.3",
"@types/hammerjs": "^2.0.35",
"@types/uglify-js": "^2.6.28",
"codelyzer": "^4.4.4",
"intl": "^1.2.5",
"less": "^2.7.2",
"ts-node": "^3.0.2",
"tslib": "^1.9.3",
"tslint": "^5.11.0",
"typedoc": "^0.12.0",
"webpack-bundle-analyzer": "^2.13.1",
"webpack-sources": "^1.2.0"
},
"engines": {
"node": ">= 8",
"npm": ">= 5"
}

Compodoc installed globally or locally ?

locally

If possible sourcecode of the file where it breaks

const routes: Routes = [
{
path: "", component: MyComp, children: [
{ path: 'details/:id', redirectTo: '/details/:id/DETAILS', pathMatch: 'full' },
{
path: "details/:id/:detailsSection", loadChildren: "../lazy/xx-yy-details.module#DetailsModule"
, data: new LazyRoutingOptions({ preload: true, delay: 2500 })
}
]
}
];

With the following code the generation is working:

const routes: Routes = [
{
path: "", component: MyComp, children: [
{ path: 'details/:id', redirectTo: '/details/:id/DETAILS', pathMatch: 'full' },
{
path: "details/:id/:detailsSection", loadChildren: "../lazy/xx-yy-details.module#DetailsModule"
, data: { preload: true, delay: 2500 }
}
]
}
];

If possible your terminal logs before the error

Unhandled Rejection at: Promise {
{ SyntaxError: JSON5: invalid character '(' at 1:285
at syntaxError (C:\XXX\node_modules@compodoc\compodoc\node_modules\json5\lib\parse.js:1083:17)
at invalidChar (C:\XXX\node_modules@compodoc\compodoc\node_modules\json5\lib\parse.js:1028:12)
at Object.afterPropertyValue (C:\XXX\node_modules@compodoc\compodoc\node_modules\json5\lib\parse.js:654:15)
at Object.default (C:\XXX\node_modules@compodoc\compodoc\node_modules\json5\lib\parse.js:146:37)
at lex (C:\XXX\node_modules@compodoc\compodoc\node_modules\json5\lib\parse.js:78:42)
at Object.parse (C:\XXX\node_modules@compodoc\compodoc\node_modules\json5\lib\parse.js:25:17)
at loopInsideModule (C:\XXX\node_modules@compodoc\compodoc\dist\index-cli.js:1073:52)
at loopRoutesParser (C:\XXX\node_modules@compodoc\compodoc\dist\index-cli.js:1106:29)
at loopRoutesParser (C:\XXX\node_modules@compodoc\compodoc\dist\index-cli.js:1111:21)
at RouterParserUtil.constructRoutesTree (C:\XXX\node_modules@compodoc\compodoc\dist\index-cli.js:1115:9) lineNumber: 1, columnNumber: 285 } } reason: { SyntaxError: JSON5: invalid character '(' at 1:285
at syntaxError (C:\XXX\node_modules@compodoc\compodoc\node_modules\json5\lib\parse.js:1083:17)
at invalidChar (C:\XXX\node_modules@compodoc\compodoc\node_modules\json5\lib\parse.js:1028:12)
at Object.afterPropertyValue (C:\XXX\node_modules@compodoc\compodoc\node_modules\json5\lib\parse.js:654:15)
at Object.default (C:\XXX\node_modules@compodoc\compodoc\node_modules\json5\lib\parse.js:146:37)
at lex (C:\XXX\node_modules@compodoc\compodoc\node_modules\json5\lib\parse.js:78:42)
at Object.parse (C:\XXX\node_modules@compodoc\compodoc\node_modules\json5\lib\parse.js:25:17)
at loopInsideModule (C:\XXX\node_modules@compodoc\compodoc\dist\index-cli.js:1073:52)
at loopRoutesParser (C:\XXX\node_modules@compodoc\compodoc\dist\index-cli.js:1106:29)
at loopRoutesParser (C:\XXX\node_modules@compodoc\compodoc\dist\index-cli.js:1111:21)
at RouterParserUtil.constructRoutesTree (C:\XXX\node_modules@compodoc\compodoc\dist\index-cli.js:1115:9) lineNumber: 1, columnNumber: 285 }
[13:30:46] Sorry, but there was a problem during parsing or generation of the documentation. Please fill an issue on github. (https://github.com/compodoc/compodoc/issues/new)
npm ERR! code ELIFECYCLE
npm ERR! errno 1

Motivation for or Use Case

Type security of lazy loading options

Related issues

#404 and Routing Issues https://github.com/compodoc/compodoc/projects/3

Suggest a Fix

Activity

  1. bartios commented on Sep 27, 2018

    @bartios

    looks like something related to #525 to me

  2. added this to the 1.1.7 milestone on Oct 10, 2018
  3. modified the milestones: 1.1.7, 1.1.9 on Jan 29, 2019
  4. modified the milestones: 1.1.9, 1.3.0 on Feb 23, 2019
  5. thatsmeta commented on Jun 4, 2019

    @thatsmeta

    Please fix this...

  6. stale commented on Sep 30, 2019

    @stale

    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.

  7. stale commented on Oct 7, 2019

    @stale

    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.

  8. lock commented on Dec 6, 2019

    @lock

    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.

  9. locked as resolved and limited conversation to collaborators on Dec 6, 2019
  10. added a commit that references this issue on May 24, 2026
    b5b44da
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions