make raml traits work and be accurate/useful
This commit is contained in:
parent
a2cde20f8f
commit
3d7a2ef5b1
15 changed files with 44 additions and 9 deletions
|
@ -2,6 +2,9 @@
|
||||||
module Api
|
module Api
|
||||||
module V2
|
module V2
|
||||||
class MappingsController < RestfulController
|
class MappingsController < RestfulController
|
||||||
|
def searchable_columns
|
||||||
|
[]
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,6 +2,10 @@
|
||||||
module Api
|
module Api
|
||||||
module V2
|
module V2
|
||||||
class TokensController < RestfulController
|
class TokensController < RestfulController
|
||||||
|
def searchable_columns
|
||||||
|
[:description]
|
||||||
|
end
|
||||||
|
|
||||||
def my_tokens
|
def my_tokens
|
||||||
authorize resource_class
|
authorize resource_class
|
||||||
instantiate_collection
|
instantiate_collection
|
||||||
|
|
|
@ -2,6 +2,9 @@
|
||||||
module Api
|
module Api
|
||||||
module V2
|
module V2
|
||||||
class TopicsController < RestfulController
|
class TopicsController < RestfulController
|
||||||
|
def searchable_columns
|
||||||
|
[:name, :desc, :link]
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -11,6 +11,7 @@ securedBy: [ oauth_2_0 ]
|
||||||
|
|
||||||
traits:
|
traits:
|
||||||
pageable: !include traits/pageable.raml
|
pageable: !include traits/pageable.raml
|
||||||
|
embeddable: !include traits/embeddable.raml
|
||||||
orderable: !include traits/orderable.raml
|
orderable: !include traits/orderable.raml
|
||||||
searchable: !include traits/searchable.raml
|
searchable: !include traits/searchable.raml
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#type: collection
|
#type: collection
|
||||||
get:
|
get:
|
||||||
|
is: [ embeddable: { embedFields: "user,map" }, orderable, pageable ]
|
||||||
responses:
|
responses:
|
||||||
200:
|
200:
|
||||||
body:
|
body:
|
||||||
|
@ -27,6 +28,7 @@ post:
|
||||||
/{id}:
|
/{id}:
|
||||||
#type: item
|
#type: item
|
||||||
get:
|
get:
|
||||||
|
is: [ embeddable: { embedFields: "user,map" } ]
|
||||||
responses:
|
responses:
|
||||||
200:
|
200:
|
||||||
body:
|
body:
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#type: collection
|
#type: collection
|
||||||
get:
|
get:
|
||||||
|
is: [ searchable: { searchFields: "name, desc" }, embeddable: { embedFields: "user,topics,synapses,mappings,contributors,collaborators" }, orderable, pageable ]
|
||||||
responses:
|
responses:
|
||||||
200:
|
200:
|
||||||
body:
|
body:
|
||||||
|
@ -29,6 +30,7 @@ post:
|
||||||
/{id}:
|
/{id}:
|
||||||
#type: item
|
#type: item
|
||||||
get:
|
get:
|
||||||
|
is: [ embeddable: { embedFields: "user,topics,synapses,mappings,contributors,collaborators" } ]
|
||||||
responses:
|
responses:
|
||||||
200:
|
200:
|
||||||
body:
|
body:
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#type: collection
|
#type: collection
|
||||||
get:
|
get:
|
||||||
|
is: [ searchable: { searchFields: "desc" }, embeddable: { embedFields: "topic1,topic2,user" }, orderable, pageable ]
|
||||||
responses:
|
responses:
|
||||||
200:
|
200:
|
||||||
body:
|
body:
|
||||||
|
@ -29,6 +30,7 @@ post:
|
||||||
/{id}:
|
/{id}:
|
||||||
#type: item
|
#type: item
|
||||||
get:
|
get:
|
||||||
|
is: [ embeddable: { embedFields: "topic1,topic2,user" } ]
|
||||||
responses:
|
responses:
|
||||||
200:
|
200:
|
||||||
body:
|
body:
|
||||||
|
|
|
@ -12,6 +12,7 @@ post:
|
||||||
example: !include ../examples/token.json
|
example: !include ../examples/token.json
|
||||||
/my_tokens:
|
/my_tokens:
|
||||||
get:
|
get:
|
||||||
|
is: [ searchable: { searchFields: description }, pageable, orderable ]
|
||||||
responses:
|
responses:
|
||||||
200:
|
200:
|
||||||
body:
|
body:
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#type: collection
|
#type: collection
|
||||||
get:
|
get:
|
||||||
|
is: [ searchable: { searchFields: "name, desc, link" }, embeddable: { embedFields: "user,metacode" }, orderable, pageable ]
|
||||||
responses:
|
responses:
|
||||||
200:
|
200:
|
||||||
body:
|
body:
|
||||||
|
@ -14,7 +15,8 @@ post:
|
||||||
desc:
|
desc:
|
||||||
description: description
|
description: description
|
||||||
link:
|
link:
|
||||||
description: (optional) link to content on the web
|
description: link to content on the web
|
||||||
|
required: false
|
||||||
permission:
|
permission:
|
||||||
description: commons, public, or private
|
description: commons, public, or private
|
||||||
metacode_id:
|
metacode_id:
|
||||||
|
@ -27,6 +29,7 @@ post:
|
||||||
/{id}:
|
/{id}:
|
||||||
#type: item
|
#type: item
|
||||||
get:
|
get:
|
||||||
|
is: [ embeddable: { embedFields: "user,metacode" } ]
|
||||||
responses:
|
responses:
|
||||||
200:
|
200:
|
||||||
body:
|
body:
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
{
|
{
|
||||||
"data": {
|
"data": {
|
||||||
"id": 670,
|
"id": 670,
|
||||||
"name": "Junto feedback and enhancements map",
|
"name": "Metamaps.cc Website",
|
||||||
"desc": "",
|
"desc": "Metamaps is a great website; check it out below!",
|
||||||
"link": "",
|
"link": "https://metamaps.cc",
|
||||||
"permission": "commons",
|
"permission": "commons",
|
||||||
"created_at": "2016-07-02T09:23:30.397Z",
|
"created_at": "2016-07-02T09:23:30.397Z",
|
||||||
"updated_at": "2016-07-02T09:23:30.397Z",
|
"updated_at": "2016-07-02T09:23:30.397Z",
|
||||||
|
|
|
@ -2,9 +2,9 @@
|
||||||
"data": [
|
"data": [
|
||||||
{
|
{
|
||||||
"id": 670,
|
"id": 670,
|
||||||
"name": "Junto feedback and enhancements map",
|
"name": "Metamaps.cc Website",
|
||||||
"desc": "",
|
"desc": "Metamaps is a great website; check it out below!",
|
||||||
"link": "",
|
"link": "https://metamaps.cc",
|
||||||
"permission": "commons",
|
"permission": "commons",
|
||||||
"created_at": "2016-07-02T09:23:30.397Z",
|
"created_at": "2016-07-02T09:23:30.397Z",
|
||||||
"updated_at": "2016-07-02T09:23:30.397Z",
|
"updated_at": "2016-07-02T09:23:30.397Z",
|
||||||
|
|
8
doc/api/traits/embeddable.raml
Normal file
8
doc/api/traits/embeddable.raml
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
queryParameters:
|
||||||
|
embed:
|
||||||
|
description: |
|
||||||
|
Comma-separated list of columns to embed. Each embedded column will be returned instead of the corresponding <code>field_id</code> or <code>field_ids</code> column. For instance, <code>?embed=user</code> would remove the <code>user_id</code> integer field from a response and replace it with a <code>user</code> object field.
|
||||||
|
|
||||||
|
Possible embeddable fields are: <pre><< embedFields >></pre>
|
||||||
|
required: false
|
||||||
|
type: string
|
|
@ -1,3 +1,5 @@
|
||||||
queryParameters:
|
queryParameters:
|
||||||
sort:
|
sort:
|
||||||
description: The name of the comma-separated fields to sort by, prefixed by "-" to sort descending
|
description: The name of the comma-separated fields to sort by, prefixed by "-" to sort descending
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
|
|
@ -2,8 +2,10 @@ queryParameters:
|
||||||
page:
|
page:
|
||||||
description: The page number
|
description: The page number
|
||||||
type: integer
|
type: integer
|
||||||
|
required: false
|
||||||
default: 1
|
default: 1
|
||||||
per:
|
per:
|
||||||
description: Number of records per page
|
description: Number of records per page
|
||||||
type: integer
|
type: integer
|
||||||
default: 20
|
required: false
|
||||||
|
default: 25
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
queryParameters:
|
queryParameters:
|
||||||
q:
|
q:
|
||||||
description: The search string to query by
|
description: |
|
||||||
|
Search text columns for this string. A query of <code>"example"</code> will be passed to SQL as <code>LIKE %example%</code>. The searchable columns are: <pre><< searchFields >></pre>
|
||||||
|
required: false
|
||||||
type: string
|
type: string
|
||||||
|
|
Loading…
Reference in a new issue