2016-09-15 23 views
0

私はswaggerの初心者です。次は、私がオンラインエディタで編集しようとしていたコードです。しかし、パラメータフィールドに「有効なパラメータ定義ではありません」というエラーが表示されています。有効なパラメータ定義ではありません、Swagger 2.0

# Example YAML to get you started quickly. 
# Be aware that YAML has indentation based scoping. 
# Code completion support is available so start typing for available options. 
swagger: '2.0' 

# This is your document metadata 
info: 
    version: "0.0.0" 
    title: <test> 

# Describe your paths here 
paths: 
    # This is a path endpoint. Change it. 
    /test: 
    # This is a HTTP operation 
    post: 
     # Describe this verb here. Note: you can use markdown 

     description: Pass list of input parameter. 
     # This is array of GET operation parameters: 
     operationId: test 
     produces: 
     - application/json 
     - application/xml 
     - text/xml 
     - text/html 
     parameters: 
     - 
      name: value 
      in: body 
      description: Input parameter list 
      required: true 
      schema: 
      type: array 
      items: 
      type: object 
      properties: 
       Name: 
       type: string 
       Age: 
       type: integer 
       format: int32 
       Address: 
       type: string 
       Company: 
       type: string 
       WorkExperience: 
       type: integer 
       format: int32 

     # Expected responses for this operation: 
     responses: 
     # Response code 
     200: 
      description: Successful response 
      # A schema describing your response object. 
      # Use JSON Schema format 
      schema: 
      title: ArrayOfPersons 
      type: array 
      items: 
       title: Person 
       type: object 
       properties: 
       name: 
        type: string 
       single: 
        type: boolean 

次のエラーが闊歩プレビューア

Swagger Error 
Not a valid parameter definition 
Jump to line 28 
Details 
Object 
code: "ONE_OF_MISSING" 
params: Array [0] 
message: "Not a valid parameter definition" 
path: Array [5] 
schemaId: "http://swagger.io/v2/schema.json#" 
inner: Array [2] 
level: 900 
type: "Swagger Error" 
description: "Not a valid parameter definition" 
lineNumber: 28 

答えて

0

スキーマフィールドの "type:array"定義が正しくインデントされていませんでした。

 parameters: 
     - 
      name: value 
      in: body 
      description: Input parameter list 
      required: true 
      schema: 
      type: array 
      items: 
       type: object 
       properties: 
       Name: 
        type: string 
       Age: 
        type: integer 
        format: int32 
       Address: 
        type: string 
       Company: 
        type: string 
       WorkExperience: 
        type: integer 
        format: int32 
1

に表示され、このコード意図エラーです。

schema: 
    type: array 
    items: 
     type: object 
     properties: 
関連する問題