Azure / autorest.powershell

AutoRest PowerShell Generator
MIT License
110 stars 76 forks source link

Struggling to get started creating a PowerShell module (stuck on 'SCHEMA MISSING?') #1262

Open robinmalik opened 8 months ago

robinmalik commented 8 months ago

Hi,

I'm a newbie to autorest, and was hoping to give it a whirl against the Ansible Semophore API document | GitHub Project.

I've been using the following command: autorest --powershell --input-file:.\api-docs.yaml --verbose --output-folder:c:\autorest

I hit a few errors which I resolved by adding tag attributes to various paths, removed two references to format: asc/desc and also removed the null references on a few type elements.

      object_id:
        type:
          - integer
          - "null"

I've put the modified version into a gist here

I'm aware that stripping bits out may make things not exactly right but the output doesn't have to be perfect, I just wanted to get something I could look over if possible.

Unfortunately I've hit a wall and am getting the following:

fatal   | Error: SCHEMA MISSING?
fatal   | Process() cancelled due to failure
error   |   Error: Plugin powershell-v2 reported failure.
error   | Autorest completed with an error. If you think the error message is unclear, or is a bug, please declare an issues at https://github.com/Azure/autorest/issues with the error message you are seeing.

Complete output is here:

Details

AutoRest code generation utility [cli version: 3.6.3; node: v20.7.0] (C) 2018 Microsoft Corporation. https://aka.ms/autorest info | Loading AutoRest core 'C:\Users\Robin\.autorest\@autorestcore@3.9.7\nodemodules\@autorest\core\dist' (3.9.7) verbose | [0.54 s] No configuration found at 'file:///C:/autorest/'. verbose | [0.54 s] Including configuration file 'file:///C:/Users/Robin/.autorest/@autorestcore@3.9.7/nodemodules/@autorest/core/dist/resources/default-configuration.md' verbose | [0.56 s] Including configuration file 'file:///C:/Users/Robin/.autorest/@autorestcore@3.9.7/nodemodules/@autorest/core/dist/resources/inspect.md' verbose | [0.56 s] Including configuration file 'file:///C:/Users/Robin/.autorest/@autorestcore@3.9.7/nodemodules/@autorest/core/dist/resources/directives.md' verbose | [0.57 s] Including configuration file 'file:///C:/Users/Robin/.autorest/@autorestcore@3.9.7/nodemodules/@autorest/core/dist/resources/pipeline.md' verbose | [0.57 s] Including configuration file 'file:///C:/Users/Robin/.autorest/@autorestcore@3.9.7/nodemodules/@autorest/core/dist/resources/loader-openapi.md' verbose | [0.58 s] Including configuration file 'file:///C:/Users/Robin/.autorest/@autorestcore@3.9.7/nodemodules/@autorest/core/dist/resources/miscellaneous.md' verbose | [0.59 s] Including configuration file 'file:///C:/Users/Robin/.autorest/@autorestcore@3.9.7/nodemodules/@autorest/core/dist/resources/plugin-powershell.md' verbose | [0.59 s] Including configuration file 'file:///C:/Users/Robin/.autorest/@autorestcore@3.9.7/nodemodules/@autorest/core/dist/resources/plugin-azureresourceschema.md' verbose | [0.60 s] Including configuration file 'file:///C:/Users/Robin/.autorest/@autorestcore@3.9.7/nodemodules/@autorest/core/dist/resources/plugin-csharp.md' verbose | [0.61 s] Including configuration file 'file:///C:/Users/Robin/.autorest/@autorestcore@3.9.7/nodemodules/@autorest/core/dist/resources/plugin-go.md' verbose | [0.61 s] Including configuration file 'file:///C:/Users/Robin/.autorest/@autorestcore@3.9.7/nodemodules/@autorest/core/dist/resources/plugin-java.md' verbose | [0.62 s] Including configuration file 'file:///C:/Users/Robin/.autorest/@autorestcore@3.9.7/nodemodules/@autorest/core/dist/resources/plugin-nodejs.md' verbose | [0.63 s] Including configuration file 'file:///C:/Users/Robin/.autorest/@autorestcore@3.9.7/nodemodules/@autorest/core/dist/resources/plugin-php.md' verbose | [0.64 s] Including configuration file 'file:///C:/Users/Robin/.autorest/@autorestcore@3.9.7/nodemodules/@autorest/core/dist/resources/plugin-python.md' verbose | [0.64 s] Including configuration file 'file:///C:/Users/Robin/.autorest/@autorestcore@3.9.7/nodemodules/@autorest/core/dist/resources/plugin-ruby.md' verbose | [0.65 s] Including configuration file 'file:///C:/Users/Robin/.autorest/@autorestcore@3.9.7/nodemodules/@autorest/core/dist/resources/plugin-typescript.md' verbose | [0.66 s] Including configuration file 'file:///C:/Users/Robin/.autorest/@autorestcore@3.9.7/nodemodules/@autorest/core/dist/resources/plugin-validators.md' verbose | [0.67 s] Including configuration file 'file:///C:/Users/Robin/.autorest/@autorestcore@3.9.7/nodemodules/@autorest/core/dist/resources/plugin-az.md' verbose | [0.67 s] Including configuration file 'file:///C:/Users/Robin/.autorest/@autorestcore@3.9.7/nodemodules/@autorest/core/dist/resources/plugin-terraform.md' verbose | [0.68 s] Including configuration file 'file:///C:/Users/Robin/.autorest/@autorestcore@3.9.7/nodemodules/@autorest/core/dist/resources/plugin-azure-functions.md' verbose | [0.69 s] Including configuration file 'file:///C:/Users/Robin/.autorest/@autorestcore@3.9.7/nodemodules/@autorest/core/dist/resources/plugin-openapi-to-cadl.md' verbose | [0.70 s] Including configuration file 'file:///C:/Users/Robin/.autorest/@autorestcore@3.9.7/nodemodules/@autorest/core/dist/resources/graphs.md' verbose | [0.71 s] Including configuration file 'file:///C:/Users/Robin/.autorest/@autorestcore@3.9.7/nodemodules/@autorest/core/dist/resources/help-configuration.md' info | 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. info | Loading AutoRest extension '@autorest/powershell' (~3.0.0->3.0.510) verbose | [0.75 s] Including extension configuration file 'file:///C:/Users/Robin/.autorest/@autorestpowershell@3.0.510/nodemodules/@autorest/powershell/readme.md' verbose | [0.75 s] Including configuration file 'file:///C:/Users/Robin/.autorest/@autorestpowershell@3.0.510/nodemodules/@autorest/powershell/readme.md' verbose | [0.76 s] Including configuration file 'file:///C:/Users/Robin/.autorest/@autorestpowershell@3.0.510/nodemodules/@autorest/powershell/autorest-configuration.md' info | Loading AutoRest extension '@autorest/modelerfour' (4.15.414->4.15.414) verbose | [0.82 s] Including extension configuration file 'file:///C:/Users/Robin/.autorest/@autorestmodelerfour@4.15.414/nodemodules/@autorest/modelerfour/readme.md' verbose | [0.82 s] Including configuration file 'file:///C:/Users/Robin/.autorest/@autorestmodelerfour@4.15.414/nodemodules/@autorest/modelerfour/readme.md' verbose | [1.34 s] Reading OpenAPI 2.0 file file:///C:/autorest/apidocs.yaml warning | IgnoredPropertyNextToRef | Semantic violation: Sibling values alongside $ref will be ignored. See https://github.com/Azure/autorest/blob/main/docs/openapi/howto/$ref-siblings.md for allowed values (paths > /project/{project_id}/templates > get > responses > 200 > content > application/json > schema > items) keys: [ 'properties' ] - file:///C:/autorest/apidocs.yaml:1442:13 warning | IgnoredPropertyNextToRef | Semantic violation: Sibling values alongside $ref will be ignored. See https://github.com/Azure/autorest/blob/main/docs/openapi/howto/$ref-siblings.md for allowed values (paths > /project/{project_id}/templates > get > responses > 200 > content > text/plain; charset=utf-8 > schema > items) keys: [ 'properties' ] - file:///C:/autorest/apidocs.yaml:1442:13 warning | PreCheck/CheckDuplicateSchemas | Checking for duplicate schemas, this could take a (long) while. Run with --verbose for more detail. verbose | [1.76 s] ModelerFour/api-version-mode:client verbose | [1.76 s] ModelerFour/api-version-parameter:constant verbose | [1.76 s] ModelerFour/use-model-namespace:false warning | Interpretations | Generating 'operationId' for 'get' operation on path '/ping' warning | Interpretations | Generating 'operationId' for 'get' operation on path '/ws' warning | Interpretations | Generating 'operationId' for 'get' operation on path '/info' warning | Interpretations | Generating 'operationId' for 'get' operation on path '/auth/login' warning | Interpretations | Generating 'operationId' for 'post' operation on path '/auth/login' warning | Interpretations | Generating 'operationId' for 'post' operation on path '/auth/logout' warning | Interpretations | Generating 'operationId' for 'get' operation on path '/auth/oidc/{provider_id}/login' warning | Interpretations | Generating 'operationId' for 'get' operation on path '/auth/oidc/{provider_id}/redirect' warning | Interpretations | Generating 'operationId' for 'get' operation on path '/user/' warning | Interpretations | Generating 'operationId' for 'get' operation on path '/user/tokens' warning | Interpretations | Generating 'operationId' for 'post' operation on path '/user/tokens' warning | Interpretations | Generating 'operationId' for 'delete' operation on path '/user/tokens/{apitokenid}' warning | Interpretations | Generating 'operationId' for 'get' operation on path '/users' warning | Interpretations | Generating 'operationId' for 'post' operation on path '/users' warning | Interpretations | Generating 'operationId' for 'get' operation on path '/users/{user_id}/' warning | Interpretations | Generating 'operationId' for 'put' operation on path '/users/{user_id}/' warning | Interpretations | Generating 'operationId' for 'delete' operation on path '/users/{user_id}/' warning | Interpretations | Generating 'operationId' for 'post' operation on path '/users/{user_id}/password' warning | Interpretations | Generating 'operationId' for 'get' operation on path '/projects' warning | Interpretations | Generating 'operationId' for 'post' operation on path '/projects' warning | Interpretations | Generating 'operationId' for 'get' operation on path '/events' warning | Interpretations | Generating 'operationId' for 'get' operation on path '/events/last' warning | Interpretations | Generating 'operationId' for 'get' operation on path '/project/{project_id}/' warning | Interpretations | Generating 'operationId' for 'put' operation on path '/project/{project_id}/' warning | Interpretations | Generating 'operationId' for 'delete' operation on path '/project/{project_id}/' warning | Interpretations | Generating 'operationId' for 'get' operation on path '/project/{project_id}/role' warning | Interpretations | Generating 'operationId' for 'get' operation on path '/project/{project_id}/events' warning | Interpretations | Generating 'operationId' for 'get' operation on path '/project/{project_id}/users' warning | Interpretations | Generating 'operationId' for 'post' operation on path '/project/{project_id}/users' warning | Interpretations | Generating 'operationId' for 'delete' operation on path '/project/{projectid}/users/{userid}' warning | Interpretations | Generating 'operationId' for 'put' operation on path '/project/{projectid}/users/{userid}' warning | Interpretations | Generating 'operationId' for 'get' operation on path '/project/{project_id}/keys' warning | Interpretations | Generating 'operationId' for 'post' operation on path '/project/{project_id}/keys' warning | Interpretations | Generating 'operationId' for 'put' operation on path '/project/{projectid}/keys/{keyid}' warning | Interpretations | Generating 'operationId' for 'delete' operation on path '/project/{projectid}/keys/{keyid}' warning | Interpretations | Generating 'operationId' for 'get' operation on path '/project/{project_id}/repositories' warning | Interpretations | Generating 'operationId' for 'post' operation on path '/project/{project_id}/repositories' warning | Interpretations | Generating 'operationId' for 'put' operation on path '/project/{projectid}/repositories/{repositoryid}' warning | Interpretations | Generating 'operationId' for 'delete' operation on path '/project/{projectid}/repositories/{repositoryid}' warning | Interpretations | Generating 'operationId' for 'get' operation on path '/project/{project_id}/inventory' warning | Interpretations | Generating 'operationId' for 'post' operation on path '/project/{project_id}/inventory' warning | Interpretations | Generating 'operationId' for 'put' operation on path '/project/{projectid}/inventory/{inventoryid}' warning | Interpretations | Generating 'operationId' for 'delete' operation on path '/project/{projectid}/inventory/{inventoryid}' warning | Interpretations | Generating 'operationId' for 'get' operation on path '/project/{project_id}/environment' warning | Interpretations | Generating 'operationId' for 'post' operation on path '/project/{project_id}/environment' warning | Interpretations | Generating 'operationId' for 'put' operation on path '/project/{projectid}/environment/{environmentid}' warning | Interpretations | Generating 'operationId' for 'delete' operation on path '/project/{projectid}/environment/{environmentid}' warning | Interpretations | Generating 'operationId' for 'get' operation on path '/project/{project_id}/templates' warning | Interpretations | Generating 'operationId' for 'post' operation on path '/project/{project_id}/templates' warning | Interpretations | Generating 'operationId' for 'get' operation on path '/project/{projectid}/templates/{templateid}' warning | Interpretations | Generating 'operationId' for 'put' operation on path '/project/{projectid}/templates/{templateid}' warning | Interpretations | Generating 'operationId' for 'delete' operation on path '/project/{projectid}/templates/{templateid}' warning | Interpretations | Generating 'operationId' for 'get' operation on path '/project/{projectid}/schedules/{scheduleid}' warning | Interpretations | Generating 'operationId' for 'delete' operation on path '/project/{projectid}/schedules/{scheduleid}' warning | Interpretations | Generating 'operationId' for 'put' operation on path '/project/{projectid}/schedules/{scheduleid}' warning | Interpretations | Generating 'operationId' for 'post' operation on path '/project/{project_id}/schedules' warning | Interpretations | Generating 'operationId' for 'get' operation on path '/project/{project_id}/views' warning | Interpretations | Generating 'operationId' for 'post' operation on path '/project/{project_id}/views' warning | Interpretations | Generating 'operationId' for 'get' operation on path '/project/{projectid}/views/{viewid}' warning | Interpretations | Generating 'operationId' for 'put' operation on path '/project/{projectid}/views/{viewid}' warning | Interpretations | Generating 'operationId' for 'delete' operation on path '/project/{projectid}/views/{viewid}' warning | Interpretations | Generating 'operationId' for 'get' operation on path '/project/{project_id}/tasks' warning | Interpretations | Generating 'operationId' for 'post' operation on path '/project/{project_id}/tasks' warning | Interpretations | Generating 'operationId' for 'get' operation on path '/project/{project_id}/tasks/last' warning | Interpretations | Generating 'operationId' for 'post' operation on path '/project/{projectid}/tasks/{taskid}/stop' warning | Interpretations | Generating 'operationId' for 'get' operation on path '/project/{projectid}/tasks/{taskid}' warning | Interpretations | Generating 'operationId' for 'delete' operation on path '/project/{projectid}/tasks/{taskid}' warning | Interpretations | Generating 'operationId' for 'get' operation on path '/project/{projectid}/tasks/{taskid}/output' fatal | Error: SCHEMA MISSING? fatal | Process() cancelled due to failure error | Error: Plugin powershell-v2 reported failure. error | Autorest completed with an error. If you think the error message is unclear, or is a bug, please declare an issues at https://github.com/Azure/autorest/issues with the error message you are seeing.

Is anyone able to shed any light on this? I've searched the issues and google but couldn't find anything. Thanks in advance 🙂

Edit: I've just noticed that if I run this once, I get a generated folder but it's empty. If I run it twice, it creates two subfolders: api with a single Semophore.cs file and a runtime folder with a CmdInfoHandler.cs. Infact even a third and fourth time produces more .cs files on each run, but always with Error: SCHEMA MISSING?. I had, perhaps naively, assumed this would produce a script based PowerShell module but I suspect I'm now wrong and it produces a C# project instead that you have to build/compile?