summaryrefslogtreecommitdiff
path: root/rest-api-templates
diff options
context:
space:
mode:
authorMatthew Jordan <mjordan@digium.com>2015-01-27 17:21:03 +0000
committerMatthew Jordan <mjordan@digium.com>2015-01-27 17:21:03 +0000
commitfb8a2e039978b264737aa7a4ed08f9af4c329f47 (patch)
treefe2b256c707be4347f78c384468ffbf1aacba8dd /rest-api-templates
parentaa8fd7d1b9dcbcc207cbcc333df850b3e8e0be54 (diff)
ARI: Improve wiki documentation
This patch improves the documentation of ARI on the wiki. Specifically, it addresses the following: * Allowed values and allowed ranges weren't documented. This was particularly frustrating, as Asterisk would reject query parameters with disallowed values - but we didn't tell anyone what the allowed values were. * The /play/id operation on /channels and /bridges failed to document all of the added media resource types. * Documentation for creating a channel into a Stasis application failed to note when it occurred, and that creating a channel into Stasis conflicts with creating a channel into the dialplan. * Some other minor tweaks in the mustache templates, including italicizing the parameter type, putting the default value on its own sub-bullet, and some other nicities. Review: https://reviewboard.asterisk.org/r/4351 ........ Merged revisions 431145 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@431148 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'rest-api-templates')
-rw-r--r--rest-api-templates/api.wiki.mustache18
-rw-r--r--rest-api-templates/asterisk_processor.py4
-rw-r--r--rest-api-templates/swagger_model.py6
3 files changed, 25 insertions, 3 deletions
diff --git a/rest-api-templates/api.wiki.mustache b/rest-api-templates/api.wiki.mustache
index de6de2dcc..73aa2448a 100644
--- a/rest-api-templates/api.wiki.mustache
+++ b/rest-api-templates/api.wiki.mustache
@@ -11,21 +11,33 @@ h1. {{name_title}}
{{#operations}}
{anchor:{{nickname}}}
-h2. {{http_method}} {{wiki_path}}
+h2. {{nickname}}: {{http_method}} {{wiki_path}}
{{{wiki_summary}}}{{#wiki_notes}} {{{wiki_notes}}}{{/wiki_notes}}
{{#has_path_parameters}}
h3. Path parameters
{{#path_parameters}}
-* {{name}}: {{data_type}}{{#default_value}} = {{default_value}}{{/default_value}} - {{{wiki_description}}}
+* {{name}}: _{{data_type}}_ - {{{wiki_description}}}
+{{#default_value}}
+** Default: {{default_value}}
+{{/default_value}}
+{{#wiki_allowable_values}}
+** {{wiki_allowable_values}}
+{{/wiki_allowable_values}}
{{/path_parameters}}
{{/has_path_parameters}}
{{#has_query_parameters}}
h3. Query parameters
{{#query_parameters}}
-* {{name}}: {{data_type}}{{#default_value}} = {{default_value}}{{/default_value}} -{{#required}} *(required)*{{/required}} {{{wiki_description}}}
+* {{name}}: _{{data_type}}_ -{{#required}} *(required)*{{/required}} {{{wiki_description}}}
+{{#default_value}}
+** Default: {{default_value}}
+{{/default_value}}
+{{#wiki_allowable_values}}
+** {{wiki_allowable_values}}
+{{/wiki_allowable_values}}
{{#allow_multiple}}
** Allows comma separated values.
{{/allow_multiple}}
diff --git a/rest-api-templates/asterisk_processor.py b/rest-api-templates/asterisk_processor.py
index ef0f1673a..ab8a8afd2 100644
--- a/rest-api-templates/asterisk_processor.py
+++ b/rest-api-templates/asterisk_processor.py
@@ -223,6 +223,10 @@ class AsteriskProcessor(SwaggerPostProcessor):
else:
parameter.c_space = ' '
parameter.wiki_description = wikify(parameter.description)
+ if parameter.allowable_values:
+ parameter.wiki_allowable_values = parameter.allowable_values.to_wiki()
+ else:
+ parameter.wiki_allowable_values = None
def process_model(self, model, context):
model.description_dox = model.description.replace('\n', '\n * ')
diff --git a/rest-api-templates/swagger_model.py b/rest-api-templates/swagger_model.py
index 9c65219e5..f3b49e12e 100644
--- a/rest-api-templates/swagger_model.py
+++ b/rest-api-templates/swagger_model.py
@@ -220,6 +220,9 @@ class AllowableRange(Stringify):
self.min_value = min_value
self.max_value = max_value
+ def to_wiki(self):
+ return "Allowed range: Min: {0}; Max: {1}".format(self.min_value, self.max_value)
+
class AllowableList(Stringify):
"""Model of a allowableValues of type LIST
@@ -229,6 +232,9 @@ class AllowableList(Stringify):
def __init__(self, values):
self.values = values
+ def to_wiki(self):
+ return "Allowed values: {0}".format(", ".join(self.values))
+
def load_allowable_values(json, context):
"""Parse a JSON allowableValues object.