From a2cde20f8f4ffef04bdf20c39ef8c8156e709b16 Mon Sep 17 00:00:00 2001 From: Devin Howard Date: Tue, 4 Oct 2016 12:11:58 +0800 Subject: [PATCH] raml2html with 1.0 syntax working --- doc/api/api.raml | 36 +++++++++++--------------- doc/api/apis/mappings.raml | 4 +-- doc/api/apis/maps.raml | 4 +-- doc/api/apis/synapses.raml | 4 +-- doc/api/apis/tokens.raml | 4 +-- doc/api/apis/topics.raml | 4 +-- doc/api/resourceTypes/collection.raml | 2 +- doc/api/resourceTypes/item.raml | 2 +- doc/api/schemas/_page.json | 1 - doc/api/schemas/error.json | 1 + doc/api/securitySchemes/oauth_2_0.raml | 7 +++++ doc/api/traits/orderable.raml | 2 +- doc/api/traits/pageable.raml | 2 ++ package.json | 3 ++- 14 files changed, 40 insertions(+), 36 deletions(-) create mode 100644 doc/api/schemas/error.json create mode 100644 doc/api/securitySchemes/oauth_2_0.raml diff --git a/doc/api/api.raml b/doc/api/api.raml index d61e66ac..d8a3afc3 100644 --- a/doc/api/api.raml +++ b/doc/api/api.raml @@ -2,35 +2,29 @@ --- title: Metamaps version: v2 -baseUri: http://metamaps.cc/api/v2 +baseUri: https://metamaps.cc/api/v2 mediaType: application/json securitySchemes: - - oauth_2_0: - description: | - OAuth 2.0 implementation - type: OAuth 2.0 - settings: - authorizationUri: https://metamaps.cc/api/v2/oauth/authorize - accessTokenUri: https://metamaps.cc/api/v2/oauth/token - authorizationGrants: [ authorization_code, password, client_credentials, implicit, refresh_token ] + oauth_2_0: !include securitySchemes/oauth_2_0.raml +securedBy: [ oauth_2_0 ] traits: - - pageable: !include traits/pageable.raml - - orderable: !include traits/orderable.raml - - searchable: !include traits/searchable.raml + pageable: !include traits/pageable.raml + orderable: !include traits/orderable.raml + searchable: !include traits/searchable.raml schemas: - - topic: !include schemas/_topic.json - - synapse: !include schemas/_synapse.json - - map: !include schemas/_map.json - - mapping: !include schemas/_mapping.json - - token: !include schemas/_token.json + topic: !include schemas/_topic.json + synapse: !include schemas/_synapse.json + map: !include schemas/_map.json + mapping: !include schemas/_mapping.json + token: !include schemas/_token.json -resourceTypes: - - base: !include resourceTypes/base.raml - - item: !include resourceTypes/item.raml - - collection: !include resourceTypes/collection.raml +#resourceTypes: +# base: !include resourceTypes/base.raml +# item: !include resourceTypes/item.raml +# collection: !include resourceTypes/collection.raml /topics: !include apis/topics.raml /synapses: !include apis/synapses.raml diff --git a/doc/api/apis/mappings.raml b/doc/api/apis/mappings.raml index 8b72b4df..fad67fd2 100644 --- a/doc/api/apis/mappings.raml +++ b/doc/api/apis/mappings.raml @@ -1,4 +1,4 @@ -type: collection +#type: collection get: responses: 200: @@ -25,7 +25,7 @@ post: application/json: example: !include ../examples/mapping.json /{id}: - type: item + #type: item get: responses: 200: diff --git a/doc/api/apis/maps.raml b/doc/api/apis/maps.raml index c5499a33..8c2c2825 100644 --- a/doc/api/apis/maps.raml +++ b/doc/api/apis/maps.raml @@ -1,4 +1,4 @@ -type: collection +#type: collection get: responses: 200: @@ -27,7 +27,7 @@ post: application/json: example: !include ../examples/map.json /{id}: - type: item + #type: item get: responses: 200: diff --git a/doc/api/apis/synapses.raml b/doc/api/apis/synapses.raml index 3169c712..3fb1eee1 100644 --- a/doc/api/apis/synapses.raml +++ b/doc/api/apis/synapses.raml @@ -1,4 +1,4 @@ -type: collection +#type: collection get: responses: 200: @@ -27,7 +27,7 @@ post: application/json: example: !include ../examples/synapse.json /{id}: - type: item + #type: item get: responses: 200: diff --git a/doc/api/apis/tokens.raml b/doc/api/apis/tokens.raml index 9f471615..b9c3aaff 100644 --- a/doc/api/apis/tokens.raml +++ b/doc/api/apis/tokens.raml @@ -1,4 +1,4 @@ -type: collection +#type: collection post: body: application/json: @@ -18,7 +18,7 @@ post: application/json: example: !include ../examples/tokens.json /{id}: - type: item + #type: item delete: responses: 204: diff --git a/doc/api/apis/topics.raml b/doc/api/apis/topics.raml index 7c214dd2..07eb8886 100644 --- a/doc/api/apis/topics.raml +++ b/doc/api/apis/topics.raml @@ -1,4 +1,4 @@ -type: collection +#type: collection get: responses: 200: @@ -25,7 +25,7 @@ post: application/json: example: !include ../examples/topic.json /{id}: - type: item + #type: item get: responses: 200: diff --git a/doc/api/resourceTypes/collection.raml b/doc/api/resourceTypes/collection.raml index d54e6c0c..e2710dae 100644 --- a/doc/api/resourceTypes/collection.raml +++ b/doc/api/resourceTypes/collection.raml @@ -16,7 +16,7 @@ get?: post?: description: Create a new <> responses: - 200: + 201: body: application/json: schema: <> diff --git a/doc/api/resourceTypes/item.raml b/doc/api/resourceTypes/item.raml index 1abf040e..5c227d61 100644 --- a/doc/api/resourceTypes/item.raml +++ b/doc/api/resourceTypes/item.raml @@ -1,3 +1,4 @@ +type: base get?: description: Get a <> responses: @@ -26,4 +27,3 @@ delete?: responses: 204: description: Removed -type: base diff --git a/doc/api/schemas/_page.json b/doc/api/schemas/_page.json index 635f0286..47f69d95 100644 --- a/doc/api/schemas/_page.json +++ b/doc/api/schemas/_page.json @@ -35,4 +35,3 @@ "per" ] } - diff --git a/doc/api/schemas/error.json b/doc/api/schemas/error.json new file mode 100644 index 00000000..0967ef42 --- /dev/null +++ b/doc/api/schemas/error.json @@ -0,0 +1 @@ +{} diff --git a/doc/api/securitySchemes/oauth_2_0.raml b/doc/api/securitySchemes/oauth_2_0.raml new file mode 100644 index 00000000..b271e03a --- /dev/null +++ b/doc/api/securitySchemes/oauth_2_0.raml @@ -0,0 +1,7 @@ +description: | + OAuth 2.0 implementation +type: OAuth 2.0 +settings: + authorizationUri: https://metamaps.cc/api/v2/oauth/authorize + accessTokenUri: https://metamaps.cc/api/v2/oauth/token + authorizationGrants: [ authorization_code, client_credentials ] diff --git a/doc/api/traits/orderable.raml b/doc/api/traits/orderable.raml index 708736ab..a2b45ce9 100644 --- a/doc/api/traits/orderable.raml +++ b/doc/api/traits/orderable.raml @@ -1,3 +1,3 @@ queryParameters: sort: - description: The name of the field to sort by, prefixed by "-" to sort descending + description: The name of the comma-separated fields to sort by, prefixed by "-" to sort descending diff --git a/doc/api/traits/pageable.raml b/doc/api/traits/pageable.raml index 88165861..31fcb9a8 100644 --- a/doc/api/traits/pageable.raml +++ b/doc/api/traits/pageable.raml @@ -2,6 +2,8 @@ queryParameters: page: description: The page number type: integer + default: 1 per: description: Number of records per page type: integer + default: 20 diff --git a/package.json b/package.json index 106294fd..12f42e6c 100644 --- a/package.json +++ b/package.json @@ -41,6 +41,7 @@ "chai": "^3.5.0", "eslint": "^3.5.0", "eslint-plugin-react": "^6.3.0", - "mocha": "^3.0.2" + "mocha": "^3.0.2", + "raml2html": "^4.0.0-beta5" } }