我正在尝试为我的 Cloud endpoints 发布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
1 回答
关于添加"url",来自https://cloud.google.com/endpoints/docs/openapi/adding-swagger的文档:
此外,为了公开您的Swagger文档,您可能需要考虑Endpoints正在开发开发人员门户功能并寻找用户:https://cloudplatform.googleblog.com/2018/03/now-you-can-automatically-document-your-API-with-Cloud-Endpoints.html