Skip to content

Commit

Permalink
Merge pull request #243 from cweave/schema-sort
Browse files Browse the repository at this point in the history
add a=>z sorting with swaggerOptions
  • Loading branch information
ageddesi committed Oct 19, 2022
2 parents db11dde + bc00515 commit 5621ab8
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,18 @@ app.get('/docs.json', (req: Request, res: Response) => {
res.send(swaggerSpec);
});


const schemaOptions = {
swaggerOptions: {
dom_id: "#swagger-ui",
tagsSorter: "alpha",
operationsSorter: "alpha"
}
};

// Setup Swagger API Documentation
const swaggerUi = require('swagger-ui-express');
app.use('/', swaggerUi.serve, swaggerUi.setup(swaggerSpec));
app.use('/', swaggerUi.serve, swaggerUi.setup(swaggerSpec, schemaOptions));

app.use(cors()); // enabling CORS for all requests
app.use(morgan('combined')); // adding morgan to log HTTP requests
Expand Down

0 comments on commit 5621ab8

Please sign in to comment.