首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >GCP云端点门户没有显示在swagger中定义的xml定义

GCP云端点门户没有显示在swagger中定义的xml定义
EN

Stack Overflow用户
提问于 2021-03-15 12:10:52
回答 1查看 71关注 0票数 0

例如,在云端点门户(开发人员门户)上显示swagger文件中定义的xml结构有问题,它没有显示名称空间和定义的示例,但在swagger编辑器上上传时工作正常。

下面是声明的xml定义示例

代码语言:javascript
复制
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

编辑:

昂格格文件

代码语言:javascript
复制
# [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]

就像在傲慢的编辑器上看到的

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

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-03-23 17:06:06

根据云运行的云端点 正式文件,我只能看到示例中使用了.json MimeType。

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

因此,在检查OpenAPI规范v2.0时,我无法在GitHub中看到MimeType科规范。但是,在昂首阔步的正式文件中,我可以看到xml媒体类型也是受支持的。

因此,我想请您检查云运行官方文档上的云终结点中提供的所有步骤。

在屏幕截图中,我可以看到404 NOT_FOUND错误,这个错误在云端点的故障排除部分中提到过,所以请查看它。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/66637752

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档