jsii-docgen icon indicating copy to clipboard operation
jsii-docgen copied to clipboard

Error: unable to determine assembly since module does not have any types

Open dvonessen opened this issue 2 years ago โ€ข 6 comments

Hi, I have a problem with generating API documentation with jsii-docgen for the python library. Given module layout:

src/
  core/several_files.ts
  addons/
    aws/
      index.ts
    index.ts
  index.ts

The following problem happens as soon as I add a named export on the second level of the library.

# This works!
src/index.ts
export * from "./core"
export * as addons from "./addons"
# As soon as adding follwoing to the src/addons/index.ts
export * as aws from "./aws"

Error message:

 npx projen && npx projen compile && npx projen package-all && rm -f docs/api/api.*.md && npx projen docs:api
๐Ÿ‘พ default | ts-node --project tsconfig.dev.json .projenrc.ts
๐Ÿ‘พ Installing dependencies...
๐Ÿ‘พ install | yarn install --check-files
yarn install v1.22.19
[1/5] ๐Ÿ”  Validating package.json...
[2/5] ๐Ÿ”  Resolving packages...
success Already up-to-date.
โœจ  Done in 2.77s.
๐Ÿ‘พ Installing dependencies...
๐Ÿ‘พ install | yarn install --check-files
yarn install v1.22.19
[1/5] ๐Ÿ”  Validating package.json...
[2/5] ๐Ÿ”  Resolving packages...
success Already up-to-date.
โœจ  Done in 3.45s.
๐Ÿ‘พ compile | jsii --silence-warnings=reserved-word
๐Ÿ‘พ package-all ยป package:js | jsii-pacmak -v --target js
[jsii-pacmak] [INFO] Found 1 modules to package
[jsii-pacmak] [INFO] Packaging NPM bundles
[jsii-pacmak] [INFO] Loading jsii assemblies and translations
[jsii-pacmak] [INFO] Packaging 'js' for @gcix/gcix
[jsii-pacmak] [INFO] js finished
[jsii-pacmak] [INFO] Packaged. npm pack (37.2s) | js (0.1s) | load jsii (0.0s) | cleanup (0.0s)
๐Ÿ‘พ package-all ยป package:python | jsii-pacmak -v --target python
[jsii-pacmak] [INFO] Found 1 modules to package
[jsii-pacmak] [INFO] Packaging NPM bundles
[jsii-pacmak] [INFO] Loading jsii assemblies and translations
[jsii-pacmak] [INFO] Packaging 'python' for @gcix/gcix
[jsii-pacmak] [INFO] python finished
[jsii-pacmak] [INFO] Packaged. npm pack (34.2s) | python (20.5s) | load jsii (0.0s) | cleanup (0.0s)
๐Ÿ‘พ docs:api ยป compile | jsii --silence-warnings=reserved-word
๐Ÿ‘พ docs:api | npx jsii-docgen -l typescript -l python --readme false --output ./docs/api/api
Error: unable to determine assembly since module does not have any types: @gcix/gcix.addons
    at PythonTranspile.getParentModule (/Users/danielvonessen/git/gitlab/dvonessen/gcix/node_modules/jsii-docgen/lib/docgen/transpile/transpile.js:393:19)
    at PythonTranspile.moduleLike (/Users/danielvonessen/git/gitlab/dvonessen/gcix/node_modules/jsii-docgen/lib/docgen/transpile/python.js:240:35)
    at PythonTranspile.type (/Users/danielvonessen/git/gitlab/dvonessen/gcix/node_modules/jsii-docgen/lib/docgen/transpile/python.js:219:33)
    at /Users/danielvonessen/git/gitlab/dvonessen/gcix/node_modules/jsii-docgen/lib/docgen/view/interface.js:16:81
    at Array.map (<anonymous>)
    at new Interface (/Users/danielvonessen/git/gitlab/dvonessen/gcix/node_modules/jsii-docgen/lib/docgen/view/interface.js:16:57)
    at /Users/danielvonessen/git/gitlab/dvonessen/gcix/node_modules/jsii-docgen/lib/docgen/view/interfaces.js:9:25
    at Array.map (<anonymous>)
    at new Interfaces (/Users/danielvonessen/git/gitlab/dvonessen/gcix/node_modules/jsii-docgen/lib/docgen/view/interfaces.js:9:14)
    at new ApiReference (/Users/danielvonessen/git/gitlab/dvonessen/gcix/node_modules/jsii-docgen/lib/docgen/view/api-reference.js:30:27)
๐Ÿ‘พ Task "docs:api" failed when executing "npx jsii-docgen -l typescript -l python --readme false --output ./docs/api/api" (cwd: /Users/USERNAME/git/gitlab/USERNAME/gcix)

The repo can be found at https://gitlab.com/gcix/gcix.

dvonessen avatar Aug 13 '23 05:08 dvonessen

One thing to note this only seems to be when generating api documentation for other languages other than typescript.

antoniordz96 avatar Jan 27 '24 23:01 antoniordz96

@gcix/gcix.addons needs to be a jsii library as well or it's identified wrongly as needing to be one.

mrgrain avatar Jun 10 '24 09:06 mrgrain

I've also run into this, but with java.

The command:

npx jsii-docgen -f json -l java

in my publicly available jsii project @contract-case/case-definition-dsl, produces the following error:

Error: unable to determine assembly since module does not have any types: @contract-case/case-definition-dsl.mocks
    at JavaTranspile.getParentModule (/Users/home/office/contract-case/contract-case/node_modules/jsii-docgen/lib/docgen/transpile/transpile.js:394:19)
    at JavaTranspile.moduleLike (/Users/home/office/contract-case/contract-case/node_modules/jsii-docgen/lib/docgen/transpile/java.js:78:33)
    at JavaTranspile.type (/Users/home/office/contract-case/contract-case/node_modules/jsii-docgen/lib/docgen/transpile/java.js:96:33)

@contract-case/case-definition-dsl.mocks is a submodule of my jsii project. It only re-exports other types though - perhaps that's the problem?

TimothyJones avatar Oct 08 '24 15:10 TimothyJones

in my publicly available jsii project @contract-case/case-definition-dsl, produces the following error:

This seems to be because the submodule @contract-case/case-definition-dsl.mocks doesn't define any types on it's own. It's just a wrapper around some other submodules. Definitely a bug.

mrgrain avatar Oct 08 '24 18:10 mrgrain