- What's New in the PowerShell generator
- Caveats And known issues
- Upgrading the AutoRest PowerShell Generator
- All runtime code is now generated in the same namespace as the project itself (no more
Carbon.JsonandMicrosoft.Rest.ClientRuntimenamespaces) -- this will make it so you can have multiple generated code sets in the same project if necessary. - runtime code is a marked lot more
internalthan it was;publicis only used where it must. additionalPropertiesin models should generate far better code that it was. (still one outstanding case where it's not good.)- you can use npm to install powershell cross platform:
npm install -g pwsh, then you can just runpwsh!
-
BE KIND! This is a first beta release of a really large amount of code! It was designed to handle APIs crafted for azure services (where we have pretty consistent standards). If it breaks, we'll see what we can do!
-
support for streams may be broken.
-
operations must have unique
operationIdvalues.
they should be in the formNoun_Action(not a powershell noun-verb, but something meaningful)
like
operationId: MyResource_Getor
operationId: SomeAPI_List
if there are tags, we try to guess something useful, but no guarantees. -
If something doesn't work, try to trim down the OpenAPI file to narrow down what it doesn't like, and post an issue back to https://github.com/azure/autorest with a clear example and tag it with the
powershelllabel. -
Http testing/mocking support works, see example however, it has primitive scrubbing, so be careful with storing API keys, etc.
-
Documentation/Deep Knowledge is coming as soon as I can get around to it.
-
Feel Free to poke around, and help out!
If you've been using an earlier build of the PowerShell generator (or the earlier Incubator builds...), you want to make sure you're using nodejs LTS (v14.15.5)
> node -v
v14.15.5After that, you can upgrade pretty easily:
# Install the latest autorest beta
> npm install -g autorest
# remove old autorest extensions
> autorest --reset
# nudge autorest into installing the latest version of the generator
> autorest --powershell --helpWhich should show output like:
AutoRest code generation utility [version: 3.0.5141; node: v10.15.0]
(C) 2018 Microsoft Corporation.
https://aka.ms/autorest
Loading AutoRest core '...\.autorest\@autorest/core@3.0.5336\node_modules\@autorest\core\dist' (3.0.5336)
C:\> autorest --powershell --help AutoRest code generation utility [version: 3.0.5141; node: v10.15.0]
(C) 2018 Microsoft Corporation.
https://aka.ms/autorest
Loading AutoRest core '...\.autorest\@autorest/core@3.0.5336\node_modules\@autorest\core\dist' (3.0.5336)
Installing AutoRest extension '@autorest/powershell' (beta)
Installed AutoRest extension '@autorest/powershell' (beta->1.0.111)
Installing AutoRest extension '@autorest/remodeler' (beta)
Installed AutoRest extension '@autorest/remodeler' (beta->1.0.95)
Installing AutoRest extension '@autorest/csharp-v2' (beta)
Installed AutoRest extension '@autorest/csharp-v2' (beta->1.0.97)
... etc
``` powershell
# verify the version you have
> autorest --info
Which should show output like:
AutoRest code generation utility [version: 3.0.5141; node: v10.15.0]
(C) 2018 Microsoft Corporation.
https://aka.ms/autorest
Showing All Installed Extensions
Type Extension Name Version Location
core @autorst/core 3.0.5336 C:\Users\garretts\.autorest\@autorest/core@3.0.5336
extension @autorest/csharp-v2 1.0.97 C:\Users\garretts\.autorest\@autorest\csharp-v2@1.0.97
extension @autorest/powershell 1.0.111 C:\Users\garretts\.autorest\@autorest\powershell@1.0.111
extension @autorest/remodeler 1.0.95 C:\Users\garretts\.autorest\@autorest\remodeler@1.0.95