forked from swagger-api/swagger-codegen
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add auto-generated Lua spec files for APIs, models (swagger-api#7562)
* add auto-generated lua spec files for api, models * use partial header in test files
- Loading branch information
Showing
12 changed files
with
595 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
modules/swagger-codegen/src/main/resources/lua/api_test.mustache
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
--[[ | ||
{{> 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) | ||
Please update as you see appropriate | ||
]] | ||
{{#operations}} | ||
describe("{{classname}}", function() | ||
{{#operation}} | ||
-- unit tests for {{operationId}} | ||
describe("{{operationId}} test", function() | ||
it("should work", function() | ||
-- TODO assertion here: http://olivinelabs.com/busted/#asserts | ||
end) | ||
end) | ||
|
||
{{/operation}} | ||
end) | ||
{{/operations}} |
26 changes: 26 additions & 0 deletions
26
modules/swagger-codegen/src/main/resources/lua/model_test.mustache
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
--[[ | ||
{{> 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() | ||
{{#vars}} | ||
-- unit tests for the property '{{{name}}}' | ||
describe("property {{{name}}} test", function() | ||
it("should work", function() | ||
-- TODO assertion here: http://olivinelabs.com/busted/#asserts | ||
end) | ||
end) | ||
|
||
{{/vars}} | ||
end) | ||
{{/model}} | ||
{{/models}} |
42 changes: 42 additions & 0 deletions
42
samples/client/petstore/lua/petstore/spec/api_response_spec.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
--[[ | ||
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 | ||
]] | ||
|
||
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() | ||
-- unit tests for the property 'code' | ||
describe("property code test", function() | ||
it("should work", function() | ||
-- TODO assertion here: http://olivinelabs.com/busted/#asserts | ||
end) | ||
end) | ||
|
||
-- unit tests for the property 'type' | ||
describe("property type test", function() | ||
it("should work", function() | ||
-- TODO assertion here: http://olivinelabs.com/busted/#asserts | ||
end) | ||
end) | ||
|
||
-- unit tests for the property 'message' | ||
describe("property message test", function() | ||
it("should work", function() | ||
-- TODO assertion here: http://olivinelabs.com/busted/#asserts | ||
end) | ||
end) | ||
|
||
end) |
35 changes: 35 additions & 0 deletions
35
samples/client/petstore/lua/petstore/spec/category_spec.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
--[[ | ||
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 | ||
]] | ||
|
||
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() | ||
-- unit tests for the property 'id' | ||
describe("property id test", function() | ||
it("should work", function() | ||
-- TODO assertion here: http://olivinelabs.com/busted/#asserts | ||
end) | ||
end) | ||
|
||
-- unit tests for the property 'name' | ||
describe("property name test", function() | ||
it("should work", function() | ||
-- TODO assertion here: http://olivinelabs.com/busted/#asserts | ||
end) | ||
end) | ||
|
||
end) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
--[[ | ||
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 | ||
]] | ||
|
||
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() | ||
-- unit tests for the property 'id' | ||
describe("property id test", function() | ||
it("should work", function() | ||
-- TODO assertion here: http://olivinelabs.com/busted/#asserts | ||
end) | ||
end) | ||
|
||
-- unit tests for the property 'pet_id' | ||
describe("property pet_id test", function() | ||
it("should work", function() | ||
-- TODO assertion here: http://olivinelabs.com/busted/#asserts | ||
end) | ||
end) | ||
|
||
-- unit tests for the property 'quantity' | ||
describe("property quantity test", function() | ||
it("should work", function() | ||
-- TODO assertion here: http://olivinelabs.com/busted/#asserts | ||
end) | ||
end) | ||
|
||
-- unit tests for the property 'ship_date' | ||
describe("property ship_date test", function() | ||
it("should work", function() | ||
-- TODO assertion here: http://olivinelabs.com/busted/#asserts | ||
end) | ||
end) | ||
|
||
-- unit tests for the property 'status' | ||
describe("property status test", function() | ||
it("should work", function() | ||
-- TODO assertion here: http://olivinelabs.com/busted/#asserts | ||
end) | ||
end) | ||
|
||
-- unit tests for the property 'complete' | ||
describe("property complete test", function() | ||
it("should work", function() | ||
-- TODO assertion here: http://olivinelabs.com/busted/#asserts | ||
end) | ||
end) | ||
|
||
end) |
77 changes: 77 additions & 0 deletions
77
samples/client/petstore/lua/petstore/spec/pet_api_spec.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
--[[ | ||
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 | ||
]] | ||
|
||
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() | ||
-- unit tests for add_pet | ||
describe("add_pet test", function() | ||
it("should work", function() | ||
-- TODO assertion here: http://olivinelabs.com/busted/#asserts | ||
end) | ||
end) | ||
|
||
-- unit tests for delete_pet | ||
describe("delete_pet test", function() | ||
it("should work", function() | ||
-- TODO assertion here: http://olivinelabs.com/busted/#asserts | ||
end) | ||
end) | ||
|
||
-- unit tests for find_pets_by_status | ||
describe("find_pets_by_status test", function() | ||
it("should work", function() | ||
-- TODO assertion here: http://olivinelabs.com/busted/#asserts | ||
end) | ||
end) | ||
|
||
-- unit tests for find_pets_by_tags | ||
describe("find_pets_by_tags test", function() | ||
it("should work", function() | ||
-- TODO assertion here: http://olivinelabs.com/busted/#asserts | ||
end) | ||
end) | ||
|
||
-- unit tests for get_pet_by_id | ||
describe("get_pet_by_id test", function() | ||
it("should work", function() | ||
-- TODO assertion here: http://olivinelabs.com/busted/#asserts | ||
end) | ||
end) | ||
|
||
-- unit tests for update_pet | ||
describe("update_pet test", function() | ||
it("should work", function() | ||
-- TODO assertion here: http://olivinelabs.com/busted/#asserts | ||
end) | ||
end) | ||
|
||
-- unit tests for update_pet_with_form | ||
describe("update_pet_with_form test", function() | ||
it("should work", function() | ||
-- TODO assertion here: http://olivinelabs.com/busted/#asserts | ||
end) | ||
end) | ||
|
||
-- unit tests for upload_file | ||
describe("upload_file test", function() | ||
it("should work", function() | ||
-- TODO assertion here: http://olivinelabs.com/busted/#asserts | ||
end) | ||
end) | ||
|
||
end) |
Oops, something went wrong.