Comparing version
# apiDoc Changelog | ||
#### 0.5.1 | ||
* Add optional custom browser title with `apidoc.title` in `package.json`. | ||
* Add optional url endpoint with `apidoc.url` in `package.json`. | ||
* Bugfix: Template scrollbug. (https://github.com/apidoc/apidoc/issues/64) | ||
#### 0.5.0 | ||
@@ -16,3 +21,2 @@ * Add new Functions: | ||
* Add test cases. | ||
* Bugfix: Template scrollbug (https://github.com/apidoc/apidoc/issues/64) | ||
@@ -19,0 +23,0 @@ #### 0.4.4 |
/** | ||
* @apiDefinePermission admin Admin access rights needed. | ||
* Optionally you can write here further Informations about the permission. | ||
* | ||
* An "apiDefinePermission"-block can have an "apiVersion", so you can attach the block to a specific version. | ||
* | ||
* @apiVersion 0.3.0 | ||
*/ | ||
/** | ||
* @apiDefinePermission admin This title is visible in version 0.1.0 and 0.2.0 | ||
* @apiVersion 0.1.0 | ||
*/ | ||
/** | ||
* @api {get} /user/:id Read data of a User | ||
@@ -20,3 +6,2 @@ * @apiVersion 0.3.0 | ||
* @apiGroup User | ||
* @apiGroupDescription User Group Description | ||
* @apiPermission admin | ||
@@ -28,23 +13,20 @@ * | ||
* | ||
* @apiExample CURL example: | ||
* curl -i -X POST http://localhost:3001/example | ||
* -H 'Content-Type: application/json' \ | ||
* -d '{ "id": "4711" }' | ||
* @apiExample Example usage: | ||
* curl -i http://localhost/user/4711 | ||
* | ||
* @apiSuccess {String} id The Users-ID. | ||
* @apiSuccess {Date} registered Registration Date. | ||
* @apiSuccess {Date} name Fullname of the User. | ||
* @apiSuccess {String} id The Users-ID. | ||
* @apiSuccess {Date} registered Registration Date. | ||
* @apiSuccess {Date} name Fullname of the User. | ||
* @apiSuccess {String[]} nicknames List of Users nicknames (Array of Strings). | ||
* @apiSuccess {Object} profile Profile data (example for an Object) | ||
* @apiSuccess {Number} profile.age Users age. | ||
* @apiSuccess {String} profile.image Avatar-Image. | ||
* @apiSuccess {Object[]} options List of Users options (Array of Objects). | ||
* @apiSuccess {String} options.name Option Name. | ||
* @apiSuccess {String} options.value Option Value. | ||
* | ||
* @apiSuccessExample Success-Response (example): | ||
* HTTP/1.1 200 OK | ||
* { | ||
* "id": "4711" | ||
* "registered": "31.01.2013" | ||
* "name": "John Doe" | ||
* } | ||
* | ||
* @apiError NoAccessRight Only authenticated Admins can access the data. | ||
* @apiError UserNotFound The <code>id</code> of the User was not found. | ||
* | ||
* @apiErrorExample Error-Response (example): | ||
* @apiErrorExample Response (example): | ||
* HTTP/1.1 401 Not Authenticated | ||
@@ -55,54 +37,5 @@ * { | ||
*/ | ||
function getUser() { return; } | ||
/** | ||
* @api {get} /user/:id Read data of a User | ||
* @apiVersion 0.2.0 | ||
* @apiName GetUser | ||
* @apiGroup User | ||
* @apiPermission admin | ||
* | ||
* @apiDescription Here you can describe the function. | ||
* Multilines are possible. | ||
* | ||
* @apiParam {String} id The Users-ID. | ||
* | ||
* @apiSuccess {String} id The Users-ID. | ||
* @apiSuccess {Date} name Fullname of the User. | ||
* | ||
* @apiError UserNotFound The <code>id</code> of the User was not found. | ||
*/ | ||
/** | ||
* @api {get} /user/:id Read data of a User | ||
* @apiVersion 0.1.0 | ||
* @apiName GetUser | ||
* @apiGroup User | ||
* @apiPermission admin | ||
* | ||
* @apiDescription Here you can describe the function. | ||
* Multilines are possible. | ||
* | ||
* @apiParam {String} id The Users-ID. | ||
* | ||
* @apiSuccess {String} id The Users-ID. | ||
* @apiSuccess {Date} name Fullname of the User. | ||
* | ||
* @apiError UserNotFound The error description text in version 0.1.0. | ||
*/ | ||
/** | ||
* @apiDefineErrorStructure CreateUser | ||
* @apiVersion 0.2.0 | ||
* | ||
* @apiError NoAccessRight Only authenticated Admins can access the data. | ||
* @apiError UserNameTooShort Minimum of 5 characters required. | ||
* | ||
* @apiErrorExample Response (example): | ||
* HTTP/1.1 400 Bad Request | ||
* { | ||
* "error": "UserNameTooShort" | ||
* } | ||
*/ | ||
/** | ||
* @api {post} /user Create a new User | ||
@@ -121,23 +54,7 @@ * @apiVersion 0.3.0 | ||
* | ||
* @apiErrorStructure CreateUser | ||
* @apiErrorStructure CreateUserError | ||
*/ | ||
function postUser() { return; } | ||
/** | ||
* @api {post} /user Create a User | ||
* @apiVersion 0.2.0 | ||
* @apiName PostUser | ||
* @apiGroup User | ||
* @apiPermission none | ||
* | ||
* @apiDescription In this case "apiErrorStructure" is defined and used. | ||
* Define blocks with params that will be used in several functions, so you dont have to rewrite them. | ||
* | ||
* @apiParam {String} name Name of the User. | ||
* | ||
* @apiSuccess {String} id The Users-ID. | ||
* | ||
* @apiErrorStructure CreateUser | ||
*/ | ||
/** | ||
* @api {put} /user/:id Change a new User | ||
@@ -153,3 +70,4 @@ * @apiVersion 0.3.0 | ||
* | ||
* @apiErrorStructure CreateUser | ||
*/ | ||
* @apiErrorStructure CreateUserError | ||
*/ | ||
function putUser() { return; } |
@@ -5,4 +5,14 @@ { | ||
"description": "apidoc example project", | ||
"apidoc": "This is a description, it will be ignored if parameter apidocFilename exist.", | ||
"apidocFilename": "API.md" | ||
} | ||
"apidoc": { | ||
"title": "Custom apiDoc browser title", | ||
"url" : "https://api.github.com/v1", | ||
"header": { | ||
"title": "My own header title", | ||
"filename": "header.md" | ||
}, | ||
"footer": { | ||
"title": "My own footer title", | ||
"filename": "footer.md" | ||
} | ||
} | ||
} |
@@ -154,6 +154,10 @@ var _ = require("underscore"); | ||
packageInfos.name = json.name; | ||
packageInfos.version = json.version; | ||
packageInfos.name = json.name; | ||
packageInfos.version = json.version; | ||
packageInfos.description = json.description; | ||
packageInfos.title = json.apidoc.title; | ||
// HINT: url could be replaced in the future with an @apiVariable, so versioning could be used. | ||
packageInfos.url = json.apidoc.url; | ||
if(json.apidoc.header && json.apidoc.header.filename) | ||
@@ -160,0 +164,0 @@ { |
{ | ||
"name": "apidoc", | ||
"version": "0.5.0", | ||
"version": "0.5.1", | ||
"description": "RESTful web API Documentation Generator", | ||
@@ -5,0 +5,0 @@ "author": "Peter Rottmann <rottmann@inveris.de>", |
@@ -191,4 +191,4 @@ require.config({ | ||
*/ | ||
var title = apiProject.name + " - " + apiProject.version; | ||
$(document).attr("title", "apiDoc: " + title); | ||
var title = apiProject.title ? apiProject.title : "apiDoc: " + apiProject.name + " - " + apiProject.version; | ||
$(document).attr("title", title); | ||
@@ -267,2 +267,5 @@ /** | ||
// Add endpoint URL | ||
if(apiProject.url) fields.article.url = apiProject.url + fields.article.url; | ||
articles.push({ | ||
@@ -269,0 +272,0 @@ article: templateArticle(fields), |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
694618
0.33%143
1.42%8246
0.3%