Azure / autorest.powershell

AutoRest PowerShell Generator
MIT License
113 stars 83 forks source link

xkdc demo fails #768

Closed Agazoth closed 2 years ago

Agazoth commented 3 years ago

2 issues in the XKDC demo:

1: The file reference in the readme is wrong.

2: Running the demo as described fails with the following error:

 autorest --powershell --input-file:./xkcd.yaml
AutoRest code generation utility [cli version: 3.2.0; node: v14.16.1, max-memory: 4096 MB]
(C) 2018 Microsoft Corporation.
https://aka.ms/autorest
   Loading AutoRest core      'C:\Users\Ax\.autorest\@autorest_core@3.4.0\node_modules\@autorest\core\dist' (3.4.0)
INFORMATION:
The default version of @autorest/powershell has been bumped from 2.1+ to 3.0+.
 > If you still want to use 2.1+ version, please specify it with --use:@autorest/powershell@2.1.{x}, e.g 2.1.401.

INFORMATION: > Loading AutoRest extension '@autorest/powershell' (~3.0.0->3.0.428)
INFORMATION: > Loading AutoRest extension '@autorest/modelerfour' (4.15.414->4.15.414)
Process() cancelled due to failure
ERROR: Schema violation: should match format "uri" (externalDocs > url)
  format: uri
    - file:///C:/dev/temp/xkdc/xkcd.yaml:25:2 ($.externalDocs.url)
ERROR: Schema violation: should match format "uri" (externalDocs > url)
  format: uri
    - file:///C:/dev/temp/xkdc/xkcd.yaml:25:2 ($.externalDocs.url)
Clebam commented 3 years ago

I found that the xkcd.yaml had https: [space] // instead of https://

However I'm still stuck afterwards but can't figure out why (and it's probably unrelated with this issue)

(FYI here is my error

C:\Workspace\Test\powershell\generated\Xkcd.csproj : error NU1100: Unable to resolve 'NETStandard.Library (>= 2.0.3)' for '.NETStandard,Version=v2.0'.
C:\Workspace\Test\powershell\generated\Xkcd.csproj : error NU1100: Unable to resolve 'PowerShellStandard.Library (>= 5.1.0)' for '.NETStandard,Version=v2.0'.
C:\Workspace\Test\powershell\generated\Xkcd.csproj : error NU1100: Unable to resolve 'Microsoft.CSharp (>= 4.4.1)' for '.NETStandard,Version=v2.0'.

)

dolauli commented 3 years ago

Please run autorest --reset and then re-run the autorest. With the latest version of autorest, autorest/powershell and autorest/core, it works for me.

dolauli@debian9hk:~/src/autorest.powershell/samples/Xkcd$ autorest --powershell --input-file:./xkcd.yaml 
AutoRest code generation utility [cli version: 3.2.0; node: v14.15.5, max-memory: 2048 MB]
(C) 2018 Microsoft Corporation.
https://aka.ms/autorest

There is a new version of AutoRest available (3.2.3).
 > You can install the newer version with with npm install -g autorest@latest

   Loading AutoRest core      '/home/dolauli/.autorest/@autorest_core@3.4.5/node_modules/@autorest/core/dist' (3.4.5)
INFORMATION: 
The default version of @autorest/powershell has been bumped from 2.1+ to 3.0+.
 > If you still want to use 2.1+ version, please specify it with --use:@autorest/powershell@2.1.{x}, e.g 2.1.401.

INFORMATION: > Loading AutoRest extension '@autorest/powershell' (~3.0.0->3.0.433)
INFORMATION: > Loading AutoRest extension '@autorest/modelerfour' (4.15.414->4.15.414)

WARNING (PreCheck/CheckDuplicateSchemas): Checking for duplicate schemas, this could take a (long) while.  Run with --verbose for more detail.
[3.9 s] Generation Complete
dolauli@debian9hk:~/src/autorest.powershell/samples/Xkcd$ ls
generated  xkcd.yaml
dolauli@debian9hk:~/src/autorest.powershell/samples/Xkcd$ cd generated/
dolauli@debian9hk:~/src/autorest.powershell/samples/Xkcd/generated$ pwsh build-module.ps1 
Creating isolated process...
Cleaning build folders...
Compiling module...
Creating cmdlets for specified models...
Creating exports and docs...
Creating format.ps1xml...
Creating psd1...
Creating test stubs...
Creating example stubs...
-------------Done-------------
To run this module in an isolated PowerShell session, run the 'run-module.ps1' script or provide the '-Run' parameter to this script.
dolauli commented 3 years ago

@Clebam

Clebam commented 3 years ago

Hi @dolauli, I reset and updated autorest and pwsh but got the same issue. I'll have to find some time to dig into this issue I guess.

dolauli commented 2 years ago

Closed since no further update from the reporter.