Added file existence check before override generateFromTypeSpec flag#13415
Merged
Added file existence check before override generateFromTypeSpec flag#13415
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a file access issue in the .NET SDK generation workflow by adding a file existence check before attempting to read generateOutput.json. Previously, the code would throw an error when the file didn't exist; now it gracefully handles the absence of the file by only processing it when it exists.
- Added
fs.existsSync()check before readinggenerateOutput.json - Changed error handling from throwing to gracefully continuing when file is absent
- Version bumped from 0.9.5 to 0.9.6
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| tools/spec-gen-sdk/src/automation/reportStatus.ts | Added file existence check in the condition and removed error throwing when file is absent, allowing graceful handling when generation configuration is not enabled for .NET |
| tools/spec-gen-sdk/package.json | Bumped version to 0.9.6 |
| tools/spec-gen-sdk/package-lock.json | Updated lockfile to reflect new version 0.9.6 |
| tools/spec-gen-sdk/CHANGELOG.md | Added release notes for version 0.9.6 documenting the fix |
Files not reviewed (1)
- tools/spec-gen-sdk/package-lock.json: Language not supported
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
chidozieononiwu
approved these changes
Dec 20, 2025
JiaqiZhang-Dev
pushed a commit
that referenced
this pull request
Dec 22, 2025
…13415) * Added file existence check before override generateFromTypeSpec flag * Fixed lint issue * Update tools/spec-gen-sdk/CHANGELOG.md Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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.
Fixed the following issue introduced by PR:
We already have the file existence check after SDK is generated, however, this issue happens when SDK generation configuration isn't enabled which causes the generation step to be skipped. So, we need to check the file existence and cannot throw the exception if the file doesn't exist. Instead, do not override the flag when the file doesn't exist.
Repro pipeline run