From 5c12949c8d17115e9748ebfba3af4f99985d17cd Mon Sep 17 00:00:00 2001 From: Connor Turland Date: Sun, 18 Dec 2016 15:12:23 -0500 Subject: [PATCH] update api and docs --- app/serializers/api/v2/map_serializer.rb | 1 + doc/api/apis/maps.raml | 12 ++++++++++-- doc/api/examples/map.json | 1 + doc/api/examples/map_starred.json | 1 + doc/api/examples/maps.json | 1 + doc/api/schemas/_map.json | 12 ++++++++++++ 6 files changed, 26 insertions(+), 2 deletions(-) diff --git a/app/serializers/api/v2/map_serializer.rb b/app/serializers/api/v2/map_serializer.rb index ff641c69..7e090d33 100644 --- a/app/serializers/api/v2/map_serializer.rb +++ b/app/serializers/api/v2/map_serializer.rb @@ -18,6 +18,7 @@ module Api def self.embeddable { user: {}, + source: {}, topics: {}, synapses: {}, mappings: {}, diff --git a/doc/api/apis/maps.raml b/doc/api/apis/maps.raml index d3361a70..fe9fed67 100644 --- a/doc/api/apis/maps.raml +++ b/doc/api/apis/maps.raml @@ -1,6 +1,6 @@ #type: collection get: - is: [ searchable: { searchFields: "name, desc" }, embeddable: { embedFields: "user,topics,synapses,mappings,contributors,collaborators" }, orderable, pageable ] + is: [ searchable: { searchFields: "name, desc" }, embeddable: { embedFields: "user,source,topics,synapses,mappings,contributors,collaborators" }, orderable, pageable ] securedBy: [ null, token, oauth_2_0, cookie ] queryParameters: user_id: @@ -23,6 +23,8 @@ post: description: description permission: description: commons, public, or private + source_id: + description: the id of the map this map is a fork of screenshot: description: url to a screenshot of the map contributor_ids: @@ -37,7 +39,7 @@ post: /{id}: #type: item get: - is: [ embeddable: { embedFields: "user,topics,synapses,mappings,contributors,collaborators" } ] + is: [ embeddable: { embedFields: "user,source,topics,synapses,mappings,contributors,collaborators" } ] securedBy: [ null, token, oauth_2_0, cookie ] responses: 200: @@ -60,6 +62,9 @@ post: screenshot: description: url to a screenshot of the map required: false + source_id: + description: the id of the map this map is a fork of + required: false responses: 200: body: @@ -81,6 +86,9 @@ post: screenshot: description: url to a screenshot of the map required: false + source_id: + description: the id of the map this map is a fork of + required: false responses: 200: body: diff --git a/doc/api/examples/map.json b/doc/api/examples/map.json index 78711649..d50d36fd 100644 --- a/doc/api/examples/map.json +++ b/doc/api/examples/map.json @@ -9,6 +9,7 @@ "created_at": "2016-03-26T08:02:05.379Z", "updated_at": "2016-03-27T07:20:18.047Z", "user_id": 1234, + "source_id": null, "topic_ids": [ 58, 59 diff --git a/doc/api/examples/map_starred.json b/doc/api/examples/map_starred.json index 4ac6c698..1fde87d6 100644 --- a/doc/api/examples/map_starred.json +++ b/doc/api/examples/map_starred.json @@ -9,6 +9,7 @@ "created_at": "2016-03-26T08:02:05.379Z", "updated_at": "2016-03-27T07:20:18.047Z", "user_id": 1234, + "source_id": null, "topic_ids": [ 58, 59 diff --git a/doc/api/examples/maps.json b/doc/api/examples/maps.json index 1e2a7baf..687f8cc5 100644 --- a/doc/api/examples/maps.json +++ b/doc/api/examples/maps.json @@ -10,6 +10,7 @@ "created_at": "2016-03-26T08:02:05.379Z", "updated_at": "2016-03-27T07:20:18.047Z", "user_id": 1234, + "source_id": 2, "topic_ids": [ 58, 59 diff --git a/doc/api/schemas/_map.json b/doc/api/schemas/_map.json index d8d9c138..755f5b3a 100644 --- a/doc/api/schemas/_map.json +++ b/doc/api/schemas/_map.json @@ -33,6 +33,12 @@ "user": { "$ref": "_user.json" }, + "source_id": { + "$ref": "_id.json" + }, + "source": { + "$ref": "_map.json" + }, "topic_ids": { "type": "array", "items": { @@ -111,6 +117,12 @@ { "required": [ "user" ] } ] }, + { + "oneOf": [ + { "required": [ "source_id" ] }, + { "required": [ "source" ] } + ] + }, { "oneOf": [ { "required": [ "topic_ids" ] },