forked from loafle/openapi-generator-original
* 1st commit of lua generator * add petstore sample * various fixes based on feedback * better return handling * check status code 1st letter * add support for query parameters, auth, body param * more fixes based on daurnimator feedback * more fixes based on daurnimator feedback * fix a few more issues found by luac -p * use lower case for http header key name * more fixes based on feedback * update lua sample * skip auto-generated readme, doc, test files * use tab instead of 2-space * fix container return type * fix cast method call * fix cast function call
39 lines
960 B
Lua
39 lines
960 B
Lua
--[[
|
|
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
|
|
]]
|
|
|
|
-- user class
|
|
local user = {}
|
|
local user_mt = {
|
|
__name = "user";
|
|
__index = user;
|
|
}
|
|
|
|
local function cast_user(t)
|
|
return setmetatable(t, user_mt)
|
|
end
|
|
|
|
local function new_user(id, username, first_name, last_name, email, password, phone, user_status)
|
|
return cast_user({
|
|
["id"] = id;
|
|
["username"] = username;
|
|
["firstName"] = first_name;
|
|
["lastName"] = last_name;
|
|
["email"] = email;
|
|
["password"] = password;
|
|
["phone"] = phone;
|
|
["userStatus"] = user_status;
|
|
})
|
|
end
|
|
|
|
return {
|
|
cast = cast_user;
|
|
new = new_user;
|
|
}
|