Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
Repo info
  • Nov 27 07:09
    bricss commented #837
  • Nov 22 17:10
    dominicrico commented #838
  • Nov 21 06:15
    baophamtd commented #838
  • Nov 12 20:43
    agnoam opened #838
  • Nov 12 15:09
    lyair1 commented #837
  • Oct 29 13:24
    RafDevX edited #837
  • Oct 29 13:19
    RafDevX opened #837
  • Oct 26 21:57
    brianphillips commented #833
  • Oct 24 08:19
    jonaskello commented #836
  • Oct 24 07:10
    jonaskello edited #836
  • Oct 24 07:05
    jonaskello opened #836
  • Oct 21 22:03
    NoodleOfDeath synchronize #835
  • Oct 21 16:55
    NoodleOfDeath synchronize #835
  • Oct 21 16:54
    NoodleOfDeath synchronize #835
  • Oct 21 16:50
    NoodleOfDeath synchronize #835
  • Oct 21 16:42
    NoodleOfDeath opened #835
  • Oct 06 12:54
    fabien-renaud opened #834
  • Oct 01 07:19
    jsdevel commented #833
  • Sep 29 15:30
    itswoop commented #765
  • Sep 21 05:53
    tvardy opened #833
Benjamin GARDIEN
Hello :)
Joe Spencer
Sebastien Pereira
I am trying to get the swagger UI working with express-open-api
could not find a sample that illustrates how to do this
Sebastien Pereira

So I tried using the module swagger-ui-express

    const jsyaml = require('js-yaml');
    const swaggerUi = require('swagger-ui-express');
    const apiDoc = fs.readFileSync(path.resolve(__dirname, 'spec/rest.yaml'), 'utf8');
    app.use('/swagger-ui', swaggerUi.serve, swaggerUi.setup(apiDoc));

Swagger ui displays, but displays the error "Failed to load API definition"

Does anyone managed to successfully display swagger ui with express-openapi?
Sebastien Pereira
found it ;)
Solution simply was to point to the spec...
    const swaggerUi = require('swagger-ui-express');
    app.use('/swagger-ui', swaggerUi.serve, swaggerUi.setup(null, {
        swaggerUrl: '/api/v1/api-spec'
Sebastien Pereira
Openapi spec allows to override servers at path item and operation objects level. It does not seem to be supported by express-open-api.
Sebastien Pereira
Trying to run test as documented in README, but it hangs forever on 0 passing (0ms)
open-api[master]$ ./bin/test packages/express-openapi
+ export PATH=[…]
+ PATH=[…]
+ dir=packages/express-openapi
+ [[ -n packages/express-openapi ]]
+ shift
+ test_package packages/express-openapi test-watch
+ pushd packages/express-openapi
+ shift
+ npm i

> express-openapi@4.5.0 prepare […]/open-api/packages/express-openapi
> tsc

audited 122 packages in 2.633s
found 1 moderate severity vulnerability
  run `npm audit fix` to fix them, or `npm audit` for details
+ npm run test-watch

> express-openapi@4.5.0 test-watch […]/open-api/packages/express-openapi
> tsc && mocha --watch-extensions ts -w

  0 passing (0ms)
Any idea what's going wrong?
Joe Spencer
@seb-pereira that's because it's watching your files!
try making a modification
Elliot Lee
Hey! I'm trying to understand how express-openapi is meant to be used. Let's say I've defined my paths in separate files, setting GET.apiDoc etc. How can I open my API spec in SwaggerHub, or generate documentation from it? Is there a way to "export" my spec to a json or yaml file?
For example, take the Getting Started example: https://github.com/kogosoftwarellc/open-api/tree/master/packages/express-openapi#getting-started - how do I actually get a spec that I can test out with the Swagger UI?
Joel Berger
is that timestamp correct, was the last message May 15th?
I guess this isn't the preferred communication method then
Richard Flosi
Has anyone used express-openapi in a serverless environment? I’m looking into using it with Netlify Functions, but not sure running an express app will introduce overhead in the functions or if there is a way to reduce that overhead.
Eisa Nodehi

Hi everyone.
Is there any npm package to make an API doc from the jsDoc comments?


* get a user from the application
router.get('/user', (req, res) => { res.json(db.user(req.params.id)) })

To be testable and have API doc?

good morning
using express-openapi how I can define the ServiceName different from the "default"?