例如,在云端点门户(开发人员门户)上显示swagger文件中定义的xml结构有问题,它没有显示名称空间和定义的示例,但在swagger编辑器上上传时工作正常。
下面是声明的xml定义示例
MsgResp:
type: object
properties:
Code:
type: string
example: RC_001_SUCCESS
Message:
type: string
example: Message sent
xml:
name: 'MessageResponse'
wrapped: true
namespace: http://MsgResponse编辑:
昂格格文件
# [START swagger]
swagger: '2.0'
info:
title: <Endpoint-name>
description: <Endpoint-name>
version: 1.0.0
# Connects to the cloud run running the ESP Beta 2 image
host: <Endpoint-address> # CloudRun/Esp url
security: []
schemes:
- https
paths:
"/status":
post:
description: "Test API for sending request from system 1 to IIP. "
operationId: "status-api"
# Defines which service it should connect to for backend processing, It can be Cloud function/ Cloud Run url
x-google-backend:
address: https://<Function1-address> # Backend Cloud function URL
deadline: 3600.0
# Defines Authentication mechanism to use, Following mentions to use API KEYS
security:
- api_key: []
# MIME Types expected as request and response
produces:
- "application/xml"
consumes:
- "application/xml"
parameters:
- in: body
name: schema
description: Input Schema for /status
schema:
$ref: '#/definitions/InSchema'
responses:
200:
description: OK
schema:
$ref: '#/definitions/MessageResponse'
404:
description: Not Found
500:
description: Internal Service Error
definitions:
InSchema:
type: object
xml:
name: 'Identifier'
prefix: 'msg'
wrapped: true
namespace: 'http://Identifier'
properties:
Number:
type: integer
LogIdentifier:
type: object
properties:
Code:
type: integer
Type:
type: string
xml:
name: 'LogicalIdentifier'
wrapped: true
namespace: http://LogicalIdentifier
prefix: sample
example: # <----------
Number: 38
LogIdentifier:
Code: 100
Type: CDC
MessageResponse:
type: object
properties:
Code:
type: string
example: SUCCESS
Message:
type: string
example: Message sent
# [START securityDef]
securityDefinitions:
api_key:
type: "apiKey"
name: "key"
in: "query"
# [END securityDef]就像在傲慢的编辑器上看到的

如云端点门户/应用程序门户所示

发布于 2021-03-23 17:06:06
根据云运行的云端点 正式文件,我只能看到示例中使用了.json MimeType。
Cloud服务定义应该基于OpenAPI规范v2.0,也称为Swagger 2,它描述后端服务的表面和任何身份验证需求。
因此,在检查OpenAPI规范v2.0时,我无法在GitHub中看到MimeType科规范。但是,在昂首阔步的正式文件中,我可以看到xml媒体类型也是受支持的。
因此,我想请您检查云运行官方文档上的云终结点中提供的所有步骤。
在屏幕截图中,我可以看到404 NOT_FOUND错误,这个错误在云端点的故障排除部分中提到过,所以请查看它。
https://stackoverflow.com/questions/66637752
复制相似问题