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 once more generating multiple files when not told to? #978

Open
jonasnordlund opened this issue Sep 10, 2024 · 2 comments
Open

Kiota once more generating multiple files when not told to? #978

jonasnordlund opened this issue Sep 10, 2024 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@jonasnordlund
Copy link

Describe the bug

This issue looks much like #905 in that when I have added a Rest API Client using Kiota, the entire thing is correctly placed in a single Swagger.cs file. However, once I right-click on kiota-lock.json and select either "Generate Kiota output" or "Run Custom Tool", I get all sorts of files in two freshly created "API" and "Models" subfolders + "ApiClient.cs" in the project root despite having "Generate Multiple Files" set to "False" in Options.

This also makes Visual Studio generate hundreds of duplicate member errors causing the project to be uncompilable because the old single file Swagger.cs still remains, and is now untouched.

I can right-click on the "Swagger" item that is the parent to Swagger.cs and select "Run Custom Tool" and then this doesn't present the issue, but I'm now on the other hand unsure if it actually ever retrieves a new OpenAPI schema or just regenerates the single file based on what it had offline.

Support Key: b440d1c

To Reproduce

Steps to reproduce the behavior:

  1. Add a new REST API Client with Kiota and default settings.
  2. Visual Studio will add a Swagger -> Swagger.cs structure in the project along with kiota-lock.json.
  3. Right-click on kiota-lock.json to regenerate the client.
  4. Kiota will now create and fill the "Models" and "API" subfolders, create a new ApiClient.cs, and finally leave the original Swagger.cs untouched per the last modified comment at the top of the file. As a side effect making the project uncompilable due to namespace/class conflicts.

Expected behavior

Refreshed Swagger.cs file upon updating it via kiota-lock.json.

Visual Studio Extension (please complete the following information):

  • Visual Studio Version 2022 - 17.10.4
  • Extension Version 1.11.0
@christianhelle christianhelle self-assigned this Sep 10, 2024
@christianhelle christianhelle added the bug Something isn't working label Sep 10, 2024
@christianhelle
Copy link
Owner

@jonasnordlund Thanks for taking the time to report this. I'll see what I can do

@christianhelle
Copy link
Owner

@jonasnordlund It was easy to reproduce. Thanks for providing detailed steps. This is a bug.

The "Generate Kiota output" feature was built based on a request from a user who has an existing kiota-lock.json file and I didn't properly consider other scenarios when I implemented it

I'll fix this so that the "Generate Kiota output" respects the Kiota settings in this Visual Studio extension

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants