GCP Cloud 端点门户不显示在 swagger 中定义的 xml 定义

GCP Cloud endpoint portal does not show xml definition defined in swagger

在云端点门户(开发人员门户)上显示 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

编辑:

Swagger 文件

# [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]

正如在 swagger 编辑器上所见

如在云端点门户/应用程序门户上所见

根据 Cloud Endpoints on Cloud 运行 Official Documentation,我只能看到示例中使用了 .json MimeType。

Cloud Endpoint 服务定义应基于 OpenAPI Specification v2.0,也称为 Swagger 2,它描述了后端服务的表面和任何身份验证要求。

所以检查 GitHub 中的 OpenAPI 规范 v2.0,我无法在 MimeType Section. However in the Swagger Official Documentation 中看到 xml 规范,我可以看到 xml也支持媒体类型。

因此,我想请您检查 Cloud Endpoint on Cloud Run Official Documentation 中提供的所有步骤。

在屏幕截图中,我可以看到 404 NOT_FOUND 错误,此错误在 Cloud Endpoints 的 Troubleshooting section 中提到,因此请查看它。