Skip to content

Commit

Permalink
Documentation stucture and format improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
binarymax committed Jul 5, 2014
1 parent 8dba8ac commit f59dc79
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 48 deletions.
7 changes: 4 additions & 3 deletions documenter.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ var documentresource = Documenter.resource = function(resource){
},
name:resource.name,
description:resource.description,
type:'resource',
methods:{}
};

Expand All @@ -36,7 +37,7 @@ var documentmethod = Documenter.method = function(root,specification,verb,method
var url = tools.buildroutestring(specification.name,root,method);
var type = specification.name + '.' + methodtype.toLowerCase();

var doc = {verb:verb,description:method.description,url:url,type:type};
var doc = {verb:verb,description:method.description,path:url,type:type};

verb = verb.toUpperCase();

Expand All @@ -47,8 +48,8 @@ var documentmethod = Documenter.method = function(root,specification,verb,method
for (var o in obj) {
if(obj.hasOwnProperty(o)) {
list.push({
key:o,
type:obj[o].type.type,
name:o,
type:obj[o].type,
description:obj[o].description,
required:obj[o].required
});
Expand Down
6 changes: 0 additions & 6 deletions heimdall.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,6 @@ var route = function(name,type,method) {

};



// --------------------------------------------------------------------------
// Builds a url route string, based on accepted method params

// --------------------------------------------------------------------------
// Builds an REST resource based on an API specification
var buildmethodresource = function(name,root,resource,specification,verb,methodname,app) {
Expand Down Expand Up @@ -171,7 +166,6 @@ var register = function(filename,resource,app) {
};



// --------------------------------------------------------------------------
// Expose heimdall resource calls for use by other modules
var resource = Heimdall.resource = function(name,type,data,callback) {
Expand Down
82 changes: 46 additions & 36 deletions views/api.jade
Original file line number Diff line number Diff line change
@@ -1,40 +1,50 @@
style.
* { font-family:sans-serif; }
.heimdall-list {list-style:none;}
.heimdall-resources {margin:0;padding:0;}
.heimdall-resource {padding:0.5em; margin:0.5em;border-top:1px solid #333;}
.heimdall-description {margin-top:1em;}
.heimdall-method,.heimdall-details {display:inline-block;margin:0.5em;border:1px solid #ccc;padding:0.5em;vertical-align:top;}
.heimdall-method {width:12em;}
.heimdall-details {width:50em;}
.heimdall-parameters {margin:0.5em;}
#heimdallapi * { font-family:sans-serif; }
#heimdallapi .heimdall-list {list-style:none;margin:0px;}
#heimdallapi .heimdall-resources {margin:0;padding:0;}
#heimdallapi .heimdall-resource {padding:0.5em; margin:0.5em;border-top:1px solid #333;}
#heimdallapi .heimdall-description {margin-top:1em;}
#heimdallapi .heimdall-method,.heimdall-details {display:inline-block;margin:0.5em;border:1px solid #ccc;padding:0.5em;vertical-align:top;}
#heimdallapi .heimdall-method {width:12em;}
#heimdallapi .heimdall-details {width:50em;}
#heimdallapi .heimdall-parameters {margin:0.5em;margin-left:0px;padding-left:0px;}
#heimdallapi .heimdall-parameters > li {margin-left:0.5em;}
#heimdallapi h4 { margin:0px; }

h1 API

ul.heimdall-list.heimdall-resources
for resource in results
li.heimdall-resource
h2= resource.name
em= resource.description
ul.heimdall-list
for method in resource.methods
li
.heimdall-description= method.description
.heimdall-method
.heimdall-verb= method.verb
.heimdall-url= method.url
.heimdall-details
ul.heimdall-list.heimdall-parameters
#heimdallapi
h1 API
ul.heimdall-list.heimdall-resources
for resource in results
li.heimdall-resource
h2= resource.name
em= resource.description
ul.heimdall-list
for method in resource.methods
li
.heimdall-description
strong= method.description
.heimdall-method
.heimdall-verb= method.verb
.heimdall-path= method.path
.heimdall-details
-var count=0
if method.query&&method.query.length
for query in method.query
li= '@' + query.key + ' <' + query.type + '> :: ' + query.description
else
li
em This method has no querystring parameters
ul.heimdall-list.heimdall-parameters
-count++
h4 QueryString Parameters
ul.heimdall-list.heimdall-parameters
for query in method.query
li= '?' + query.name + ' <' + query.type + '> :: ' + query.description
if method.body&&method.body.length
for body in method.body
li= '@' + body.key + ' <' + body.type + '> :: ' + body.description
else
li
em This method has no body parameters
-count++
h4 Body Parameters
ul.heimdall-list.heimdall-parameters
for body in method.body
li= '@' + body.name + ' <' + body.type + '> :: ' + body.description
if method.files&&method.files.length
-count++
h4 File Attachments
ul.heimdall-list.heimdall-parameters
for file in method.files
li= '@' + file.name + ' <' + file.type + '> :: ' + file.description
if count===0
em No additional parameters specified
6 changes: 3 additions & 3 deletions views/method.jade
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,19 @@ ul.heimdall-list.heimdall-resources
.heimdall-description= method.description
.heimdall-method
.heimdall-verb= method.verb
.heimdall-url= method.url
.heimdall-path= method.path
.heimdall-details
ul.heimdall-list.heimdall-parameters
if method.query&&method.query.length
for query in method.query
li= '@' + query.key + ' <' + query.type + '> :: ' + query.description
li= '@' + query.name + ' <' + query.type + '> :: ' + query.description
else
li
em This method has no querystring parameters
ul.heimdall-list.heimdall-parameters
if method.body&&method.body.length
for body in method.body
li= '@' + body.key + ' <' + body.type + '> :: ' + body.description
li= '@' + body.name + ' <' + body.type + '> :: ' + body.description
else
li
em This method has no body parameters

0 comments on commit f59dc79

Please sign in to comment.