OpenAPI 3.1带有OpenAPI-Generator-CLI CLI Typescript-fetch:jsonparseexception:未被认可的令牌' Openapi'::wath Thouge(JSON String,...)
我想使用 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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
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.