kiota icon indicating copy to clipboard operation
kiota copied to clipboard

kiota-lock.json changes depending on OS

Open bkoelman opened this issue 1 year ago • 2 comments

Depending on the operating system on which Kiota is run, the direction of slashes changes in kiota-lock.json. In mixed teams, this results in constant pending changes to this file.

On Windows:

"descriptionLocation": "..\\..\\JsonApiDotNetCoreExample\\GeneratedSwagger\\JsonApiDotNetCoreExample.json",

On Ubuntu:

"descriptionLocation": "../../JsonApiDotNetCoreExample/GeneratedSwagger/JsonApiDotNetCoreExample.json",

Our case is worse, because it breaks the build. We run a tool in cibuild that verifies code style on different platforms, and it never succeeds because of this. Where success is defined as: build the code, run an automated reformat, then fail the build if this resulted in uncommitted git changes.

bkoelman avatar Feb 25 '24 23:02 bkoelman

Hi @bkoelman, Thanks for reporting this. The normalization of the path before it gets written down happens here. https://github.com/microsoft/kiota/blob/0495a000e60e69ba45c69ae7d72c75e14a86285c/src/Kiota.Builder/Lock/LockManagementService.cs#L78

And you can add unit tests in this class.

https://github.com/microsoft/kiota/blob/0495a000e60e69ba45c69ae7d72c75e14a86285c/tests/Kiota.Builder.Tests/Lock/LockManagementServiceTests.cs#L39

Do you think you'd be able to send a pull request to correct this issue?

baywet avatar Feb 26 '24 12:02 baywet

Not anytime soon, I'm pretty occupied with other work at the moment.

bkoelman avatar Feb 26 '24 14:02 bkoelman