【发布时间】:2018-03-04 07:25:32
【问题描述】:
我正在尝试为我的云端点发布 Swagger 文档。我的应用程序是用 Python 编写的。根据文档 [1]:
1.) 我从 https://github.com/swagger-api/swagger-ui.git 下载了存储库。
2.) 从下载的存储库中复制 dist 目录并放入我项目中的 docs 文件夹中。我创建了一个名为 docs 的新文件夹。
3,) 按照步骤 3,项目名称应为 FQDN。我在 openapi.yaml 中的项目名称是-> host: "sample-project-******.appspot.com"
4.) 如文档中第 4 步所述,我在 app.yaml 中添加了以下内容
handlers:
- url: /docs
static_files: docs/index.html
upload: docs/index.html
- url: /docs/(.*)
static_files: docs/\1
upload: docs/.
5.) 将 docs/index.html 中的 URL 条目更新为:
url = "../api-docs";
6.) 在 openapi.yaml 中添加以下内容
"/docs":
get:
description: "Documentation"
operationId: "docs"
produces:
- "application/json"
responses:
200:
description: "Documentation"
问题:
第5步添加url = "../api-docs"有什么意义?
当我点击 /docs 时,我得到 404。
[1]https://cloud.google.com/endpoints/docs/openapi/adding-swagger
【问题讨论】:
-
对于404问题,你修改openapi.yaml后,是否做了“gcloud endpoints services deploy openapi.yaml”,然后更新app.yaml中的配置ID?
标签: google-cloud-endpoints swagger-ui gcloud openapi