OpenAPI 3.1带有OpenAPI-Generator-CLI CLI Typescript-fetch:jsonparseexception:未被认可的令牌' Openapi'::wath Thouge(JSON String,...)

发布于 2025-01-21 11:37:36 字数 913 浏览 2 评论 0 原文

我想使用 OpenApi-generator-cli 生成一个TypeScript-fetch客户端。这些规格是通过使用 OpenAPI 3.1 格式来生成的。但是,当我运行命令时

openapi-generator-cli generate -i resources/openapi/Attribute.yaml -o ../test/ -g typescript-fetch

,我会

[ERROR] i.s.parser.SwaggerCompatConverter - failed to read resource listing
com.fasterxml.jackson.core.JsonParseException: Unrecognized token 'openapi': was expecting (JSON String, Number, Array, Object or token 'null', 'true' or 'false') at [Source: (String)"openapi: 3.1.0 ... ] 

使用另一个OpenAPI代码生成器()我可以在没有问题的情况下生成客户端代码,因此规格不仅经过验证,而且可用。这使您怀疑问题是OpenAPI版本。

OpenAPI 3.1是由OpenAPI-Typecript-Codegen支持的,还是我可以做些什么来调整我的规格文件?

我正在使用

  • OpenAPI-Generator-CLI 5.4.0
  • OpenAPI 3.1

I would like to generate a typescript-fetch client using openapi-generator-cli. The specs were generated by Stoplight using OpenAPI 3.1 format. However when I run the command

openapi-generator-cli generate -i resources/openapi/Attribute.yaml -o ../test/ -g typescript-fetch

I get the error

[ERROR] i.s.parser.SwaggerCompatConverter - failed to read resource listing
com.fasterxml.jackson.core.JsonParseException: Unrecognized token 'openapi': was expecting (JSON String, Number, Array, Object or token 'null', 'true' or 'false') at [Source: (String)"openapi: 3.1.0 ... ] 

With another openapi code generator (openapi-typescript-codegen) I can generate client code without a problem so the specs are not only validated but usable. This makes suspect that the issue is with the OpenAPI version.

Is OpenAPI 3.1 supported by openapi-typescript-codegen or is there something I can do to adapt my specs file ?

I am using

  • openapi-generator-cli 5.4.0
  • OpenAPI 3.1

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

归属感 2025-01-28 11:37:36

OpenAPI 3.1尚未用Swagger和其他工具(包括OpenAPI-Generator-CLI)支持,这是造成错误的原因。

这是最后一个(重要)团队仍在努力。

OpenAPI 3.1 is yet not supported in Swagger and other tools, including openapi-generator-cli and that's the cause of the error.

Here is the last (significant) update, the team is still working on it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文