fix: avoid adding empty events or models section in toc#221
Merged
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR fixes an issue where empty Events or Models sections were being added to the table of contents (TOC). The solution refactors the TOC structure generator to conditionally include these sections only when they contain data.
Key Changes:
- Introduced typed wrappers (Endpoints, Webhooks, Callbacks, Models) that combine data with expand flags
- Modified section generator methods to return arrays instead of single objects, enabling conditional inclusion
- Updated calling code to pass structured objects with both data and expand flags
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/application/portal/toc/toc-structure-generator.ts | Refactored to use typed wrappers and return arrays from section generators, enabling conditional section inclusion |
| src/actions/portal/toc/new-toc.ts | Updated to pass structured objects with data and expand flags to the TOC generator |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
aliasghar98
requested changes
Nov 11, 2025
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



This PR fixes an issue where the TOC was adding Events and Models sections even when they were not present in the spec file. Now, these sections are generated only if the spec file contains the relevant data.