2017-02-08 1 views
1

私はremoteMethodsでループバックエクスプローラのデフォルトを表示していません。 JSONオブジェクトを入力するとポストが作成されますが、通常はサンプルのlabled "モデルスキーマ"があります。ここにはインラインモデルだけがあります。ループバックエクスプローラのインラインモデルが必要ですモデルスキーマ

アイデア?

モデル定義:

{ 
    "name": "PicklistModel", 
    "plural": "PicklistModels", 
    "base": "PersistedModel", 
    "idInjection": true, 
    "options": { 
    "validateUpsert": true 
    }, 
    "properties": { 
    "picklistId": { 
     "type": "string", 
     "id": true, 
     "generated": true 
    }, 
    "key": { 
     "type": "string", 
     "required": false 
    }, 
    "value": { 
     "type": "string", 
     "required": false 
    } 
    }, 
    "validations": [], 
    "relations": {}, 
    "acls": [], 
    "methods": {} 
} 

リモートメソッド定義:パラメータの

Picklist.remoteMethod('create', { 
    description: 'Create an PICKLIST', 
    http: { 
     path: '/', 
     verb: 'POST' 
    }, 
    accepts : [{ 
     description : 'The request to create an PICKLIST', 
     arg : 'request', 
     type : 'object', 
     required : true, 
     http : { 
      source : 'body' 
     }, 
     default: { 
      key: '', 
      value: '' 
     } 
     } 
    ], 
    returns: RESTResponseStatic.loopbackAdapterCommonRestResponseDefinition() 
    }); 

Loopback Explorer

答えて

1

使用タイプは、代わりにオブジェクト型モデルの例の下で見

accepts: [{ 
    description : 'The request to create an PICKLIST', 
    arg: 'request', 
    type: 'Picklist', // *** give model reference here 
    required : true, 
    http: { 
     source : 'body' 
    }, 
    default: { 
     key: '', 
     value: '' 
    } 
}] 
+0

魅力的に働いた!素晴らしいです、ありがとう。 – Jim

関連する問題