Defect #6136
closed
This appears to be happening because the issue show action has a custom view (show.builder.xml) that is including the issue's relations, custom fields, etc. whereas the JSON format uses default to_json method on the issue model which doesn't include those things.
I'm going to tackle this by moving the XML builder code into the issue model's to_xml method instead of a view file. Then I'll make the issue's to_json method just call the to_xml method and convert the XML to JSON so we only need to maintain the serialization code in one place.
- Target version set to Unplanned backlogs
This is a real problem with using the XML views. Instead of overriding to_xml
, I'm wondering if there is a common method we can make so both XML and JSON formats are always the same. Example:
def to_xml
self.to_api_format(:xml)
end
def to_json
self.to_api_format(:json)
end
def to_api_format(renderer)
{
:id => self.id,
:subject => self.subject,
# ....
}
# ...
end
- Status changed from New to Closed
- Target version changed from Unplanned backlogs to 1.1.0
- Resolution set to Fixed
Fixed in r4458. xml and json responses now use the same template.
Also available in: Atom
PDF