-
Notifications
You must be signed in to change notification settings - Fork 36
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
Any plans to include UI docs with Exegesis #19
Comments
Yeah, I've been putting some thought into that. Locally right now, I'm hacking this with: // Import absolute-path directly to get around
// https://github.com/swagger-api/swagger-ui/issues/4502
import pathToSwaggerUi from 'swagger-ui-dist/absolute-path';
...
const router = new express.Router();
router.get('/openapi.json', (req, res) =>
loadOpenapiDoc()
.then(doc => res.json(doc))
.catch(err => res.status(500).end(err.message))
);
router.get('/openapi.yaml', (req, res) =>
loadOpenapiDoc()
.then(doc => res.end(yaml.safeDump(doc)))
.catch(err => res.status(500).end(err.message))
);
router.use('/', express.static(pathToSwaggerUi()));
router.use(await exegesisExpress.middleware(...)); which exposes the UI at "/" ( So my plan was to make an |
Wish I seen this comment a bit earlier before hacking a solution. I spent some time going through Swagger-UI and different repos/solutions. I put together a very quick solution that doesn't even use the router.
In the code above swaggerUI is a typescript file with a single function returning a HTML string of the swagger docs. |
The following github repo may help: Update: The plugin worked a treat once I figured out the URL had to end with a / in the browser. |
I have seen other OpenAPI/Swagger frameworks which provide a live documented version of the API usually located at the '/ui' path. I believe this is achieved using swagger-ui.
Would this be possible to include functionality for this with Exegesis as an optional feature? I would be happy to help via PR's
Story:
As a Developer, I want to have the option for generating a UI docs page so that when needed, developers won't have to code it themselves.
The text was updated successfully, but these errors were encountered: