From d6417005ef21ac2861a68c16e980866dd48b7185 Mon Sep 17 00:00:00 2001 From: Individumm Date: Wed, 18 May 2016 17:44:58 +0200 Subject: [PATCH 1/3] Add responses-object to endpoints for use in "getCustomCode" --- lib/codegen.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/codegen.js b/lib/codegen.js index 1226f870..48aaaeb1 100644 --- a/lib/codegen.js +++ b/lib/codegen.js @@ -149,6 +149,11 @@ var getViewForSwagger2 = function(opts, type){ parameter.cardinality = parameter.required ? '' : '?'; method.parameters.push(parameter); }); + + if(_.isPlainObject(op.responses)) { + method.responses = op.responses; + } + data.methods.push(method); }); }); From 0e8604f98a267aa9b774b207118feb13764361c2 Mon Sep 17 00:00:00 2001 From: Individumm Date: Wed, 18 May 2016 18:00:59 +0200 Subject: [PATCH 2/3] Removed unnecessary condition and extended schema in "README.md" --- README.md | 6 ++++++ lib/codegen.js | 4 +--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index dffa0360..25ec3347 100644 --- a/README.md +++ b/README.md @@ -169,6 +169,12 @@ methods: type: boolean isFormParameter: type: boolean + responses: + type: object + description: Includes all defined response-codes and its JSONs schema + additionalProperties: + type: object + description: See the 'Response Object' section in the [Swagger 2.0 specification](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#response-object) ``` ####Custom Mustache Variables diff --git a/lib/codegen.js b/lib/codegen.js index 48aaaeb1..d604ce55 100644 --- a/lib/codegen.js +++ b/lib/codegen.js @@ -150,9 +150,7 @@ var getViewForSwagger2 = function(opts, type){ method.parameters.push(parameter); }); - if(_.isPlainObject(op.responses)) { - method.responses = op.responses; - } + method.responses = op.responses; data.methods.push(method); }); From 64dce885977277e07e45bc2ab5499c7b8098cd0e Mon Sep 17 00:00:00 2001 From: Individumm Date: Thu, 19 May 2016 21:07:12 +0200 Subject: [PATCH 3/3] Tabs to spaces --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 25ec3347..e0dc49ac 100644 --- a/README.md +++ b/README.md @@ -170,11 +170,11 @@ methods: isFormParameter: type: boolean responses: - type: object - description: Includes all defined response-codes and its JSONs schema - additionalProperties: - type: object - description: See the 'Response Object' section in the [Swagger 2.0 specification](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#response-object) + type: object + description: Includes all defined response-codes and its JSONs schema + additionalProperties: + type: object + description: See the 'Response Object' section in the [Swagger 2.0 specification](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#response-object) ``` ####Custom Mustache Variables