Azure / autorest.powershell

AutoRest PowerShell Generator
MIT License
112 stars 80 forks source link

Error: Plugin llcsharp-v2 reported failure. #856

Closed dicolanl closed 2 years ago

dicolanl commented 2 years ago

running autorest generates error:

root@499058902a09:/src/SecurityInsights# autorest AutoRest code generation utility [cli version: 3.4.2; node: v14.15.5] (C) 2018 Microsoft Corporation. https://aka.ms/autorest info | Loading AutoRest core '/root/.autorest/@autorestcore@3.6.6/nodemodules/@autorest/core/dist' (3.6.6) 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.460) info | Loading AutoRest extension '@autorest/modelerfour' (4.15.414->4.15.414) 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 (components > schemas > AlertRuleTemplate > properties > kind) keys: [ 'type' ]

dolauli commented 2 years ago

@dicolanl Would post your swagger link and readme.md?

dicolanl commented 2 years ago

Hi @dolauli Swaggers are here: https://github.com/Azure/azure-rest-api-specs/tree/Microsoft.SecurityInsights-2021-09-01-preview-rebased/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2021-09-01-preview

README:

Az.SecurityInsights

This directory contains the PowerShell module for the SecurityInsights service.


Status

Az.SecurityInsights

Info


Detail

This module was primarily generated via AutoRest using the PowerShell extension.

Module Requirements

Authentication

AutoRest does not generate authentication code for the module. Authentication is handled via Az.Accounts by altering the HTTP payload before it is sent.

Development

For information on how to develop for Az.SecurityInsights, see how-to.md.


Generation Requirements

Use of the beta version of autorest.powershell generator requires the following:

Run Generation

In this directory, run AutoRest:

autorest


AutoRest Configuration

see https://aka.ms/autorest

require:
  - $(this-folder)/../readme.azure.noprofile.md
# lock the commit
input-file:
  - https://github.com/Azure/azure-rest-api-specs/tree/Microsoft.SecurityInsights-2021-09-01-preview-rebased/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2021-09-01-preview/AlertRules.json
  - https://github.com/Azure/azure-rest-api-specs/tree/Microsoft.SecurityInsights-2021-09-01-preview-rebased/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2021-09-01-preview/AutomationRules.json
  - https://github.com/Azure/azure-rest-api-specs/tree/Microsoft.SecurityInsights-2021-09-01-preview-rebased/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2021-09-01-preview/Bookmarks.json
  - https://github.com/Azure/azure-rest-api-specs/tree/Microsoft.SecurityInsights-2021-09-01-preview-rebased/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2021-09-01-preview/Enrichment.json
  - https://github.com/Azure/azure-rest-api-specs/tree/Microsoft.SecurityInsights-2021-09-01-preview-rebased/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2021-09-01-preview/Entities.json
  - https://github.com/Azure/azure-rest-api-specs/tree/Microsoft.SecurityInsights-2021-09-01-preview-rebased/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2021-09-01-preview/EntityQueries.json
  - https://github.com/Azure/azure-rest-api-specs/tree/Microsoft.SecurityInsights-2021-09-01-preview-rebased/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2021-09-01-preview/EntityQueryTemplates.json
  - https://github.com/Azure/azure-rest-api-specs/tree/Microsoft.SecurityInsights-2021-09-01-preview-rebased/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2021-09-01-preview/Incidents.json
  - https://github.com/Azure/azure-rest-api-specs/tree/Microsoft.SecurityInsights-2021-09-01-preview-rebased/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2021-09-01-preview/Metadata.json
  - https://github.com/Azure/azure-rest-api-specs/tree/Microsoft.SecurityInsights-2021-09-01-preview-rebased/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2021-09-01-preview/OfficeConsents.json
  - https://github.com/Azure/azure-rest-api-specs/tree/Microsoft.SecurityInsights-2021-09-01-preview-rebased/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2021-09-01-preview/OnboardingStates.json
  - https://github.com/Azure/azure-rest-api-specs/tree/Microsoft.SecurityInsights-2021-09-01-preview-rebased/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2021-09-01-preview/Settings.json
  - https://github.com/Azure/azure-rest-api-specs/tree/Microsoft.SecurityInsights-2021-09-01-preview-rebased/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2021-09-01-preview/SourceControls.json
  - https://github.com/Azure/azure-rest-api-specs/tree/Microsoft.SecurityInsights-2021-09-01-preview-rebased/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2021-09-01-preview/ThreatIntelligence.json
  - https://github.com/Azure/azure-rest-api-specs/tree/Microsoft.SecurityInsights-2021-09-01-preview-rebased/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2021-09-01-preview/Watchlists.json
  - https://github.com/Azure/azure-rest-api-specs/tree/Microsoft.SecurityInsights-2021-09-01-preview-rebased/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2021-09-01-preview/dataConnectors.json
  - https://github.com/Azure/azure-rest-api-specs/tree/Microsoft.SecurityInsights-2021-09-01-preview-rebased/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2021-09-01-preview/operations.json

module-version: 1.2.0
title: SecurityInsights
subject-prefix: $(service-name)

inlining-threshold: 50

directive:
  # Remove the unexpanded parameter set
  - where:
      variant: ^Create$|^CreateViaIdentity$|^CreateViaIdentityExpanded$|^Update$|^UpdateViaIdentity$|^UpdateViaIdentityExpanded$
    remove: true
dolauli commented 2 years ago

The root cause of this issue is the same as https://github.com/Azure/autorest.powershell/issues/530. So close it. And the work around is to remove the 'x-ms-enum' in https://github.com/Azure/azure-rest-api-specs/blob/Microsoft.SecurityInsights-2021-09-01-preview-rebased/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2021-09-01-preview/dataConnectors.json#L1997. And by doing that, the property 'status' will be treated as a normal integer. And for how to delete a property from the swagger through directive, you should be able to find some examples in https://raw.githubusercontent.com/Azure/azure-powershell/main/src/Functions/readme.md.