microsoft / kiota

OpenAPI based HTTP Client code generator
https://aka.ms/kiota/docs
MIT License
2.97k stars 208 forks source link

Could Not Find File: Truncates the path erroneously #4175

Closed JustinGrote closed 8 months ago

JustinGrote commented 9 months ago

image

Happens with absolute path too

andrueastman commented 9 months ago

Thanks for raising this @JustinGrote

Any chance you can confirm the version of Kiota you using to replicate this? Any chance you run into the issue if you surround the parameter with quotes?

baywet commented 9 months ago

@andrueastman the version is in the screenshot 1.11.1 which is latest. @JustinGrote can you try with quotes just for sanity please? Also which version of PowerShell is that?

JustinGrote commented 9 months ago

Quotes has same issue. image

JustinGrote commented 9 months ago

And this happens in PS5.1, PS7, whether in vscode, windows terminal, or naked. Tried in all contexts.

baywet commented 9 months ago

Thanks for the additional information. I'm running PS7 as well and I'm not able to reproduce the issue. How did you install kiota? Which terminal are you using? Any specific configuration for the OS (localization and such) or for the terminal profile?

JustinGrote commented 9 months ago

Installed as dotnet global tool

PS C:\Users\JGrote> command kiota

CommandType     Name                                               Version    Source
-----------     ----                                               -------    ------
Application     kiota.exe                                          1.11.1.0   C:\Users\JGrote\.dotnet\tools\kiota.exe

As mentioned above, I've tried it in vscode, win term, or just direct pwsh or powershell.exe process

PS C:\Users\JGrote\Projects\PRTG> kiota generate -l CSharp -d prtg.yml -o kiota
crit: Kiota.Builder.KiotaBuilder[0]
      error generating the client: Could not find file 'C:\Users\JGrote\Projects\PRTG\prtg.ym'.
PS C:\Users\JGrote\Projects\PRTG> $psversiontable

Name                           Value
----                           -----
PSVersion                      7.4.1
PSEdition                      Core
GitCommitId                    7.4.1
OS                             Microsoft Windows 10.0.22635
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Here's the spec I'm trying to generate: prtg.yml.txt

baywet commented 9 months ago

Thanks for the additional information. Yes, my configuration is identical at this point. I don't think the description itself matters for that issue. But could you try with this one just for sanity?

How is the OS configured? What language was it installed with? Are long paths enabled? Anything specific about how partitions are formatted?

JustinGrote commented 9 months ago
C:\Users\JGrote>kiota generate -l CSharp -d "C:\users\jgrote\desktop\openapi.yml" -o kiota
crit: Kiota.Builder.KiotaBuilder[0]
      error generating the client: Could not open the file at C:\users\jgrote\desktop\openapi.yml, reason: Could not find file 'C:\users\jgrote\desktop\openapi.yml'.

Windows 11, nothing special. It does have a dev drive, however I tried it with just a standard C: path and still didn't work. Tried it with -noprofile just in case there was something in there (never been an issue before)

I'll give it a try in a docker container.

baywet commented 9 months ago

Interestingly enough that last error message doesn't have a truncated path.

microsoft-github-policy-service[bot] commented 8 months ago

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.