NSWAG 在为 EOSIO Chain API 制作 C# 客户端时无法解析 Visual Studio 中的路径

问题描述

我正在尝试构建一个应用程序以从 EOSIO 区块链获取数据。其 API 记录在此处:https://developers.eos.io/manuals/eos/latest/nodeos/plugins/chain_api_plugin/api-reference/index

文档包含可下载的 API JSON OpenAPI 规范。

我尝试将该规范作为服务引用添加到 Visual Studio 2019(版本 16.8.1)中。这会自动安装 NSwag.ApiDescription.Client 13.0.5 及其依赖项。

在构建时出现以下错误

1>system.invalidOperationException: Could not resolve the path '#/paths/~1get_abi/post/requestBody/content/application~1json/schema/properties/account_name'.
1>   at njsonSchema.JsonReferenceResolver.ResolveDocumentReference(Object rootObject,String jsonPath)
1>   at njsonSchema.JsonReferenceResolver.<ResolveReferenceAsync>d__10.MoveNext()
1>--- End of stack trace from prevIoUs location where exception was thrown ---
1>   at System.Runtime.ExceptionServices.ExceptiondispatchInfo.Throw()
1>   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
1>   at njsonSchema.JsonReferenceResolver.<ResolveReferenceAsync>d__5.MoveNext()
1>--- End of stack trace from prevIoUs location where exception was thrown ---
1>   at System.Runtime.ExceptionServices.ExceptiondispatchInfo.Throw()
1>   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
1>   at njsonSchema.JsonSchemaReferenceUtilities.JsonReferenceUpdater.<VisitJsonReferenceAsync>d__5.MoveNext()
1>--- End of stack trace from prevIoUs location where exception was thrown ---
1>   at System.Runtime.ExceptionServices.ExceptiondispatchInfo.Throw()
1>   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
1>   at njsonSchema.Visitors.AsyncJsonReferenceVisitorBase.<VisitAsync>d__5.MoveNext()
1>--- End of stack trace from prevIoUs location where exception was thrown ---
1>   at System.Runtime.ExceptionServices.ExceptiondispatchInfo.Throw()
1>   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
1>   at njsonSchema.Visitors.AsyncJsonReferenceVisitorBase.<VisitAsync>d__5.MoveNext()
1>--- End of stack trace from prevIoUs location where exception was thrown ---
1>   at System.Runtime.ExceptionServices.ExceptiondispatchInfo.Throw()
1>   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
1>   at njsonSchema.Visitors.AsyncJsonReferenceVisitorBase.<VisitAsync>d__5.MoveNext()
1>--- End of stack trace from prevIoUs location where exception was thrown ---
1>   at System.Runtime.ExceptionServices.ExceptiondispatchInfo.Throw()
1>   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
1>   at njsonSchema.Visitors.AsyncJsonReferenceVisitorBase.<VisitAsync>d__5.MoveNext()
1>--- End of stack trace from prevIoUs location where exception was thrown ---
1>   at System.Runtime.ExceptionServices.ExceptiondispatchInfo.Throw()
1>   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
1>   at njsonSchema.Visitors.AsyncJsonReferenceVisitorBase.<VisitAsync>d__5.MoveNext()
1>--- End of stack trace from prevIoUs location where exception was thrown ---
1>   at System.Runtime.ExceptionServices.ExceptiondispatchInfo.Throw()
1>   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
1>   at njsonSchema.Visitors.AsyncJsonReferenceVisitorBase.<VisitAsync>d__5.MoveNext()
1>--- End of stack trace from prevIoUs location where exception was thrown ---
1>   at System.Runtime.ExceptionServices.ExceptiondispatchInfo.Throw()
1>   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
1>   at njsonSchema.Visitors.AsyncJsonReferenceVisitorBase.<VisitAsync>d__5.MoveNext()
1>--- End of stack trace from prevIoUs location where exception was thrown ---
1>   at System.Runtime.ExceptionServices.ExceptiondispatchInfo.Throw()
1>   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
1>   at njsonSchema.Visitors.AsyncJsonReferenceVisitorBase.<VisitAsync>d__5.MoveNext()
1>--- End of stack trace from prevIoUs location where exception was thrown ---
1>   at System.Runtime.ExceptionServices.ExceptiondispatchInfo.Throw()
1>   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
1>   at njsonSchema.Visitors.AsyncJsonReferenceVisitorBase.<VisitAsync>d__3.MoveNext()
1>--- End of stack trace from prevIoUs location where exception was thrown ---
1>   at System.Runtime.ExceptionServices.ExceptiondispatchInfo.Throw()
1>   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
1>   at njsonSchema.JsonSchemaReferenceUtilities.JsonReferenceUpdater.<VisitAsync>d__4.MoveNext()
1>--- End of stack trace from prevIoUs location where exception was thrown ---
1>   at System.Runtime.ExceptionServices.ExceptiondispatchInfo.Throw()
1>   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
1>   at njsonSchema.JsonSchemaReferenceUtilities.<UpdateSchemaReferencesAsync>d__1.MoveNext()
1>--- End of stack trace from prevIoUs location where exception was thrown ---
1>   at System.Runtime.ExceptionServices.ExceptiondispatchInfo.Throw()
1>   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
1>   at njsonSchema.Infrastructure.JsonSchemaSerialization.<FromJsonAsync>d__13`1.MoveNext()
1>--- End of stack trace from prevIoUs location where exception was thrown ---
1>   at System.Runtime.ExceptionServices.ExceptiondispatchInfo.Throw()
1>   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
1>   at NSwag.OpenApiDocument.<FromJsonAsync>d__57.MoveNext()
1>--- End of stack trace from prevIoUs location where exception was thrown ---
1>   at System.Runtime.ExceptionServices.ExceptiondispatchInfo.Throw()
1>   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
1>   at NSwag.OpenApiDocument.<FromFileAsync>d__58.MoveNext()
1>--- End of stack trace from prevIoUs location where exception was thrown ---
1>   at System.Runtime.ExceptionServices.ExceptiondispatchInfo.Throw()
1>   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
1>   at NSwag.Commands.OutputCommandBase.<ReadSwaggerDocumentAsync>d__5.MoveNext()
1>--- End of stack trace from prevIoUs location where exception was thrown ---
1>   at System.Runtime.ExceptionServices.ExceptiondispatchInfo.Throw()
1>   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
1>   at NSwag.Commands.InputOutputCommandBase.<GetInputSwaggerDocument>d__12.MoveNext()
1>--- End of stack trace from prevIoUs location where exception was thrown ---
1>   at System.Runtime.ExceptionServices.ExceptiondispatchInfo.Throw()
1>   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
1>   at NSwag.Commands.CodeGeneration.SwaggerToCSharpClientCommand.<<RunAsync>b__83_0>d.MoveNext()
1>--- End of stack trace from prevIoUs location where exception was thrown ---
1>   at System.Runtime.ExceptionServices.ExceptiondispatchInfo.Throw()
1>   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
1>   at NSwag.Commands.CodeGeneration.SwaggerToCSharpClientCommand.<RunAsync>d__83.MoveNext()
1>--- End of stack trace from prevIoUs location where exception was thrown ---
1>   at System.Runtime.ExceptionServices.ExceptiondispatchInfo.Throw()
1>   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
1>   at NSwag.Commands.CodeGeneration.SwaggerToCSharpClientCommand.<RunAsync>d__82.MoveNext()
1>--- End of stack trace from prevIoUs location where exception was thrown ---
1>   at System.Runtime.ExceptionServices.ExceptiondispatchInfo.Throw()
1>   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
1>   at NConsole.CommandLineProcessor.<ProcessSingleAsync>d__12.MoveNext()
1>--- End of stack trace from prevIoUs location where exception was thrown ---
1>   at System.Runtime.ExceptionServices.ExceptiondispatchInfo.Throw()
1>   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
1>   at NConsole.CommandLineProcessor.<ProcessAsync>d__11.MoveNext()
1>--- End of stack trace from prevIoUs location where exception was thrown ---
1>   at System.Runtime.ExceptionServices.ExceptiondispatchInfo.Throw()
1>   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
1>   at NConsole.CommandLineProcessor.Process(String[] args,Object input)
1>   at NSwag.Commands.NSwagCommandProcessor.Process(String[] args)

我检查了路径“#/paths/~1get_abi/post/requestBody/content/application~1json/schema/properties/account_name”,它似乎是有效的。

如何让客户端生成

--雅各

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...