diff --git a/modules/swagger-codegen/src/main/resources/htmlDocs/bodyParam.mustache b/modules/swagger-codegen/src/main/resources/htmlDocs/bodyParam.mustache index b9adf4d8d92..2fd81183a5b 100644 --- a/modules/swagger-codegen/src/main/resources/htmlDocs/bodyParam.mustache +++ b/modules/swagger-codegen/src/main/resources/htmlDocs/bodyParam.mustache @@ -1,5 +1,3 @@ -{{#isBodyParam}} -
{{paramName}} {{^required}}(optional){{/required}}{{#required}}(required){{/required}}
+{{#isBodyParam}}
{{paramName}} {{^required}}(optional){{/required}}{{#required}}(required){{/required}}
-
Body Parameter — {{description}} {{#defaultValue}} - default: {{{defaultValue}}}{{/defaultValue}}
{{/isBodyParam}} \ No newline at end of file +
Body Parameter — {{description}} {{#defaultValue}}default: {{{defaultValue}}}{{/defaultValue}}
{{/isBodyParam}} \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/htmlDocs/formParam.mustache b/modules/swagger-codegen/src/main/resources/htmlDocs/formParam.mustache index 66770da842e..97f342e60d7 100644 --- a/modules/swagger-codegen/src/main/resources/htmlDocs/formParam.mustache +++ b/modules/swagger-codegen/src/main/resources/htmlDocs/formParam.mustache @@ -1,5 +1,3 @@ -{{#isFormParam}} -
{{paramName}} {{^required}}(optional){{/required}}{{#required}}(required){{/required}}
+{{#isFormParam}}
{{paramName}} {{^required}}(optional){{/required}}{{#required}}(required){{/required}}
-
Form Parameter — {{description}} {{#defaultValue}} - default: {{{defaultValue}}}{{/defaultValue}}
{{/isFormParam}} \ No newline at end of file +
Form Parameter — {{description}} {{#defaultValue}}default: {{{defaultValue}}}{{/defaultValue}}
{{/isFormParam}} \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/htmlDocs/headerParam.mustache b/modules/swagger-codegen/src/main/resources/htmlDocs/headerParam.mustache index 709b79e3738..903713493be 100644 --- a/modules/swagger-codegen/src/main/resources/htmlDocs/headerParam.mustache +++ b/modules/swagger-codegen/src/main/resources/htmlDocs/headerParam.mustache @@ -1,5 +1,3 @@ -{{#isHeaderParam}} -
{{paramName}} {{^required}}(optional){{/required}}{{#required}}(required){{/required}}
+{{#isHeaderParam}}
{{paramName}} {{^required}}(optional){{/required}}{{#required}}(required){{/required}}
-
Header Parameter — {{description}} {{#defaultValue}} - default: {{{defaultValue}}}{{/defaultValue}}
{{/isHeaderParam}} \ No newline at end of file +
Header Parameter — {{description}} {{#defaultValue}}default: {{{defaultValue}}}{{/defaultValue}}
{{/isHeaderParam}} \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/htmlDocs/index.mustache b/modules/swagger-codegen/src/main/resources/htmlDocs/index.mustache index 09248273010..ce881084bc2 100644 --- a/modules/swagger-codegen/src/main/resources/htmlDocs/index.mustache +++ b/modules/swagger-codegen/src/main/resources/htmlDocs/index.mustache @@ -1,76 +1,61 @@ - - + + API Reference - - -

{{{appName}}}

+ + +

{{{appName}}}

+
{{{appDescription}}} for {{partner}}
+ {{#infoUrl}}
More information: {{{infoUrl}}}
{{/infoUrl}} + {{#infoEmail}}
Contact Info: {{{infoEmail}}}
{{/infoEmail}} + {{#version}}
Version: {{{version}}}
{{/version}} +
{{{licenseInfo}}}
+
{{{licenseUrl}}}
+

Access

+
Customize this message as you see fit!
+

Methods

+ {{#apiInfo}} + {{#apis}} + {{#operations}}{{#operation}} +
+
{{httpMethod}}: {{path}}
+
{{#tags}}{{this}}{{/tags}}
+
{{nickname}} {{summary}}
+
{{notes}}
-
{{{appDescription}}} for {{partner}}
-{{#infoUrl}} -
More information: {{{infoUrl}}}
{{/infoUrl}} -{{#infoEmail}} -
Contact Info: {{{infoEmail}}}
{{/infoEmail}} -{{#version}} -
Version: {{{version}}}
{{/version}} -
{{{licenseInfo}}}
-
{{{licenseUrl}}}
-

Access

+

Parameters

+
+ {{#allParams}}{{>queryParam}}{{>pathParam}}{{>bodyParam}}{{>headerParam}}{{>formParam}} + {{/allParams}} +
+

Return type

-
Customize this message as you see fit!
-

Methods

-{{#apiInfo}} - {{#apis}} - {{#operations}}{{#operation}} -
-
-
{{httpMethod}}: {{path}}
-
-
{{#tags}}{{this}}{{/tags}}
-
{{nickname}} {{summary}}
-
{{notes}}
+ -

Parameters

+ {{#examples}} +

Example data

+
Content-Type: {{{contentType}}}
+
{{example}}
+ {{/examples}} +
+
+ {{/operation}}{{/operations}} + {{/apis}}{{/apiInfo}} -
- {{#allParams}}{{>queryParam}}{{>pathParam}}{{>bodyParam}}{{>headerParam}}{{>formParam}} - {{/allParams}} -
- -

Return type

- -
{{{returnType}}}
- - {{#examples}} -

Example data

- -
Content-Type: {{{contentType}}}
-
{{example}}
- {{/examples}} -
- -
- {{/operation}}{{/operations}} - {{/apis}}{{/apiInfo}} - -

Models

-{{#models}} - {{#model}} -
-

{{classname}}

- -
- {{#vars}} -
{{name}} {{#isNotRequired}}(optional){{/isNotRequired}}
-
{{datatype}} {{description}}
- {{/vars}} -
- -
- {{/model}} -{{/models}} - - +

Models

+ {{#models}} + {{#model}} +
+

{{classname}}

+
+ {{#vars}}
{{name}} {{#isNotRequired}}(optional){{/isNotRequired}}
{{datatype}} {{description}}
+ {{/vars}} +
+
+ {{/model}} + {{/models}} + + \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/htmlDocs/pathParam.mustache b/modules/swagger-codegen/src/main/resources/htmlDocs/pathParam.mustache index 6270f601c8a..b47805a4f04 100644 --- a/modules/swagger-codegen/src/main/resources/htmlDocs/pathParam.mustache +++ b/modules/swagger-codegen/src/main/resources/htmlDocs/pathParam.mustache @@ -1,5 +1,3 @@ -{{#isPathParam}} -
{{paramName}} {{^required}}(optional){{/required}}{{#required}}(required){{/required}}
+{{#isPathParam}}
{{paramName}} {{^required}}(optional){{/required}}{{#required}}(required){{/required}}
-
Path Parameter — {{description}} {{#defaultValue}} - default: {{{defaultValue}}}{{/defaultValue}}
{{/isPathParam}} \ No newline at end of file +
Path Parameter — {{description}} {{#defaultValue}}default: {{{defaultValue}}}{{/defaultValue}}
{{/isPathParam}} \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/htmlDocs/queryParam.mustache b/modules/swagger-codegen/src/main/resources/htmlDocs/queryParam.mustache index 323ace6a27e..52147fbd718 100644 --- a/modules/swagger-codegen/src/main/resources/htmlDocs/queryParam.mustache +++ b/modules/swagger-codegen/src/main/resources/htmlDocs/queryParam.mustache @@ -1,5 +1,3 @@ -{{#isQueryParam}} -
{{paramName}} {{^required}}(optional){{/required}}{{#required}}(required){{/required}}
+{{#isQueryParam}}
{{paramName}} {{^required}}(optional){{/required}}{{#required}}(required){{/required}}
-
Query Parameter — {{description}} {{#defaultValue}} - default: {{{defaultValue}}}{{/defaultValue}}
{{/isQueryParam}} \ No newline at end of file +
Query Parameter — {{description}} {{#defaultValue}}default: {{{defaultValue}}}{{/defaultValue}}
{{/isQueryParam}} \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/htmlDocs/style.css.mustache b/modules/swagger-codegen/src/main/resources/htmlDocs/style.css.mustache index d628ff11ff8..14ab06a7f7e 100644 --- a/modules/swagger-codegen/src/main/resources/htmlDocs/style.css.mustache +++ b/modules/swagger-codegen/src/main/resources/htmlDocs/style.css.mustache @@ -1,151 +1,151 @@ -body { -font-family: Trebuchet MS, sans-serif; -font-size: 15px; -color: #444; -margin-right: 24px; +body { + font-family: Trebuchet MS, sans-serif; + font-size: 15px; + color: #444; + margin-right: 24px; } -h1 { -font-size: 25px; +h1 { + font-size: 25px; } -h2 { -font-size: 20px; +h2 { + font-size: 20px; } -h3 { -font-size: 16px; -font-weight: bold; +h3 { + font-size: 16px; + font-weight: bold; } -hr { -height: 1px; -border: 0; -color: #ddd; -background-color: #ddd; -display: none; +hr { + height: 1px; + border: 0; + color: #ddd; + background-color: #ddd; + display: none; } .app-desc { -clear: both; -margin-left: 20px; + clear: both; + margin-left: 20px; } .param-name { -width: 100%; + width: 100%; } .license-info { -margin-left: 20px; + margin-left: 20px; } .license-url { -margin-left: 20px; + margin-left: 20px; } .model { -margin: 0 0 0px 20px; + margin: 0 0 0px 20px; } .method { -margin-left: 20px; + margin-left: 20px; } -.method-notes { -margin: 10px 0 20px 0; -font-size: 90%; -color: #555; +.method-notes { + margin: 10px 0 20px 0; + font-size: 90%; + color: #555; } pre { -padding: 10px; -margin-bottom: 2px; + padding: 10px; + margin-bottom: 2px; } pre.get { -background-color: #0f6ab4; + background-color: #0f6ab4; } pre.post { -background-color: #10a54a; + background-color: #10a54a; } pre.put { -background-color: #c5862b; + background-color: #c5862b; } pre.delete { -background-color: #a41e22; + background-color: #a41e22; } -.huge { -color: #fff; +.huge { + color: #fff; } pre.example { -background-color: #f3f3f3; -padding: 10px; -border: 1px solid #ddd; + background-color: #f3f3f3; + padding: 10px; + border: 1px solid #ddd; } code { -white-space: pre; + white-space: pre; } .nickname { -font-weight: bold; + font-weight: bold; } .method-path { -font-size: 1.5em; -background-color: #0f6ab4; + font-size: 1.5em; + background-color: #0f6ab4; } .parameter { -width: 500px; + width: 500px; } .param { -width: 500px; -padding: 10px 0 0 20px; -font-weight: bold; + width: 500px; + padding: 10px 0 0 20px; + font-weight: bold; } .param-desc { -width: 700px; -padding: 0 0 0 20px; -color: #777; + width: 700px; + padding: 0 0 0 20px; + color: #777; } .param-type { -font-style: italic; + font-style: italic; } .field-label { -padding: 0; -margin: 0; -clear: both; + padding: 0; + margin: 0; + clear: both; } -.field-items { -padding: 0 0 15px 0; -margin-bottom: 15px; +.field-items { + padding: 0 0 15px 0; + margin-bottom: 15px; } .return-type { -clear: both; -padding-bottom: 10px; + clear: both; + padding-bottom: 10px; } .param-header { -font-weight: bold; + font-weight: bold; } .method-tags { -text-align: right; + text-align: right; } .method-tag { -background: none repeat scroll 0% 0% #24A600; -border-radius: 3px; -padding: 2px 10px; -margin: 2px; -color: #FFF; -display: inline-block; -text-decoration: none; + background: none repeat scroll 0% 0% #24A600; + border-radius: 3px; + padding: 2px 10px; + margin: 2px; + color: #FFF; + display: inline-block; + text-decoration: none; } \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/nodejs/controller.mustache b/modules/swagger-codegen/src/main/resources/nodejs/controller.mustache index f0300e95656..85d1f3211a1 100644 --- a/modules/swagger-codegen/src/main/resources/nodejs/controller.mustache +++ b/modules/swagger-codegen/src/main/resources/nodejs/controller.mustache @@ -4,22 +4,22 @@ var url = require('url'); {{#operations}} - var {{classname}} = require('./{{classname}}Service'); +var {{classname}} = require('./{{classname}}Service'); - {{#operation}} +{{#operation}} - module.exports.{{nickname}} = function {{nickname}} (req, res, next) { - {{#allParams}}var {{paramName}} = req.swagger.params['{{baseName}}'].value; - {{/allParams}} +module.exports.{{nickname}} = function {{nickname}} (req, res, next) { + {{#allParams}}var {{paramName}} = req.swagger.params['{{baseName}}'].value; + {{/allParams}} - var result = {{classname}}.{{nickname}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}); + var result = {{classname}}.{{nickname}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}); - if(typeof result !== 'undefined') { - res.setHeader('Content-Type', 'application/json'); - res.end(JSON.stringify(result || {}, null, 2)); - } - else - res.end(); - }; - {{/operation}} + if(typeof result !== 'undefined') { + res.setHeader('Content-Type', 'application/json'); + res.end(JSON.stringify(result || {}, null, 2)); + } + else + res.end(); +}; +{{/operation}} {{/operations}} \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/nodejs/index.mustache b/modules/swagger-codegen/src/main/resources/nodejs/index.mustache index 57d0ff040c9..0562c2f0c37 100644 --- a/modules/swagger-codegen/src/main/resources/nodejs/index.mustache +++ b/modules/swagger-codegen/src/main/resources/nodejs/index.mustache @@ -8,9 +8,9 @@ var serverPort = {{serverPort}}; // swaggerRouter configuration var options = { -swaggerUi: '/swagger.json', -controllers: './controllers', -useStubs: process.env.NODE_ENV === 'development' ? true : false // Conditionally turn on stubs (mock mode) + swaggerUi: '/swagger.json', + controllers: './controllers', + useStubs: process.env.NODE_ENV === 'development' ? true : false // Conditionally turn on stubs (mock mode) }; // The Swagger document (require it, build it programmatically, fetch it from a URL, ...) @@ -18,21 +18,21 @@ var swaggerDoc = require('./api/swagger.json'); // Initialize the Swagger middleware swaggerTools.initializeMiddleware(swaggerDoc, function (middleware) { -// Interpret Swagger resources and attach metadata to request - must be first in swagger-tools middleware chain -app.use(middleware.swaggerMetadata()); + // Interpret Swagger resources and attach metadata to request - must be first in swagger-tools middleware chain + app.use(middleware.swaggerMetadata()); -// Validate Swagger requests -app.use(middleware.swaggerValidator()); + // Validate Swagger requests + app.use(middleware.swaggerValidator()); -// Route validated requests to appropriate controller -app.use(middleware.swaggerRouter(options)); + // Route validated requests to appropriate controller + app.use(middleware.swaggerRouter(options)); -// Serve the Swagger documents and Swagger UI -app.use(middleware.swaggerUi()); + // Serve the Swagger documents and Swagger UI + app.use(middleware.swaggerUi()); -// Start the server -http.createServer(app).listen({{serverPort}}, function () { -console.log('Your server is listening on port %d (http://localhost:%d)', {{serverPort}}, {{serverPort}}); -console.log('Swagger-ui is available on http://localhost:%d/docs', {{serverPort}}); -}); + // Start the server + http.createServer(app).listen({{serverPort}}, function () { + console.log('Your server is listening on port %d (http://localhost:%d)', {{serverPort}}, {{serverPort}}); + console.log('Swagger-ui is available on http://localhost:%d/docs', {{serverPort}}); + }); }); \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/nodejs/package.mustache b/modules/swagger-codegen/src/main/resources/nodejs/package.mustache index ace5125d47a..7add6e813fe 100644 --- a/modules/swagger-codegen/src/main/resources/nodejs/package.mustache +++ b/modules/swagger-codegen/src/main/resources/nodejs/package.mustache @@ -1,15 +1,15 @@ { -"name": "{{projectName}}", -"version": "{{appVersion}}", -"description": "{{appDescription}}", -"main": "index.js", -"keywords": [ -"swagger" -], -"license": "MIT", -"private": true, -"dependencies": { -"connect": "^3.2.0", -"swagger-tools": "0.8.*" -} + "name": "{{projectName}}", + "version": "{{appVersion}}", + "description": "{{appDescription}}", + "main": "index.js", + "keywords": [ + "swagger" + ], + "license": "MIT", + "private": true, + "dependencies": { + "connect": "^3.2.0", + "swagger-tools": "0.8.*" + } } diff --git a/modules/swagger-codegen/src/main/resources/nodejs/service.mustache b/modules/swagger-codegen/src/main/resources/nodejs/service.mustache index 76d582a0356..d7c2ade5079 100644 --- a/modules/swagger-codegen/src/main/resources/nodejs/service.mustache +++ b/modules/swagger-codegen/src/main/resources/nodejs/service.mustache @@ -1,18 +1,18 @@ 'use strict'; {{#operations}} - {{#operation}} - exports.{{nickname}} = function({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) { +{{#operation}} +exports.{{nickname}} = function({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) { - var examples = {}; - {{#examples}} - examples['{{contentType}}'] = {{{example}}}; - {{/examples}} + var examples = {}; + {{#examples}} + examples['{{contentType}}'] = {{{example}}}; + {{/examples}} - {{#returnType}} - if(Object.keys(examples).length > 0) - return examples[Object.keys(examples)[0]]; - {{/returnType}} - } - {{/operation}} + {{#returnType}} + if(Object.keys(examples).length > 0) + return examples[Object.keys(examples)[0]]; + {{/returnType}} +} +{{/operation}} {{/operations}} diff --git a/modules/swagger-codegen/src/main/resources/nodejs/swagger.mustache b/modules/swagger-codegen/src/main/resources/nodejs/swagger.mustache index ed6a91567ad..8b4c8d33bdc 100644 --- a/modules/swagger-codegen/src/main/resources/nodejs/swagger.mustache +++ b/modules/swagger-codegen/src/main/resources/nodejs/swagger.mustache @@ -1,42 +1,42 @@ { -"swagger": "2.0", -"info": { -"title": "{{appName}}", -"description": "{{appDescription}}", -"version": "{{apiVersion}}" -}, + "swagger": "2.0", + "info": { + "title": "{{appName}}", + "description": "{{appDescription}}", + "version": "{{apiVersion}}" + }, {{#apiInfo}} - "produces": ["application/json"], - "host": "localhost:{{serverPort}}", - "basePath": "{{contextPath}}", - "paths": { - {{#apis}} - {{#operations}} - {{#operation}} - "{{{path}}}": { - "{{httpMethod}}": { - "x-swagger-router-controller": "{{classname}}", - "tags": ["{{baseName}}"], - "operationId": "{{operationId}}",{{#hasParams}} - "parameters": [ - {{#allParams}} - {{{jsonSchema}}}{{#hasMore}},{{/hasMore}} - {{/allParams}} - ],{{/hasParams}} - "responses": { - {{#responses}} - "{{code}}": {{{jsonSchema}}} - {{#hasMore}},{{/hasMore}} - {{/responses}} - } - } - } {{#hasMore}},{{/hasMore}} - {{/operation}} - {{#hasMore}},{{/hasMore}} - {{/operations}} - {{/apis}} + "produces": ["application/json"], + "host": "localhost:{{serverPort}}", + "basePath": "{{contextPath}}", + "paths": { +{{#apis}} +{{#operations}} + {{#operation}} + "{{{path}}}": { + "{{httpMethod}}": { + "x-swagger-router-controller": "{{classname}}", + "tags": ["{{baseName}}"], + "operationId": "{{operationId}}",{{#hasParams}} + "parameters": [ + {{#allParams}} + {{{jsonSchema}}}{{#hasMore}},{{/hasMore}} + {{/allParams}} + ],{{/hasParams}} + "responses": { + {{#responses}} + "{{code}}": {{{jsonSchema}}} + {{#hasMore}},{{/hasMore}} + {{/responses}} + } + } + } {{#hasMore}},{{/hasMore}} + {{/operation}} + {{#hasMore}},{{/hasMore}} +{{/operations}} +{{/apis}} {{/apiInfo}} -}, "definitions": { -{{#models}}{{#model}}"{{classVarName}}": {{{modelJson}}}{{#hasMoreModels}},{{/hasMoreModels}}{{/model}}{{/models}} -} + }, "definitions": { + {{#models}}{{#model}}"{{classVarName}}": {{{modelJson}}}{{#hasMoreModels}},{{/hasMoreModels}}{{/model}}{{/models}} + } }