JS Framework能够基于(django)rest api OPTIONS生成表单

and*_*abs 7 javascript django rest restful-architecture angularjs

我正在使用Django REST框架.
使用可浏览的API时,单击OPTIONS按钮后,我会看到字段的美妙定义和资源允许的操作,例如下面的此用户资源:

HTTP 200 OK
Content-Type: application/json
Vary: Accept
Allow: GET, PUT, PATCH, DELETE, HEAD, OPTIONS

{
    "name": "XSpot User Detail", 
    "description": "", 
    "renders": [
        "application/json", 
        "text/html"
    ], 
    "parses": [
        "application/json", 
        "application/x-www-form-urlencoded", 
        "multipart/form-data"
    ], 
    "actions": {
        "PUT": {
            "url": {
                "type": "field", 
                "required": false, 
                "read_only": true
            }, 
            "mail_sent": {
                "type": "boolean", 
                "required": false, 
                "read_only": false, 
                "label": "mail sent"
            }, 
            "email": {
                "type": "email", 
                "required": true, 
                "read_only": false, 
                "label": "email address", 
                "max_length": 255
            }
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

问题:是否有任何JS框架能够利用此元信息生成表单?

小智 3

嗯,我认为这可能会有所帮助http://formly-js.github.io/angular-formly它采用 JSON 并呈现 HTML 表单。