Skip to content
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

Merged
merged 4 commits into from
Nov 3, 2023

Conversation

otaviomacedo
Copy link
Contributor

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').


return submodules[0];
if (found.length > 1) {
throw new Error(`Found multiple submodules with name: ${submodule} in assembly ${assembly.name}@${assembly.version}`);
Copy link
Contributor

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.

@@ -315,19 +315,25 @@ export class Documentation {
* Lookup a submodule by a submodule name.
Copy link
Contributor

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@otaviomacedo otaviomacedo requested a review from rix0rrr November 2, 2023 11:50
@mergify mergify bot merged commit 9036833 into main Nov 3, 2023
11 checks passed
@mergify mergify bot deleted the otaviom/nested-submodules branch November 3, 2023 16:16
comcalvi added a commit that referenced this pull request Nov 15, 2023
mergify bot pushed a commit that referenced this pull request Nov 15, 2023
)

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.
rix0rrr pushed a commit that referenced this pull request Nov 21, 2023
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')`.
rix0rrr added a commit that referenced this pull request Nov 21, 2023
(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.
mergify bot pushed a commit that referenced this pull request Nov 21, 2023
(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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants