I\'m trying to open my self generated swagger specification file my.json with swagger-ui on my local computer.
So I downloaded the latest tag v2.1.8-M1
Use the spec parameter.
Instructions below.
Create a new javascript file in the same directory as index.html (/dist/)
Then insert spec variable declaration:
var spec =
Then paste in the swagger.json file contents after. It does not have to be on the same line as the = sign.
Example:
var spec =
{
"swagger": "2.0",
"info": {
"title": "I love Tex-Mex API",
"description": "You can barbecue it, boil it, broil it, bake it, sauté it. Dey's uh, Tex-Mex-kabobs, Tex-Mex creole, Tex-Mex gumbo. Pan fried, deep fried, stir-fried. There's pineapple Tex-Mex, lemon Tex-Mex, coconut Tex-Mex, pepper Tex-Mex, Tex-Mex soup, Tex-Mex stew, Tex-Mex salad, Tex-Mex and potatoes, Tex-Mex burger, Tex-Mex sandwich..",
"version": "1.0.0"
},
...
}
}
This is a two-step like Ciara.
Modify the /dist/index.html file to include the external spec.js file.
Example: