谷歌云创建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
相关产品推荐
相关产品推荐

