You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

谷歌云创建API Gateway时报错无法转换为服务配置问题求助

问题根因

你的配置报错是YAML缩进规则不符合规范导致的解析失败,具体问题如下:

  • YAML语法要求同级键值对必须保持一致的缩进层级。你配置中的swagger: '2.0'是顶格的顶级字段,但后续的info、host、schemes、produces、paths等同级顶级字段都额外加了4个空格的缩进,被解析器错误识别为swagger字段的子属性,直接触发BlockMappingStart解析错误。
  • 额外可优化点:200响应的描述单词拼写错误(Sucess→Success),x-google-backend.address需要替换为你真实的后端服务访问地址,不可用占位符。

修正后的完整配置

swagger: '2.0'
info:
  title: API Gateway for Cycle
  description: "Send a deal object for the data to be treated"
  version: "1.0.0"
host: teste.apigateway.project-teste-homolog.cloud.goog
schemes:
  - "https"
produces:
  - "application/json"
paths:
  "/data-verification-homologation":
    post:
      x-google-backend: 
        address: 替换为你的真实后端地址
      description: "Jailson esteve aqui =)"
      operationId: "dataVerification"
      parameters:
        -
          name: iataCode
          in: query
          required: true
          type: string
      responses:
        200:
          description: "Success"
          schema:
            type: string
        400:
          description: "Error"

内容的提问来源于stack exchange,提问作者Lucas de Lagos Pandolfi Garcia

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.10.04 06:06:01