vky / iodocs

Interactive API documentation system
MIT License
5 stars 5 forks source link

Default Values don't auto render for POST body #26

Closed Sidwick closed 11 years ago

Sidwick commented 11 years ago

When you specify a default value you want to display on the UI.

{
    "Name":"Payload",
     "Required":"Y",
     "Default":"SGERT$ERW",
     "Type":"string",
     "Description":"user id"
}

The Json Body Post on the UI is not auto populated with that default value. You have to click into that textbox for "Payload", then click back out and then it auto generates the Json body.

vky commented 11 years ago

Could you provide the entire API description so I can test it out? Also, what browser / browser version is this occurring in?

Sidwick commented 11 years ago
{
    "MethodName": "addfacebookconnection",
    "Synopsis": "Add a Facebook Connect to the Current Customer Session",
    "HTTPMethod": "POST",
    "URI": "/visitor/addfacebookconnection",
    "RequiresOAuth": "N",
    "Content-type": [ "application/json" ],
    "content": {
        "schema":{"type":"string"},
        "contentType":["application/json"],
        "parameters": [
            {
                "Name":"Payload",
                 "Required":"Y",
                 "Default":"fb_uid=34403144&email=wesley.s.daniels%40gmail.com&first_name=Wes&last_name=Daniels&timestamp=1362525399",
                 "Type":"string",
                 "Description":"user id"
            },
            {
                "Name":"Signature",
                 "Required":"Y",
                 "Default":"lrsolJZM9bnAFSMippXt4P431f7QBmoMW1j/Ppub8MtRMj//vBxdarEQEqLQ81Y65kGUvix8sCAhSBVr3T1PpXh7vgD1to/jCWVYes3zBs22Pt7O/SoL8dN7NiAQa/BzsiHi5T6K2p9Ye6rHZ1Onwp1GPmyX3HttUrh7ZfxLxTL3Wn/V212vebdeQiYgKe6kV4WpqU58wjHc12LRKZAN0vJcMI5Ks3MU0SY5PYznfg8iaLSyT3H9Od9GhQK8LAMgc8TmgobOF2aHk48mCV0K0PFNHGcGp+CeWUvAJ8gD6lhNykopHB88Hz2+o67kxQ+7KaZ+9Lstpxx52Lml3+O0lw==",
                 "Type":"string",
                 "Description":"user id"
            }                       
        ]
    },
    "parameters": [             
    ]
}               

I am using Chrome 25.

It's not really a bug, as much of maybe a nice to have feature.

When you specify default values, like Payload and Signature above, it doesn't auto-generate the Json body response for you, as it would if you were typing the values into those text boxes.

vky commented 11 years ago

Here's a fix, not exactly elegant, but it works. Thought it would take more effort than it did. Check this branch: https://github.com/vkorapaty/iodocs/tree/example-issue26-patch

Sidwick commented 11 years ago

yup, perfect. Thanks