Skip to content

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

@jonasnordlund

Description

@jonasnordlund

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

Metadata

Metadata

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions