gpt4 book ai didi

Swagger 编辑器显示路径参数的 "Schema error: should NOT have additional properties"错误

转载 作者:行者123 更新时间:2023-12-03 10:27:30 26 4
gpt4 key购买 nike

我正在使用 http://editor.swagger.io设计 API 时出现错误,我不知道如何解决:

Schema error at paths['/employees/{employeeId}/roles'].get.parameters[0]
should NOT have additional properties
additionalProperty: type, format, name, in, description
Jump to line 24

我有以类似方式定义的其他端点,并且没有收到此错误。我想知道我是否有缩进或未闭合引号的问题,但似乎并非如此。谷歌似乎也没有提供任何有用的结果。

swagger: "2.0"
info:
description: Initial draft of the API specification
version: '1.0'
title: App 4.0 API
host: api.com
basePath: /v1
tags:
- name: employees
description: Employee management
schemes:
- https
paths:
/employees/{employeeId}/roles:
get:
tags:
- employees
summary: "Get a specific employee's roles"
description: ''
operationId: findEmployeeRoles
produces:
- application/json
parameters:
- name: employeeId <====== Line 24
in: path
description: Id of employee whose roles we are fetching
type: integer
format: int64
responses:
'200':
description: successful operation
schema:
type: array
items:
$ref: '#/definitions/Role'
'403':
description: No permission to see employee roles
'404':
description: EmployeeId not found

任何提示?

最佳答案

错误消息具有误导性。实际错误是您的路径参数丢失 required: true .路径参数是必须的,记得加required: true给他们。

关于Swagger 编辑器显示路径参数的 "Schema error: should NOT have additional properties"错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45549663/

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