-
Notifications
You must be signed in to change notification settings - Fork 13
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
feat: Documentation.toJson() can handle nested submodules #1190
Conversation
|
||
return submodules[0]; | ||
if (found.length > 1) { | ||
throw new Error(`Found multiple submodules with name: ${submodule} in assembly ${assembly.name}@${assembly.version}`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm pretty sure this can never happen, but okay.
src/docgen/view/documentation.ts
Outdated
@@ -315,19 +315,25 @@ export class Documentation { | |||
* Lookup a submodule by a submodule name. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe update the docs to indicate what we now support?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
)" This reverts commit 9036833.
) Reverts #1190. Reverting https://github.com/cdklabs/construct-hub/pull/1350/files wasn't sufficient to unblock constructhub, we're still getting the same errors messages (which originate from jsii-docgen). Reverting this should unblock the pipeline.
Allow users to create documentation for nested modules. Suppose a project has the following submodule structure: ``` my-project └── foo └── bar ``` where `foo` and `bar` are submodules. To generate documentation for the `bar` module, call `documentation.toJson('foo.bar')`.
(This is a re-roll of #1190). `jsii-docgen` used to assume that submodules only went one level deep, i.e. that there could not be submodules within submodules. Break that assumption by doing the following: - Use `assembly.allSubmodules` everywhere `assembly.submodules` used to be used. - Address submodules by FQN instead of by `name` (which only holds the last name component). - As an exception: `documentation.toJson()` accepts both FQN as well as root-relative name for backwards compatibility.
(This is a re-roll of #1190). `jsii-docgen` used to assume that submodules only went one level deep, i.e. that there could not be submodules within submodules. Break that assumption by doing the following: - Use `assembly.allSubmodules` everywhere `assembly.submodules` used to be used. - Address submodules by FQN instead of by `name` (which only holds the last name component). - As an exception: `documentation.toJson()` accepts both FQN as well as root-relative name for backwards compatibility.
Allow users to create documentation for nested modules. Suppose a project has the following submodule structure:
where
foo
andbar
are submodules. To generate documentation for thebar
module, calldocumentation.toJson('foo.bar')
.