尝试导入 swagger.json 文件时 AWS CLI 中的 BadRequestException

BadRequestException in AWS CLI when trying to import a swagger.json file

我正在使用 AWS API 网关并尝试使用 AWS CLI 导入 Swagger JSON 文件。以下是我用来导入的命令。

aws apigateway import-rest-api --parameters endpointConfigurationTypes=REGIONAL  --cli-binary-format raw-in-base64-out --body D:/aws/test.json --no-fail-on-warnings

但是我收到这个错误:

An error occurred (BadRequestException) when calling the ImportRestApi operation: Invalid OpenAPI input.

test.json 看起来不错,我在 AWS 控制台中尝试过它并且可以正常工作。 我不明白为什么在我尝试使用 AWS CLI 时它不起作用。我正在使用 AWS CLI 版本 2。非常感谢任何帮助。谢谢

您应该按照 docs:

中的说明使用 file://
--body file://C:\aws\test.json