2016-11-21 96 views
0

我有一個比較簡單的招搖DOC,未得到解析,並且錯誤信息確認時,我得到簡化版,道理給我:招搖無法解析我的參數

下面

是我昂首闊步DOC :

--- 
swagger: '2.0' 
info: 
    version: 1.0.0 
    title: Required APIs for Loan Provider 
schemes: 
- https 
consumes: 
- application/json 
produces: 
- application/json 
paths: 
    "/loan/{LoanGuid}/": 
    post: 
     description: initiation api for starting a loan 
     operationId: InitLoan 
     produces: 
     - application/json 
     parameters: 
     - name: LoanGuid 
     in: path 
     type: string 
     required: 'true' 
     - name: body 
     in: body 
     schema: 
      "$ref": "#/definitions/CreditApp" 
     responses: 
     '200': 
      description: successful submittion of a loan 
      schema: 
      "$ref": "#/definitions/LoanDetails" 
     '400': 
      description: validation error 
      schema: 
      "$ref": "#/definitions/Error" 
     '500': 
      description: unknown exception 
      schema: 
      "$ref": "#/definitions/Error" 
definitions: 
    Error: 
    title: Non Successful Response 
    type: object 
    properties: 
     LoanGuid: 
     description: the unique identifier for the loan 
     type: string 
     Error: 
     type: string 
    CreditApp: 
    title: Credit Application 
    type: object 
    properties: 
     FirstName: 
     type: string 
     MiddleName: 
     type: string 
     LastName: 
     type: string 
    Address: 
    title: Address 
    type: object 
    properties: 
     Street: 
     type: string 
     Street2: 
     type: string 
     City: 
     type: string 
     State: 
     type: string 
     Zip: 
     type: string 
    LoanDetails: 
    title: Loan Details 
    type: object 
    properties: 
     FirstName: 
     type: string 
     MiddleName: 
     type: string 
     LastName: 
     type: string 

我從http://editor.swagger.io/#/

Not a valid parameter definition 
Jump to line 19 
Details 
Object 
code: "ONE_OF_MISSING" 
params: Array [0] 
message: "Not a valid parameter definition" 
path: Array [5] 
0: "paths" 
1: "/loan/{LoanGuid}/" 
2: "post" 
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] 
inner: Array [2] 
1: Object 
code: "OBJECT_MISSING_REQUIRED_PROPERTY" 
params: Array [1] 
message: "Missing required property: $ref" 
path: Array [5] 
level: 900 
type: "Swagger Error" 
description: "Not a valid parameter definition" 
lineNumber: 19 

回答

0

更改收到以下異常

在報價
required: 'true' 

required: true 

'true'是一個字符串,而不是一個布爾值。