Commit 2eb3dd38 authored by Sean Arnold's avatar Sean Arnold

Return incidents as array inside object

parent 5ea90fa9
...@@ -5,7 +5,7 @@ module StatusPage ...@@ -5,7 +5,7 @@ module StatusPage
entity IncidentEntity entity IncidentEntity
def represent_list(resource) def represent_list(resource)
represent(resource, except: [:comments]) { incidents: represent(resource, except: [:comments]) }
end end
def represent_details(resource, user_notes) def represent_details(resource, user_notes)
......
{ {
"type": "array", "type": "object",
"items": { "$ref": "basic_incident.json" }, "required": ["incidents"],
"properties": {
"incidents": {
"type": "array",
"items": { "$ref": "basic_incident.json" }
}
},
"additionalProperties": false "additionalProperties": false
} }
...@@ -14,7 +14,7 @@ describe StatusPage::IncidentSerializer do ...@@ -14,7 +14,7 @@ describe StatusPage::IncidentSerializer do
describe '.represent_list' do describe '.represent_list' do
let(:resource) { [issue] } let(:resource) { [issue] }
let(:json_entity) do let(:json_entity) do
subject.represent_list(resource).map(&:with_indifferent_access) subject.represent_list(resource).with_indifferent_access
end end
it_behaves_like 'valid JSON schema', schema: 'status_page/incident_list' it_behaves_like 'valid JSON schema', schema: 'status_page/incident_list'
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment