繁体   English   中英

Can I create a API gateway in a F# class lib with type providers and use that in a C# solution to get intellisense on external Web Api using swagger?

[英]Can I create a API gateway in a F# class lib with type providers and use that in a C# solution to get intellisense on external Web Api using swagger?

我使用了很多 ASP.NET Core web API,这些 API 使用了 swagger,当使用这些 API 时,有很多复制粘贴请求、响应和 Dto's。

F# have Type Providers https://fsharp.github.io/FSharp.Data/library/JsonProvider.html which sounds very good for consuming API's giving me intellisense and compile errors if types or names of external DTO's do not match.

If possible I would like to create a F# class lib which would use Type providers and point to the swagger json file to generate the classes, I would then like to use the F# class lib in my C# solution as there is no native Type provider from我在 C# 中所知道的。

如果这可行,我希望我能得到的是

  1. 无需复制/粘贴外部请求、响应和 dto 作为
  2. 如果外部 API 更改其类型,类型提供程序将提供此编译错误
  3. Intellisense 更容易编码

是否有可能或是否有更好的解决方案?

由于Swagger TypeProvider生成的,因此这可能的。

其他解决方案包括NSwag或使用swagger.io上的生成器的手动工作流

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM