bootprint / bootprint

Converts json into a static html page using Handlebars and Bootstrap, this repository has moved to https://github.com/bootprint/bootprint-monorepo/tree/master/packages/bootprint
MIT License
60 stars 13 forks source link

Command line does not work for YAML or JSON #12

Closed Vinoth-Rajasekaran closed 8 years ago

Vinoth-Rajasekaran commented 8 years ago

Hi there,

As per the instructions, I installed npm install -g bootprint npm install -g bootprint-swagger

Both of the above step completed without errors.

Ran below command, petstore.yaml and petstore.json are downloaded to the current directory. temp folder is in place. bootprint swagger petstore.yaml temp below outputs the following

Loading bootprint-swagger 0.13.1 Loading bootprint-json-schema 0.8.4 Loading bootprint-base 0.6.3

No errors in the -l mode as well. But the temp folder is empty. I'm running Ubuntu within VirtualBox running on Windows and no internet connection? Anything I'm missing or is it is a bug?

Thanks, Vinoth

stevelacey commented 8 years ago

Yeah no idea how to use this, I do get this error with -l though:

bootprint swagger http://petstore.swagger.io/v2/swagger.json . -l                                                                                                                                                                                                                                      

/Users/steve/.nvm/v0.10.40/lib/node_modules/bootprint/node_modules/trace/trace.js:3
const chain = require('stack-chain');
^^^^^
SyntaxError: Use of const in strict mode.
mtraynham commented 8 years ago

Also not seeing any output here, but I'm using the JS API. I'm on Linux Mint 17.3, tried using Node v0.12.9 & v5.4.0.

gnidan commented 8 years ago

Same. I can't manage to get any output from either the JS API or the CLI

nknapp commented 8 years ago

Oh, I have a suspicion. I have published "q-deep" yesterday. Although all tests were green... I have to check. Thanks for the reports and sorry for any inconvenience.

nknapp commented 8 years ago

There was an issue with deep-aplus (which is a new package which I published a short while ago). The deep resolute would hang if an empty array or an empty object was passed to this package.

I have added a testcase to deep-aplus and I have created an integration tests that installs and runs bootprint from scratch in TravisCI.

nknapp commented 8 years ago

You have to update your dependencies and make sure that deep-aplus@1.0.2 is used.

Vinoth-Rajasekaran commented 8 years ago

Still no luck, reinstalled bootprint and bootprint-swagger, checked the version of deep-aplus and it is 1.0.2. No new errors, but static html is not created

stevelacey commented 8 years ago

Ah, I have managed to get it to work like so:

npm install bootprint bootprint-swagger deep-aplus@1.0.2
node_modules/bootprint/bin/bootprint.js swagger http://petstore.swagger.io/v2/swagger.json target

Loading bootprint-swagger 0.13.1
Loading bootprint-json-schema 0.8.4
Loading bootprint-base 0.6.3
[ 'target/index.html', 'target/main.css', 'target/main.css.map' ]

I can't get it to use my Django-Rest-Swagger install though because Swagger 1.2, I am guessing this requires 2.0 :disappointed:

{
    info: {
        description: "",
        license: "",
        title: "",
        contact: "",
        termsOfServiceUrl: "",
        licenseUrl: ""
    },
    basePath: "https://example.com/docs/api-docs",
    swaggerVersion: "1.2",
    apiVersion: "",
    apis: [
        { path: "/api/organizations" },
        { path: "/api/users" }
    ]
}
Vinoth-Rajasekaran commented 8 years ago

Thanks Steve, With below syntax node_modules/bootprint/bin/bootprint.js swagger http://petstore.swagger.io/v2/swagger.json target I'm able to generate static HTML for both JSON and YAML files.

nknapp commented 8 years ago

I might be necessary to clear the cache with npm cache clear and to remove bootprint and bootprint-swagger globally. Otherwise you can't be sure that the correct version of deep-aplus is really used as dependency of the globally installed bootprint.

About Swagger 1.2: I have not tried it yet, but the swagger-tools module seems to be able to convert 1.2 to 2.0. I do not intend to add native support for Swagger 1.2 It would also be possible to create another bootprint-package that dependents on bootprint-swagger and adds a custom preprocessor. But I would not wish to increase the install size (and download time) of bootprint-swagger more than necessary.