问题描述
我尝试将 openapi 代码部署到 GCP。 我的 openapi 设置(index.yaml)如下
openapi: 2.0.0
info:
title: My title
description: My description
termsOfService: https://example.com/
contact:
name: 名前
url: https://my-url.co.jp/
email: my-email.co.jp
version: v1
host: my-domain.com/api/
servers:
- url: https://127.0.0.1:4010
description: Mock server
paths:
$ref: paths/index.yaml
components:
schemas:
$ref: schemas/index.yaml
我有子目录“路径”和“模式”,其中也包含一些 openapi (yaml) 文件。 当我在本地运行时,它运行良好。
prism mock openapi/index.yaml
[CLI] … awaiting Starting Prism…
[CLI] ℹ info GET http://127.0.0.1:4010/account/-3058628567153340400/post/draft
[CLI] ℹ info GET http://127.0.0.1:4010/account/-2168420240751009800/post/reserve
...
我成功访问了上面的 url 来检索 json 数据。
但是当部署到 gcp 时
gcloud endpoints services deploy index.yaml
出现错误
ERROR: (gcloud.endpoints.services.deploy) Unable to parse Open API,or Google Service Configuration specification from index.yaml
我尝试过“swagger”格式(来自谷歌的示例代码)并成功部署。但不是这种“openapi”格式。 所以我在这里有两个问题:
感谢您的支持。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)