Comparison

mod_rest/apidemo.lib.lua @ 4528:fd15e7f00ff5

mod_rest: Move openapi spec into res/ dir to get it included in rocks
author Kim Alvefur <zash@zash.se>
date Tue, 23 Mar 2021 20:27:44 +0100
parent 4498:1776831d0fab
child 4550:0befc680970b
comparison
equal deleted inserted replaced
4527:9a6aaba3d5ef 4528:fd15e7f00ff5
18 -- SUCH HACK, VERY GSUB, WOW! 18 -- SUCH HACK, VERY GSUB, WOW!
19 index = index:gsub("(%s?url%s*:%s*)%b\"\"", string.format("%%1%q", module:http_url().."/demo/openapi.yaml"), 1); 19 index = index:gsub("(%s?url%s*:%s*)%b\"\"", string.format("%%1%q", module:http_url().."/demo/openapi.yaml"), 1);
20 end 20 end
21 21
22 do 22 do
23 local f = module:load_resource("openapi.yaml"); 23 local f = module:load_resource("res/openapi.yaml");
24 _M.schema = { 24 _M.schema = {
25 headers = { 25 headers = {
26 content_type = "text/x-yaml"; 26 content_type = "text/x-yaml";
27 }; 27 };
28 body = f:read("*a"); 28 body = f:read("*a");