twskj / pretty-swag

Pretty UI for Swagger spec
MIT License
122 stars 20 forks source link

Issue with offline format #43

Closed mygitmansoor closed 6 years ago

mygitmansoor commented 6 years ago

I keep getting below error when I use the format as "offline". Thanks for your help in advance.

Error:

ReferenceError: Path is not defined
    at mkdirpSync (C:\java_workspace\works\node_modules\livedoc\livedoc.js:1013:31)
    at makeOffline (C:\java_workspace\works\node_modules\livedoc\livedoc.js:1080:5)
    at Object.generateHTML (C:\java_workspace\works\node_modules\livedoc\livedoc.js:1287:9)
    at C:\HBC\java_workspace\works\node_modules\pretty-swag\pretty-swag.js:640:21
    at C:\HBC\java_workspace\works\node_modules\call-me-maybe\index.js:11:28
    at _combinedTickCallback (internal/process/next_tick.js:73:7)
    at process._tickCallback (internal/process/next_tick.js:104:9)

Thanks,

twskj commented 6 years ago

Can you try v0.1.127 and let me know?

mygitmansoor commented 6 years ago

Its creating file but Node.js control never return back, it just gets hung. HTML is missing 'Try this operation button' by default its coming expanded and hide link is missing

Thanks,

twskj commented 6 years ago

I rolled out a new version. Try it out and let me know.

mygitmansoor commented 6 years ago

Thanks it works but still Try This Operation button is missing.

Thanks, Mansoor.

On Mon, Oct 9, 2017 at 11:50 AM tj notifications@github.com wrote:

I rolled out a new version. Try it out and let me know.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/twskj/pretty-swag/issues/43#issuecomment-335199026, or mute the thread https://github.com/notifications/unsubscribe-auth/AfEh3n4MIktlib0-RvFDEc1ogDVl0Viqks5sqkCxgaJpZM4Pw6GW .

--

twskj commented 6 years ago

I don't see it from my side. Can you share how do you generate it again?

image

mygitmansoor commented 6 years ago

Below is my code and html screen print.

Code:

const

prettySwag = require('pretty-swag');

config = {};

config.format = "SingleFile";

config.markdown = true;

config.fixedNav = true;

config.autoTags = true;

config.theme = {

"default" : "blue",

"GET" : "blue",

"POST" : "indigo",

"DELETE" : "red",

"PUT" : "amber"

};

input = "input.json";

output = "doc.html";

prettySwag.run(input, output, config, function(err) {

if (err) {

console.log(err);

} else {

console.log("success");

}

});

var http = require('http'),

fs = require('fs');

http.createServer(function(request, response) {

console.log(request.url);

if (request.url == '/index.html' || request.url == '/') {

fs.readFile('doc.html', function(err, data) {

if (err) {

throw err;

}

response.writeHeader(200, {

"Content-Type" : "text/html"

});

console.log(data);

response.write(data);

response.end();

});

}

}).listen(8000);

Screen print:

[image: Inline image 1]

Thanks,

Mansoor

On Tue, Oct 10, 2017 at 3:40 PM, tj notifications@github.com wrote:

I don't see it from my side. Can you share how you generate it again?

[image: image] https://user-images.githubusercontent.com/25628219/31406959-d5a833c6-adc8-11e7-8192-30328a51bde5.png

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/twskj/pretty-swag/issues/43#issuecomment-335584897, or mute the thread https://github.com/notifications/unsubscribe-auth/AfEh3h9mbcnedsMEGHocMANGXLXINn-Sks5sq8gqgaJpZM4Pw6GW .

-- Regrads, Mansoor.MD, Software Engg, SPI-9844978315, mansoor_711@yahoo.com.

twskj commented 6 years ago

I used the snippet you provided but still cannot reproduce the bug you are seeing. Maybe it is browser related? What browser and what version you are using? Can you also send me the doc.html too and that would help me understand the problem.

Also, could you make sure you are using the latest version? Thanks

twskj commented 6 years ago

Reported fixed.