gpt4 book ai didi

rest - Swagger-YAML错误映射条目

转载 作者:行者123 更新时间:2023-12-04 14:24:04 25 4
gpt4 key购买 nike

我尝试使用Swagger和YAML生成REST API定义,
但是在$ref: '#/definitions/Token'我得到了错误

Bad indentation of a mapping entry


      parameters:
- name: environmentID
in: query
description: id from the gamificationenvironment
required: true
type: integer
format: int32
- name: authorizationToken
in: query
description: Authorization token to create a new environment
required: true
schema:
type: object
--> Error $ref: '#/definitions/Token'
responses:
201:
description: GamificationID for the Admin
schema:
type: object
items:
$ref: '#/definitions/Environment'
default:
description: Unexpected error
schema:
$ref: '#/definitions/Error'

definitions:
Token:
required:
- authentificationKey
- user
properties:
authentificationKey:
type: string
senderID:
type: integer
format: int32
user:
type: string
type: integer
format: int64
Error:
type: object
properties:
code:
type: integer
format: int32
message:
type: string
fields:
type: string

enter image description here

我的问题是:
为什么使用 $ref映射在响应中起作用,并且
在参数上我得到一个错误?

最佳答案

这部分在语法上是不正确的:

         required: true
schema:
type: object
$ref: '#/definitions/Token'
schema:应该与 required:处于同一级别。

关于rest - Swagger-YAML错误映射条目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41915055/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com