我在SwaggerHub中有以下API定义:
swagger: '2.0'
info:
description: defaultDescription
version: '0.1'
title: defaultTitle
host: swapi.co
paths:
/api/people:
get:
produces:
- application/json
parameters:
- name: search
in: query
required: false
type: string
x-example: luke
responses:
'200':
description: Definition generated from Swagger Inspector
schema:
$ref: '#/definitions/Model0'
responseSchema:
$ref: '#/definitions/Model0'
definitions:
Results:
properties:
name:
type: string
height:
type: string
mass:
type: string
hair_color:
type: string
skin_color:
type: string
eye_color:
type: string
birth_year:
type: string
gender:
type: string
homeworld:
type: string
films:
type: array
items:
type: string
species:
type: array
items:
type: string
vehicles:
type: array
items:
type: string
starships:
type: array
items:
type: string
created:
type: string
edited:
type: string
url:
type: string
Model0:
properties:
count:
type: integer
format: int32
next:
type: object
previous:
type: object
results:
type: array
items:
$ref: '#/definitions/Results'我不能使用这个基本的GET命令来返回我正在寻找的数据。它只返回以下内容:
TypeError:未能获取
我不确定这是否是语法问题,也可能是间距问题,但我也收到了第19行的错误,内容如下:
不应该有附加属性additionalProperty: responseSchema、description、schema
有什么不对吗?
发布于 2018-06-29 11:54:39
https://swapi.co似乎仅限于HTTPS,所以您需要添加
schemes:
- https来指定请求的协议。
但是我也收到了第19行的一个错误:“不应该有附加属性additionalProperty: responseSchema、description、schema”。
移除以下线条:
responseSchema:
$ref: '#/definitions/Model0'在responseSchema中没有OpenAPI关键字。
https://stackoverflow.com/questions/51089568
复制相似问题