Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Lua] Remove outdated comment #1268

Merged
merged 1 commit into from
Oct 21, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions modules/openapi-generator/src/main/resources/lua/api.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,12 @@ function {{classname}}:{{operationId}}({{#allParams}}{{paramName}}{{#hasMore}},
req.headers:upsert(":method", "{{httpMethod}}")
{{#hasConsumes}}
-- TODO: create a function to select proper accept
-- ref: https://openapi-generator.tech/pull/6252#issuecomment-321199879
--local var_content_type = { {{#consumes}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/consumes}} }
req.headers:upsert("accept", {{#consumes}}{{#-first}}"{{{mediaType}}}"{{/-first}}{{/consumes}})

{{/hasConsumes}}
{{#hasProduces}}
-- TODO: create a function to select proper content-type
-- ref: https://openapi-generator.tech/pull/6252#issuecomment-321199879
--local var_accept = { {{#produces}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/produces}} }
req.headers:upsert("content-type", {{#produces}}{{#-first}}"{{{mediaType}}}"{{/-first}}{{/produces}})

Expand Down
2 changes: 1 addition & 1 deletion samples/client/petstore/lua/.openapi-generator/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.0.0-SNAPSHOT
3.3.2-SNAPSHOT
9 changes: 1 addition & 8 deletions samples/client/petstore/lua/petstore/api/pet_api.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ local basexx = require "basexx"
-- model import
local petstore_api_response = require "petstore.model.api_response"
local petstore_pet = require "petstore.model.pet"
local petstore_pet = require "petstore.model.pet"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to be an error.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@daurnimator yup, saw that too. Will fix that with another PR (the issue is not caused by this PR)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

UPDATE: I've filed
#1414 to fix the issue (duplicated imports)


local pet_api = {}
local pet_api_mt = {
Expand Down Expand Up @@ -54,7 +55,6 @@ function pet_api:add_pet(pet)
-- set HTTP verb
req.headers:upsert(":method", "POST")
-- TODO: create a function to select proper accept
-- ref: https://openapi-generator.tech/pull/6252#issuecomment-321199879
--local var_content_type = { "application/json", "application/xml" }
req.headers:upsert("accept", "application/json")

Expand Down Expand Up @@ -132,7 +132,6 @@ function pet_api:find_pets_by_status(status)
-- set HTTP verb
req.headers:upsert(":method", "GET")
-- TODO: create a function to select proper content-type
-- ref: https://openapi-generator.tech/pull/6252#issuecomment-321199879
--local var_accept = { "application/xml", "application/json" }
req.headers:upsert("content-type", "application/xml")

Expand Down Expand Up @@ -185,7 +184,6 @@ function pet_api:find_pets_by_tags(tags)
-- set HTTP verb
req.headers:upsert(":method", "GET")
-- TODO: create a function to select proper content-type
-- ref: https://openapi-generator.tech/pull/6252#issuecomment-321199879
--local var_accept = { "application/xml", "application/json" }
req.headers:upsert("content-type", "application/xml")

Expand Down Expand Up @@ -238,7 +236,6 @@ function pet_api:get_pet_by_id(pet_id)
-- set HTTP verb
req.headers:upsert(":method", "GET")
-- TODO: create a function to select proper content-type
-- ref: https://openapi-generator.tech/pull/6252#issuecomment-321199879
--local var_accept = { "application/xml", "application/json" }
req.headers:upsert("content-type", "application/xml")

Expand Down Expand Up @@ -288,7 +285,6 @@ function pet_api:update_pet(pet)
-- set HTTP verb
req.headers:upsert(":method", "PUT")
-- TODO: create a function to select proper accept
-- ref: https://openapi-generator.tech/pull/6252#issuecomment-321199879
--local var_content_type = { "application/json", "application/xml" }
req.headers:upsert("accept", "application/json")

Expand Down Expand Up @@ -329,7 +325,6 @@ function pet_api:update_pet_with_form(pet_id, name, status)
-- set HTTP verb
req.headers:upsert(":method", "POST")
-- TODO: create a function to select proper accept
-- ref: https://openapi-generator.tech/pull/6252#issuecomment-321199879
--local var_content_type = { "application/x-www-form-urlencoded" }
req.headers:upsert("accept", "application/x-www-form-urlencoded")

Expand Down Expand Up @@ -372,12 +367,10 @@ function pet_api:upload_file(pet_id, additional_metadata, file)
-- set HTTP verb
req.headers:upsert(":method", "POST")
-- TODO: create a function to select proper accept
-- ref: https://openapi-generator.tech/pull/6252#issuecomment-321199879
--local var_content_type = { "multipart/form-data" }
req.headers:upsert("accept", "multipart/form-data")

-- TODO: create a function to select proper content-type
-- ref: https://openapi-generator.tech/pull/6252#issuecomment-321199879
--local var_accept = { "application/json" }
req.headers:upsert("content-type", "application/json")

Expand Down
4 changes: 1 addition & 3 deletions samples/client/petstore/lua/petstore/api/store_api.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ local basexx = require "basexx"

-- model import
local petstore_order = require "petstore.model.order"
local petstore_order = require "petstore.model.order"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same duplication.


local store_api = {}
local store_api_mt = {
Expand Down Expand Up @@ -83,7 +84,6 @@ function store_api:get_inventory()
-- set HTTP verb
req.headers:upsert(":method", "GET")
-- TODO: create a function to select proper content-type
-- ref: https://openapi-generator.tech/pull/6252#issuecomment-321199879
--local var_accept = { "application/json" }
req.headers:upsert("content-type", "application/json")

Expand Down Expand Up @@ -133,7 +133,6 @@ function store_api:get_order_by_id(order_id)
-- set HTTP verb
req.headers:upsert(":method", "GET")
-- TODO: create a function to select proper content-type
-- ref: https://openapi-generator.tech/pull/6252#issuecomment-321199879
--local var_accept = { "application/xml", "application/json" }
req.headers:upsert("content-type", "application/xml")

Expand Down Expand Up @@ -179,7 +178,6 @@ function store_api:place_order(order)
-- set HTTP verb
req.headers:upsert(":method", "POST")
-- TODO: create a function to select proper content-type
-- ref: https://openapi-generator.tech/pull/6252#issuecomment-321199879
--local var_accept = { "application/xml", "application/json" }
req.headers:upsert("content-type", "application/xml")

Expand Down
3 changes: 1 addition & 2 deletions samples/client/petstore/lua/petstore/api/user_api.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ local basexx = require "basexx"

-- model import
local petstore_user = require "petstore.model.user"
local petstore_user = require "petstore.model.user"

local user_api = {}
local user_api_mt = {
Expand Down Expand Up @@ -179,7 +180,6 @@ function user_api:get_user_by_name(username)
-- set HTTP verb
req.headers:upsert(":method", "GET")
-- TODO: create a function to select proper content-type
-- ref: https://openapi-generator.tech/pull/6252#issuecomment-321199879
--local var_accept = { "application/xml", "application/json" }
req.headers:upsert("content-type", "application/xml")

Expand Down Expand Up @@ -225,7 +225,6 @@ function user_api:login_user(username, password)
-- set HTTP verb
req.headers:upsert(":method", "GET")
-- TODO: create a function to select proper content-type
-- ref: https://openapi-generator.tech/pull/6252#issuecomment-321199879
--local var_accept = { "application/xml", "application/json" }
req.headers:upsert("content-type", "application/xml")

Expand Down