diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/LuaClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/LuaClientCodegen.java index 431795c4c94..4da35a982e6 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/LuaClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/LuaClientCodegen.java @@ -285,12 +285,12 @@ public class LuaClientCodegen extends DefaultCodegen implements CodegenConfig { @Override public String apiTestFileFolder() { - return outputFolder + File.separator + apiPackage + File.separator + specFolder.replace("/", File.separator); + return outputFolder + File.separator + specFolder.replace("/", File.separator); } @Override public String modelTestFileFolder() { - return outputFolder + File.separator + modelPackage + File.separator + specFolder.replace("/", File.separator); + return outputFolder + File.separator + specFolder.replace("/", File.separator); } @Override diff --git a/modules/swagger-codegen/src/main/resources/lua/api_test.mustache b/modules/swagger-codegen/src/main/resources/lua/api_test.mustache index ed57594ee61..f7da0c08551 100644 --- a/modules/swagger-codegen/src/main/resources/lua/api_test.mustache +++ b/modules/swagger-codegen/src/main/resources/lua/api_test.mustache @@ -1,15 +1,4 @@ ---[[ {{> partial_header}} -]] - -local petstore_{{classname}} = require "{{packageName}}.api.{{{classname}}}" -{{#models}} -[[-- import all models --]] -{{#model}} -local {{packageName}}_{{{classname}}} = require "{{packageName}}.model.{{{classname}}}" -{{/model}} -{{/models}} - --[[ Unit tests for {{{packageName}}}.api.{{{classname}}} Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) @@ -17,9 +6,16 @@ Please update as you see appropriate ]] {{#operations}} describe("{{classname}}", function() + local {{{packageName}}}_{{{classname}}} = require "{{{packageName}}}.api.{{{classname}}}" {{#operation}} + {{#models}} + [[-- import all models --]] + {{#model}} + local {{{packageName}}}_{{{classname}}} = require "{{{packageName}}}.model.{{{classname}}}" + {{/model}} + {{/models}} -- unit tests for {{operationId}} - describe("{{operationId}} test", function() + describe("{{{operationId}}} test", function() it("should work", function() -- TODO assertion here: http://olivinelabs.com/busted/#asserts end) diff --git a/modules/swagger-codegen/src/main/resources/lua/model_test.mustache b/modules/swagger-codegen/src/main/resources/lua/model_test.mustache index a5c43737a28..b4ffc01e144 100644 --- a/modules/swagger-codegen/src/main/resources/lua/model_test.mustache +++ b/modules/swagger-codegen/src/main/resources/lua/model_test.mustache @@ -1,17 +1,14 @@ ---[[ {{> partial_header}} -]] - {{#models}} {{#model}} -local {{packageName}}_{{{classname}}} = require "{{packageName}}.model.{{{classname}}}" - --[[ Unit tests for {{{packageName}}}.model.{{{classname}}} Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) Please update as you see appropriate ]] describe("{{classname}}", function() + local {{{packageName}}}_{{{classname}}} = require "{{{packageName}}}.model.{{{classname}}}" + {{#vars}} -- unit tests for the property '{{{name}}}' describe("property {{{name}}} test", function() diff --git a/samples/client/petstore/lua/petstore/spec/api_response_spec.lua b/samples/client/petstore/lua/spec/api_response_spec.lua similarity index 61% rename from samples/client/petstore/lua/petstore/spec/api_response_spec.lua rename to samples/client/petstore/lua/spec/api_response_spec.lua index 106113cf7ca..191436941f8 100644 --- a/samples/client/petstore/lua/petstore/spec/api_response_spec.lua +++ b/samples/client/petstore/lua/spec/api_response_spec.lua @@ -1,23 +1,21 @@ --[[ -Swagger Petstore - -This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. - -OpenAPI spec version: 1.0.0 -Contact: apiteam@swagger.io -Generated by: https://github.com/swagger-api/swagger-codegen.git -Swagger Codegen version: 2.4.0-SNAPSHOT - + Swagger Petstore + + This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git ]] -local petstore_api_response = require "petstore.model.api_response" - --[[ Unit tests for petstore.model.api_response Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) Please update as you see appropriate ]] describe("api_response", function() + local petstore_api_response = require "petstore.model.api_response" + -- unit tests for the property 'code' describe("property code test", function() it("should work", function() diff --git a/samples/client/petstore/lua/petstore/spec/category_spec.lua b/samples/client/petstore/lua/spec/category_spec.lua similarity index 54% rename from samples/client/petstore/lua/petstore/spec/category_spec.lua rename to samples/client/petstore/lua/spec/category_spec.lua index db2d54bcb11..300e6e9339a 100644 --- a/samples/client/petstore/lua/petstore/spec/category_spec.lua +++ b/samples/client/petstore/lua/spec/category_spec.lua @@ -1,23 +1,21 @@ --[[ -Swagger Petstore - -This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. - -OpenAPI spec version: 1.0.0 -Contact: apiteam@swagger.io -Generated by: https://github.com/swagger-api/swagger-codegen.git -Swagger Codegen version: 2.4.0-SNAPSHOT - + Swagger Petstore + + This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git ]] -local petstore_category = require "petstore.model.category" - --[[ Unit tests for petstore.model.category Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) Please update as you see appropriate ]] describe("category", function() + local petstore_category = require "petstore.model.category" + -- unit tests for the property 'id' describe("property id test", function() it("should work", function() diff --git a/samples/client/petstore/lua/petstore/spec/order_spec.lua b/samples/client/petstore/lua/spec/order_spec.lua similarity index 74% rename from samples/client/petstore/lua/petstore/spec/order_spec.lua rename to samples/client/petstore/lua/spec/order_spec.lua index 2438eeea60e..03bc1ea94f8 100644 --- a/samples/client/petstore/lua/petstore/spec/order_spec.lua +++ b/samples/client/petstore/lua/spec/order_spec.lua @@ -1,23 +1,21 @@ --[[ -Swagger Petstore - -This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. - -OpenAPI spec version: 1.0.0 -Contact: apiteam@swagger.io -Generated by: https://github.com/swagger-api/swagger-codegen.git -Swagger Codegen version: 2.4.0-SNAPSHOT - + Swagger Petstore + + This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git ]] -local petstore_order = require "petstore.model.order" - --[[ Unit tests for petstore.model.order Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) Please update as you see appropriate ]] describe("order", function() + local petstore_order = require "petstore.model.order" + -- unit tests for the property 'id' describe("property id test", function() it("should work", function() diff --git a/samples/client/petstore/lua/petstore/spec/pet_api_spec.lua b/samples/client/petstore/lua/spec/pet_api_spec.lua similarity index 77% rename from samples/client/petstore/lua/petstore/spec/pet_api_spec.lua rename to samples/client/petstore/lua/spec/pet_api_spec.lua index 4b58ce314b6..e8e16229bc9 100644 --- a/samples/client/petstore/lua/petstore/spec/pet_api_spec.lua +++ b/samples/client/petstore/lua/spec/pet_api_spec.lua @@ -1,23 +1,20 @@ --[[ -Swagger Petstore - -This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. - -OpenAPI spec version: 1.0.0 -Contact: apiteam@swagger.io -Generated by: https://github.com/swagger-api/swagger-codegen.git -Swagger Codegen version: 2.4.0-SNAPSHOT - + Swagger Petstore + + This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git ]] -local petstore_pet_api = require "petstore.api.pet_api" - --[[ Unit tests for petstore.api.pet_api Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) Please update as you see appropriate ]] describe("pet_api", function() + local petstore_pet_api = require "petstore.api.pet_api" -- unit tests for add_pet describe("add_pet test", function() it("should work", function() diff --git a/samples/client/petstore/lua/petstore/spec/pet_spec.lua b/samples/client/petstore/lua/spec/pet_spec.lua similarity index 74% rename from samples/client/petstore/lua/petstore/spec/pet_spec.lua rename to samples/client/petstore/lua/spec/pet_spec.lua index 0417e368519..ee27654a9e3 100644 --- a/samples/client/petstore/lua/petstore/spec/pet_spec.lua +++ b/samples/client/petstore/lua/spec/pet_spec.lua @@ -1,23 +1,21 @@ --[[ -Swagger Petstore - -This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. - -OpenAPI spec version: 1.0.0 -Contact: apiteam@swagger.io -Generated by: https://github.com/swagger-api/swagger-codegen.git -Swagger Codegen version: 2.4.0-SNAPSHOT - + Swagger Petstore + + This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git ]] -local petstore_pet = require "petstore.model.pet" - --[[ Unit tests for petstore.model.pet Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) Please update as you see appropriate ]] describe("pet", function() + local petstore_pet = require "petstore.model.pet" + -- unit tests for the property 'id' describe("property id test", function() it("should work", function() diff --git a/samples/client/petstore/lua/petstore/spec/store_api_spec.lua b/samples/client/petstore/lua/spec/store_api_spec.lua similarity index 66% rename from samples/client/petstore/lua/petstore/spec/store_api_spec.lua rename to samples/client/petstore/lua/spec/store_api_spec.lua index c528474c90a..7b3104e0e1e 100644 --- a/samples/client/petstore/lua/petstore/spec/store_api_spec.lua +++ b/samples/client/petstore/lua/spec/store_api_spec.lua @@ -1,23 +1,20 @@ --[[ -Swagger Petstore - -This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. - -OpenAPI spec version: 1.0.0 -Contact: apiteam@swagger.io -Generated by: https://github.com/swagger-api/swagger-codegen.git -Swagger Codegen version: 2.4.0-SNAPSHOT - + Swagger Petstore + + This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git ]] -local petstore_store_api = require "petstore.api.store_api" - --[[ Unit tests for petstore.api.store_api Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) Please update as you see appropriate ]] describe("store_api", function() + local petstore_store_api = require "petstore.api.store_api" -- unit tests for delete_order describe("delete_order test", function() it("should work", function() diff --git a/samples/client/petstore/lua/petstore/spec/tag_spec.lua b/samples/client/petstore/lua/spec/tag_spec.lua similarity index 54% rename from samples/client/petstore/lua/petstore/spec/tag_spec.lua rename to samples/client/petstore/lua/spec/tag_spec.lua index 697f74f0267..5ecc2405f1f 100644 --- a/samples/client/petstore/lua/petstore/spec/tag_spec.lua +++ b/samples/client/petstore/lua/spec/tag_spec.lua @@ -1,23 +1,21 @@ --[[ -Swagger Petstore - -This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. - -OpenAPI spec version: 1.0.0 -Contact: apiteam@swagger.io -Generated by: https://github.com/swagger-api/swagger-codegen.git -Swagger Codegen version: 2.4.0-SNAPSHOT - + Swagger Petstore + + This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git ]] -local petstore_tag = require "petstore.model.tag" - --[[ Unit tests for petstore.model.tag Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) Please update as you see appropriate ]] describe("tag", function() + local petstore_tag = require "petstore.model.tag" + -- unit tests for the property 'id' describe("property id test", function() it("should work", function() diff --git a/samples/client/petstore/lua/petstore/spec/user_api_spec.lua b/samples/client/petstore/lua/spec/user_api_spec.lua similarity index 78% rename from samples/client/petstore/lua/petstore/spec/user_api_spec.lua rename to samples/client/petstore/lua/spec/user_api_spec.lua index 9c2da762f51..9cddd8dce6d 100644 --- a/samples/client/petstore/lua/petstore/spec/user_api_spec.lua +++ b/samples/client/petstore/lua/spec/user_api_spec.lua @@ -1,23 +1,20 @@ --[[ -Swagger Petstore - -This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. - -OpenAPI spec version: 1.0.0 -Contact: apiteam@swagger.io -Generated by: https://github.com/swagger-api/swagger-codegen.git -Swagger Codegen version: 2.4.0-SNAPSHOT - + Swagger Petstore + + This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git ]] -local petstore_user_api = require "petstore.api.user_api" - --[[ Unit tests for petstore.api.user_api Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) Please update as you see appropriate ]] describe("user_api", function() + local petstore_user_api = require "petstore.api.user_api" -- unit tests for create_user describe("create_user test", function() it("should work", function() diff --git a/samples/client/petstore/lua/petstore/spec/user_spec.lua b/samples/client/petstore/lua/spec/user_spec.lua similarity index 78% rename from samples/client/petstore/lua/petstore/spec/user_spec.lua rename to samples/client/petstore/lua/spec/user_spec.lua index 5088acef2fc..03c6d655e30 100644 --- a/samples/client/petstore/lua/petstore/spec/user_spec.lua +++ b/samples/client/petstore/lua/spec/user_spec.lua @@ -1,23 +1,21 @@ --[[ -Swagger Petstore - -This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. - -OpenAPI spec version: 1.0.0 -Contact: apiteam@swagger.io -Generated by: https://github.com/swagger-api/swagger-codegen.git -Swagger Codegen version: 2.4.0-SNAPSHOT - + Swagger Petstore + + This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git ]] -local petstore_user = require "petstore.model.user" - --[[ Unit tests for petstore.model.user Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) Please update as you see appropriate ]] describe("user", function() + local petstore_user = require "petstore.model.user" + -- unit tests for the property 'id' describe("property id test", function() it("should work", function()