Swagger 招摇过市错误-说明:“1”;不是有效的参数定义“;

Swagger 招摇过市错误-说明:“1”;不是有效的参数定义“;,swagger,swagger-editor,Swagger,Swagger Editor,我试图为RESTAPI定义一个简单的招摇过市定义。我的所有参数部分都出错 我在大摇大摆编辑器中得到了以下大摇大摆定义错误,我不知道我错了什么。请告知 招摇过市定义: paths: '/customer/{customerId}/accountlist': get: responses: '200': description: '' parameters: - name: customerId in: path allowMultiple

我试图为RESTAPI定义一个简单的招摇过市定义。我的所有参数部分都出错

我在大摇大摆编辑器中得到了以下大摇大摆定义错误,我不知道我错了什么。请告知

招摇过市定义:

paths:
'/customer/{customerId}/accountlist':
get:
  responses:
    '200':
      description: ''
  parameters:
    - name: customerId
      in: path
      allowMultiple: false
      required: true
      type: string
  x-auth-type: None
  x-throttling-tier: Unlimited
  produces:
    - application/json
  x-scope: InternalUse
  swagger: '2.0'
  info:
  title: Sample
  description: API for Sample
Swagger Error
Not a valid parameter definition
Jump to line 7
Details
Object
code:  "ONE_OF_MISSING"
params: Array [0]
message:  "Not a valid parameter definition"
path: Array [5]
0:  "paths"
1:  "/customer/{customerId}/accountlist"
2:  "get"
3:  "parameters"
4:  "0"
schemaId:  "http://swagger.io/v2/schema.json#"
inner: Array [2]
0: Object
code:  "ONE_OF_MISSING"
params: Array [0]
message:  "Data does not match any schemas from 'oneOf'"
path: Array [5]
0:  "paths"
1:  "/customer/{customerId}/accountlist"
2:  "get"
3:  "parameters"
4:  "0"
inner: Array [2]
0: Object
code:  "OBJECT_MISSING_REQUIRED_PROPERTY"
params: Array [1]
0:  "schema"
message:  "Missing required property: schema"
path: Array [0]
1: Object
code:  "ONE_OF_MISSING"
params: Array [0]
message:  "Data does not match any schemas from 'oneOf'"
path: Array [0]
inner: Array [4]
1: Object
code:  "OBJECT_MISSING_REQUIRED_PROPERTY"
params: Array [1]
0:  "$ref"
message:  "Missing required property: $ref"
path: Array [5]
0:  "paths"
1:  "/customer/{customerId}/accountlist"
2:  "get"
3:  "parameters"
4:  "0"
level: 900
type:  "Swagger Error"
description:  "Not a valid parameter definition"
lineNumber: 7
招摇过市错误:

paths:
'/customer/{customerId}/accountlist':
get:
  responses:
    '200':
      description: ''
  parameters:
    - name: customerId
      in: path
      allowMultiple: false
      required: true
      type: string
  x-auth-type: None
  x-throttling-tier: Unlimited
  produces:
    - application/json
  x-scope: InternalUse
  swagger: '2.0'
  info:
  title: Sample
  description: API for Sample
Swagger Error
Not a valid parameter definition
Jump to line 7
Details
Object
code:  "ONE_OF_MISSING"
params: Array [0]
message:  "Not a valid parameter definition"
path: Array [5]
0:  "paths"
1:  "/customer/{customerId}/accountlist"
2:  "get"
3:  "parameters"
4:  "0"
schemaId:  "http://swagger.io/v2/schema.json#"
inner: Array [2]
0: Object
code:  "ONE_OF_MISSING"
params: Array [0]
message:  "Data does not match any schemas from 'oneOf'"
path: Array [5]
0:  "paths"
1:  "/customer/{customerId}/accountlist"
2:  "get"
3:  "parameters"
4:  "0"
inner: Array [2]
0: Object
code:  "OBJECT_MISSING_REQUIRED_PROPERTY"
params: Array [1]
0:  "schema"
message:  "Missing required property: schema"
path: Array [0]
1: Object
code:  "ONE_OF_MISSING"
params: Array [0]
message:  "Data does not match any schemas from 'oneOf'"
path: Array [0]
inner: Array [4]
1: Object
code:  "OBJECT_MISSING_REQUIRED_PROPERTY"
params: Array [1]
0:  "$ref"
message:  "Missing required property: $ref"
path: Array [5]
0:  "paths"
1:  "/customer/{customerId}/accountlist"
2:  "get"
3:  "parameters"
4:  "0"
level: 900
type:  "Swagger Error"
description:  "Not a valid parameter definition"
lineNumber: 7

我重写了您的OpenAPI规范。此版本有效:

swagger: '2.0'

info:
  title: Sample
  version: 1.0.0
  description: API for Sample

paths:
  '/customer/{customerId}/accountlist':
    get:
      responses:
        '200':
          description: ''
      parameters:
        - name: customerId
          in: path
          required: true
          type: string
      x-auth-type: None
      x-throttling-tier: Unlimited
      produces:
        - application/json
      x-scope: InternalUse
对原始版本的一些评论:

  • 压痕不好。例如,
    get:
    行需要从前一行缩进。但这可能只是一个复制粘贴问题

  • info
    对象需要一个
    version
    属性

  • customerId
    参数包含一个
    allowMultiple
    属性。我看到了一个错误,直到我删除了它


我重写了您的OpenAPI规范。此版本有效:

swagger: '2.0'

info:
  title: Sample
  version: 1.0.0
  description: API for Sample

paths:
  '/customer/{customerId}/accountlist':
    get:
      responses:
        '200':
          description: ''
      parameters:
        - name: customerId
          in: path
          required: true
          type: string
      x-auth-type: None
      x-throttling-tier: Unlimited
      produces:
        - application/json
      x-scope: InternalUse
对原始版本的一些评论:

  • 压痕不好。例如,
    get:
    行需要从前一行缩进。但这可能只是一个复制粘贴问题

  • info
    对象需要一个
    version
    属性

  • customerId
    参数包含一个
    allowMultiple
    属性。我看到了一个错误,直到我删除了它


请在您的问题中最好以YAML格式包含Swagger/OpenAPI定义。作为问题的一部分添加了样本Swagger定义。请在您的问题中最好以YAML格式包含Swagger/OpenAPI定义。作为问题的一部分添加了样本Swagger定义。