mattetti/Weasel-Diesel — pull request #18 by kamui (2013-08-27 08:03:05+00:00)
Title: Problem with response.to_json

Hi first of all nice project.

I start using it a couple of days ago and run into an issue with the documentation generation in wd-sinatra I didn't raise the issue there cause it seems to be in the response object of Weasel-Dieasel

Here is the response definition:

```ruby
service.response do |response|
response.object do |obj|
obj.string :status, :doc => "Response status either OK or ERROR"
obj.string :message, :doc => "The error message if an error occur", :null => true
obj.element :name => :payload, :type => 'Resource' do |payload|
payload.string :id, :doc => "Resource id"
payload.string :name, :doc => "Resource name"
payload.string :path, :doc => "Resource full path"
payload.object :metadata, :doc => "Resource metadata"
payload.array :tags, :doc => "Resource list of tags"
payload.datetime :created_at, :doc => "Created at timestamp"
payload.datetime :updated_at, :doc => "Resource updated at timestamp"
end
end
end
```

And this is the JSON result of api.response.to_json

```json
{
"status": "string",
"message": "string",
"payload": {
"payload": {
"id": "string",
"name": "string",
"path": "string",
"created_at": "datetime",
"updated_at": "datetime",
"metadata": {
"metadata": {

}
}
}
}
}
```

If you look at the payload attribute it has a nested payload attribute with the actual payload attributes, thats not what I intended and maybe my declaration is wrong.

This is what I want the payload attribute to look like:

```json
{
"status": "string",
"message": "string",
"payload": {
"id": "string",
"name": "string",
"path": "string",
"created_at": "datetime",
"updated_at": "datetime",
"metadata": {
"metadata": {

}
}
}
}
```