swagger 为什么插件llcsharp-v2报告失败

1cosmwyk  于 12个月前  发布在  其他
关注(0)|答案(1)|浏览(77)

我在BSVN/IpTables.Api#22中有项目
我想用autorest为我的BSN.IpTables.Api生成Cli
我在命令之下运行

autorest configuration.yaml

我的configuration就像下面

branch: master

module-version: 1.2.0
title: BSN.IpTables.Cli
subject-prefix: $(service-name)

inlining-threshold: 100

tag: v1
input-file: ../BSN.IpTables.Api/swagger.json
powershell: true
namespace: BSN.IpTables.V1
verbose: true
resourcegroup-append: true
identity-correction-for-post: true
nested-object-to-string: true

我看到下面的错误

   BSN.IpTables.Cli   Feature/22-add-cli≡  .\Generate-PowerShellClient.ps1                                     

changed 1 package in 1s
AutoRest code generation utility [cli version: 3.6.3; node: v18.15.0]
(C) 2018 Microsoft Corporation.
https://aka.ms/autorest
info    |    Loading AutoRest core      'C:\Users\sooro\.autorest\@[email protected]\nodemodules\@autorest\core\dist' (3.9.7)
verbose | [0.41 s] No configuration found at 'file:///D:/Source/Repos/Resa/IpTables.Api/Source/BSN.IpTables.Cli/'.
verbose | [0.42 s]    Including configuration file 'file:///C:/Users/sooro/.autorest/@[email protected]/nodemodules/@autorest/core/dist/resources/default-configuration.md'
verbose | [0.43 s]    Including configuration file 'file:///C:/Users/sooro/.autorest/@[email protected]/nodemodules/@autorest/core/dist/resources/inspect.md'
verbose | [0.43 s]    Including configuration file 'file:///C:/Users/sooro/.autorest/@autorestcor[email protected]/nodemodules/@autorest/core/dist/resources/directives.md'
verbose | [0.44 s]    Including configuration file 'file:///C:/Users/sooro/.autorest/@[email protected]/nodemodules/@autorest/core/dist/resources/pipeline.md'
verbose | [0.44 s]    Including configuration file 'file:///C:/Users/sooro/.autorest/@[email protected]/nodemodules/@autorest/core/dist/resources/loader-openapi.md'
verbose | [0.45 s]    Including configuration file 'file:///C:/Users/sooro/.autorest/@[email protected]/nodemodules/@autorest/core/dist/resources/miscellaneous.md'
verbose | [0.45 s]    Including configuration file 'file:///C:/Users/sooro/.autorest/@[email protected]/nodemodules/@autorest/core/dist/resources/plugin-powershell.md'
verbose | [0.46 s]    Including configuration file 'file:///C:/Users/sooro/.autorest/@[email protected]/nodemodules/@autorest/core/dist/resources/plugin-azureresourceschema.md'
verbose | [0.47 s]    Including configuration file 'file:///C:/Users/sooro/.autorest/@[email protected]/nodemodules/@autorest/core/dist/resources/plugin-csharp.md'
verbose | [0.47 s]    Including configuration file 'file:///C:/Users/sooro/.autorest/@[email protected]/nodemodules/@autorest/core/dist/resources/plugin-go.md'
verbose | [0.48 s]    Including configuration file 'file:///C:/Users/sooro/.autorest/@[email protected]/nodemodules/@autorest/core/dist/resources/plugin-java.md'
verbose | [0.49 s]    Including configuration file 'file:///C:/Users/sooro/.autorest/@[email protected]/nodemodules/@autorest/core/dist/resources/plugin-nodejs.md'
verbose | [0.50 s]    Including configuration file 'file:///C:/Users/sooro/.autorest/@[email protected]/nodemodules/@autorest/core/dist/resources/plugin-php.md'
verbose | [0.50 s]    Including configuration file 'file:///C:/Users/sooro/.autorest/@[email protected]/nodemodules/@autorest/core/dist/resources/plugin-python.md'
verbose | [0.51 s]    Including configuration file 'file:///C:/Users/sooro/.autorest/@[email protected]/nodemodules/@autorest/core/dist/resources/plugin-ruby.md'
verbose | [0.51 s]    Including configuration file 'file:///C:/Users/sooro/.autorest/@[email protected]/nodemodules/@autorest/core/dist/resources/plugin-typescript.md'
verbose | [0.52 s]    Including configuration file 'file:///C:/Users/sooro/.autorest/@[email protected]/nodemodules/@autorest/core/dist/resources/plugin-validators.md'
verbose | [0.53 s]    Including configuration file 'file:///C:/Users/sooro/.autorest/@[email protected]/nodemodules/@autorest/core/dist/resources/plugin-az.md'
verbose | [0.53 s]    Including configuration file 'file:///C:/Users/sooro/.autorest/@[email protected]/nodemodules/@autorest/core/dist/resources/plugin-terraform.md'
verbose | [0.54 s]    Including configuration file 'file:///C:/Users/sooro/.autorest/@[email protected]/nodemodules/@autorest/core/dist/resources/plugin-azure-functions.md'
verbose | [0.55 s]    Including configuration file 'file:///C:/Users/sooro/.autorest/@[email protected]/nodemodules/@autorest/core/dist/resources/plugin-openapi-to-cadl.md'
verbose | [0.56 s]    Including configuration file 'file:///C:/Users/sooro/.autorest/@[email protected]/nodemodules/@autorest/core/dist/resources/graphs.md'
verbose | [0.57 s]    Including configuration file 'file:///C:/Users/sooro/.autorest/@[email protected]/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/[email protected].{x}, e.g 2.1.401.

info    |    Loading AutoRest extension '@autorest/powershell' (~3.0.0->3.0.505)
verbose | [0.60 s]    Including extension configuration file 'file:///C:/Users/sooro/.autorest/@[email protected]/nodemodules/@autorest/powershell/readme.md'
verbose | [0.60 s]    Including configuration file 'file:///C:/Users/sooro/.autorest/@[email protected]/nodemodules/@autorest/powershell/readme.md'
verbose | [0.61 s]    Including configuration file 'file:///C:/Users/sooro/.autorest/@[email protected]/nodemodules/@autorest/powershell/autorest-configuration.md'
info    |    Loading AutoRest extension '@autorest/modelerfour' (4.15.414->4.15.414)
verbose | [0.66 s]    Including extension configuration file 'file:///C:/Users/sooro/.autorest/@[email protected]/nodemodules/@autorest/modelerfour/readme.md'
verbose | [0.66 s]    Including configuration file 'file:///C:/Users/sooro/.autorest/@[email protected]/nodemodules/@autorest/modelerfour/readme.md'
verbose | [1.16 s] Reading OpenAPI 3.0 file file:///D:/Source/Repos/Resa/IpTables.Api/Source/BSN.IpTables.Api/swagger.json
warning | PreCheck/AllOfWhenYouMeantRef | Schema 'IpTablesChainSetViewModelResponse-statusCode' is using an 'allOf' instead of a $ref. This creates a wasteful anonymous type when generating code.
warning | PreCheck/AllOfWhenYouMeantRef | Schema 'IpTablesChainSetViewModelResponse-data' is using an 'allOf' instead of a $ref. This creates a wasteful anonymous type when generating code.
warning | PreCheck/AllOfWhenYouMeantRef | Schema 'IpTablesChainViewModel-ipVersion' is using an 'allOf' instead of a $ref. This creates a wasteful anonymous type when generating code.
warning | PreCheck/AllOfWhenYouMeantRef | Schema 'Response-statusCode' is using an 'allOf' instead of a $ref. This creates a wasteful anonymous type when generating code.
warning | PreCheck/AllOfWhenYouMeantRef | Schema 'paths·1h07bfn·api-v1-home-insert·put·parameters·0·schema' is using an 'allOf' instead of a $ref. This creates a wasteful anonymous type when generating code.
warning | PreCheck/AllOfWhenYouMeantRef | Schema 'paths·bha41k·api-v1-rules-insert·put·parameters·0·schema' is using an 'allOf' instead of a $ref. This creates a wasteful anonymous type when generating code.
warning | PreCheck/AllOfWhenYouMeantRef | Schema 'paths·1yxlpcs·api-v1-insert·put·parameters·0·schema' is using an 'allOf' instead of a $ref. This creates a wasteful anonymous type when generating code.
warning | PreCheck/SchemaMissingType | The schema 'IpTablesChainSetViewModelResponse-statusCode' with an undefined type and 'allOf'/'anyOf'/'oneOf' is a bit ambigious. This has been auto-corrected to 'type:object'
warning | PreCheck/SchemaMissingType | The schema 'IpTablesChainSetViewModelResponse-data' with an undefined type and 'allOf'/'anyOf'/'oneOf' is a bit ambigious. This has been auto-corrected to 'type:object'
warning | PreCheck/SchemaMissingType | The schema 'IpTablesChainViewModel-ipVersion' with an undefined type and 'allOf'/'anyOf'/'oneOf' is a bit ambigious. This has been auto-corrected to 'type:object'
warning | PreCheck/SchemaMissingType | The schema 'Response-statusCode' with an undefined type and 'allOf'/'anyOf'/'oneOf' is a bit ambigious. This has been auto-corrected to 'type:object'
warning | PreCheck/SchemaMissingType | The schema 'paths·1h07bfn·api-v1-home-insert·put·parameters·0·schema' with an undefined type and 'allOf'/'anyOf'/'oneOf' is a bit ambigious. This has been auto-corrected to 'type:object'
warning | PreCheck/SchemaMissingType | The schema 'paths·bha41k·api-v1-rules-insert·put·parameters·0·schema' with an undefined type and 'allOf'/'anyOf'/'oneOf' is a bit ambigious. This has been auto-corrected to 'type:object'
warning | PreCheck/SchemaMissingType | The schema 'paths·1yxlpcs·api-v1-insert·put·parameters·0·schema' with an undefined type and 'allOf'/'anyOf'/'oneOf' is a bit ambigious. This has been auto-corrected to 'type:object'
warning | PreCheck/CheckDuplicateSchemas | Checking for duplicate schemas, this could take a (long) while.  Run with --verbose for more detail.
verbose | [1.37 s]   ModelerFour/api-version-mode:client
verbose | [1.37 s]   ModelerFour/api-version-parameter:constant
verbose | [1.37 s]   ModelerFour/use-model-namespace:false
warning | Interpretations | Generating 'operationId' for 'get' operation on path '/api/v1/Home/List'
warning | Interpretations | Generating 'operationId' for 'get' operation on path '/api/v1/rules/List'
warning | Interpretations | Generating 'operationId' for 'get' operation on path '/api/v1/List'
warning | Interpretations | Generating 'operationId' for 'put' operation on path '/api/v1/Home/Insert'
warning | Interpretations | Generating 'operationId' for 'put' operation on path '/api/v1/rules/Insert'
warning | Interpretations | Generating 'operationId' for 'put' operation on path '/api/v1/Insert'
warning | Interpretations | Generating 'operationId' for 'post' operation on path '/api/v1/Home/Append'
warning | Interpretations | Generating 'operationId' for 'post' operation on path '/api/v1/rules/Append'
warning | Interpretations | Generating 'operationId' for 'post' operation on path '/api/v1/Append'
warning | Interpretations | Generating 'operationId' for 'delete' operation on path '/api/v1/Home/Delete'
warning | Interpretations | Generating 'operationId' for 'delete' operation on path '/api/v1/rules/Delete'
warning | Interpretations | Generating 'operationId' for 'delete' operation on path '/api/v1/Delete'
warning | Interpretations | Generating 'operationId' for 'delete' operation on path '/api/v1/Home'
warning | Interpretations | Generating 'operationId' for 'delete' operation on path '/api/v1/rules'
warning | Interpretations | Generating 'operationId' for 'delete' operation on path '/api/v1'
C:\Users\sooro\.autorest\@[email protected]\node_modules\@autorest\powershell\dist\plugins\llcsharp-v2.js - TypeError: Cannot read properties of undefined (reading 'fullName')
    at ModelClass.handleAllOf (C:\Users\sooro\.autorest\@[email protected]\node_modules\@autorest\powershell\llcsharp\model\model-class.ts:413:37)
    at new ModelClass (C:\Users\sooro\.autorest\@[email protected]\node_modules\@autorest\powershell\llcsharp\model\model-class.ts:142:15)
    at ModelsNamespace.NewResolveTypeDeclaration (C:\Users\sooro\.autorest\@[email protected]\node_modules\@autorest\powershell\llcsharp\model\namespace.ts:104:67)
    at new ModelsNamespace (C:\Users\sooro\.autorest\@[email protected]\node_modules\@autorest\powershell\llcsharp\model\namespace.ts:53:14)
    at Project.init (C:\Users\sooro\.autorest\@[email protected]\node_modules\@autorest\powershell\llcsharp\project.ts:85:28)
    at llcsharpV2 (C:\Users\sooro\.autorest\@[email protected]\node_modules\@autorest\powershell\plugins\llcsharp-v2.ts:18:21)
    at C:\Users\sooro\.autorest\@[email protected]\node_modules\@azure-tools\autorest-extension-base\extension-base.ts:68:9/Cannot read properties of undefined (reading 'fullName')
fatal   | TypeError: Cannot read properties of undefined (reading 'fullName')
fatal   | Process() cancelled due to failure
error   |   Error: Plugin llcsharp-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.

但是我希望为我的项目创建PowerShell模块,我的问题是我的问题是什么?为什么autorest不能生成我的PowerShell模块?

6gpjuf90

6gpjuf901#

你的问题是因为在swagger描述中使用了allOf
正如你在Combination of allOf and discriminator gives false warnings中看到的,你必须在你的swagger描述中删除allOf
为此,您必须删除或注解options.UseAllOfToExtendReferenceSchemas();

相关问题