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

Kiota deletes all files in the directory when output clear is enabled, not only generated files #5977

Open
maisarissi opened this issue Jan 9, 2025 · 2 comments
Labels
priority:p0 Blocking issue. Loss of critical functions eg security/privacy violation. Bug SLA<=48hrs status:waiting-for-triage An issue that is yet to be reviewed or assigned type:bug A broken experience
Milestone

Comments

@maisarissi
Copy link
Contributor

maisarissi commented Jan 9, 2025

Describe the bug

Feedback given by a customer in the market place:

I added API description from https://aka.ms/graph/v1.0/openapi.yaml .
I generated needed client, and then re-generated it.
It asked me When regenerating, all changes made manually to the generated files will be overridden., which seems ok!
And the plugin deleted all my files in the selected directory, including .git and all other source code.

This seems to be reproducible when "Clean Output" is enabled in Kiota VS Code extension settings.

Expected behavior

Kiota should only delete generated files created by itself

How to reproduce

  1. Enable Clean Output in the Kiota VS Code config.
  2. Create a folder foo and put an OpenAPI file in it.
  3. Add a few new files to it, like a .git, .csharp files.
    Image
  4. Use the VS Code extension to select the OpenAPI file
    Image
  5. Select endpoints click generate and provide params for a C# client to be created in that foo folder.
    Image
  6. Kiota will complain that your OpenAPI file has gone because it has deleted all the files in the foo folder.
    Image

Kiota shouldn't delete files that were not created by itself.

The same occurs when regenerating. Same scenario explained by the customer in the market place.

  1. Enable Clean Output in the Kiota VS Code config.
  2. Create a folder foo.
  3. Use the VS Code extension to select the remote (or local) OpenAPI file
  4. Select endpoints click generate and provide params for a C# client to be created in that foo folder.
  5. Add files to the foo folder.
  6. Select the created client, change the endpoint selection and hit regenerate.
  7. Kiota will deleted all files in the foo folder. The ones related to the SDK and all the other files.

Kiota Version

1.22 (latest released)

@maisarissi maisarissi added priority:p0 Blocking issue. Loss of critical functions eg security/privacy violation. Bug SLA<=48hrs status:waiting-for-triage An issue that is yet to be reviewed or assigned type:bug A broken experience labels Jan 9, 2025
@github-project-automation github-project-automation bot moved this to Needs Triage 🔍 in Kiota Jan 9, 2025
@maisarissi
Copy link
Contributor Author

maisarissi commented Jan 9, 2025

The issue seems to be related to creating the SDK in the same folder as the project. When the SDK is created in a subfolder, the issue doesn't seem to be reproducible.

We might want to consider suggesting the default folder, a subfolder rather than the parent folder to avoid this issue.
Open to suggestion of the name we should use for the subfolder.

@maisarissi
Copy link
Contributor Author

Another more elegant (and more costly) approach would be somehow add a Kiota signature to all generated files and only delete files created by Kiota.

@baywet baywet added this to the Kiota v1.23 milestone Jan 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority:p0 Blocking issue. Loss of critical functions eg security/privacy violation. Bug SLA<=48hrs status:waiting-for-triage An issue that is yet to be reviewed or assigned type:bug A broken experience
Projects
Status: Needs Triage 🔍
Development

No branches or pull requests

2 participants