Giter Club home page Giter Club logo

example-swagger-autogen's Introduction

example-swagger-autogen

Install the dependencies:

$ npm install

Use the command below to generate the documentation at project startup:

$ npm run start-gendoc

Use the command below to start the project without generating the documentation:

$ npm start

Run the project and access the documentation at:

http://localhost:3000/doc

Screenshots

See the result after construction:

License

MIT License

example-swagger-autogen's People

Contributors

davibaltar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

example-swagger-autogen's Issues

Compability with ES6

Hi!

I'm using your library with the node version 16.14 that uses ES6, when I execute command npm run swagger-autogen the file swagger_output.json don't generate. Do your library has compatibility for ES6?

some routes randomly ignored

Thanks for this great product, our team has been using it to generate swagger for our project.

We do have a problem though, some random routes just absolutely refuse to get output into the generated .json file.. for no apparent reason that we can find. it's maybe 3% of the routes. It's not related to the markup, the http method, or anything else we can find (we tried many variations to make them work, renaming, re-ordering, markup on top rather than at the end, etc.). In our project, it's about 7 routes out of hundreds.
No errors are shown when generating:
Swagger-autogen: Success โœ”

I'm wondering if there are any known issues with parsing the routes files?

As a quick example, in the below 4 routes (in the same routes file), only
the first one does not output. The controller methods are all built and marked up almost identically. We just can't find any reason it never gets rendered.

api.put("/v1/profiles/:profileId/preferences", updateProfilePreferences); << this is never rendered
api.get("/v1/profiles/:profileId/households", getHouseholdsByProfileId);
api.get("/v1/profiles/:profileId/preferences", getProfilePreferences);
api.post("/v1/profiles/:profileId/preferences", createProfilePreferences);

Autogen does however output the default:
"put": {
"description": "",
"parameters": [
{
"name": "profileId",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"default": {
"description": ""
}
}
}

An example of the markup style we are using:
export const createProfilePreferences = async (
req: Request,
res: Response,
next: NextFunction
): Promise => {
baseProxy.apiName = "Create Profile Preference";
baseProxy.baseUrl = config.smartHome.profiles.baseUrl;
const response = await baseProxy.basePost(req, res, next, createProfilePreferencesEndpoint);
res.json(response);
/*
#swagger.tags = ['Profile Management-Profile']
#swagger.summary = 'Create a profile Preference'
#swagger.parameters['x-unified-household-id'] = {
in: 'header',
description: 'Household Id',
required: true,
type: 'string',
example: '01HF806Q5EFZQ0354GQGKFD2AX'
}
#swagger.description = 'Create a Profile Preference'
#swagger.requestBody = {
schema: { $ref: "#/components/schemas/profilePreferences" }
}
#swagger.responses[200] = {
description: 'Create a Profile',
schema: {
$ref: "#/components/schemas/profilePreferences"
}
}
*/
};

parser ignores router with middleware

First of all, greate project. I have problems in parsing when I have routers like this:

// does not work
const Router = require('express').Router;
const route = new Router();
route.use(middleware);
...

The library not recognizes the route anymore. If I comment this out, than there is part will be showing up correctly in swagger.

// works
const Router = require('express').Router;
const route = new Router();
// route.use(middleware);
...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.