Skip to content

library is not picking up the paths in my express application #30

@jamesone

Description

@jamesone

My openapi.helper.ts file (which is located in: src/helpers/:

import oapi from '@wesleytodd/openapi';

const openapi = oapi({
  openapi: '1.0.0',
  info: {
    title: 'Rest Docs',
    version: '1.0.0',
    description: 'Rest description,
  },
});

export default openapi;

Then inside my express app configuration file located in: src/app.ts, I am passing the openapi export to the app.use:

Note my routes are on v1/

app.use('/v1/', routes);
app.use(openapi);

I also tried:

app.use('/v1/', openapi, routes);

I also tried adding adding openapi to my routes export. routes.use(openapi) but it still couldn't pick up the paths, like so:

routes.ts:

routes.use(`/myrouter`, openapi, farmRouter);

When trying to visit the <path>/openapi.json, it always returns an empty 'paths' object.

{
    "openapi": "1.0.0",
    "info": {
       title: 'Rest Docs',
    version: '1.0.0',
    description: 'Rest description,
     },
    "paths": {}
}

The libs I am using are:

I am using nodejs 16 & "express": "^4.17.1",, "@wesleytodd/openapi": "^0.1.0",

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions