Cleaned up the loaders

ref #11
This commit is contained in:
2020-12-05 19:09:08 +01:00
parent a3a809bb40
commit f58a715c45
4 changed files with 19 additions and 4 deletions

View File

@@ -4,11 +4,16 @@ import { getMetadataArgsStorage } from "routing-controllers";
import { routingControllersToSpec } from "routing-controllers-openapi";
import * as swaggerUiExpress from "swagger-ui-express";
/**
* Loader for everything openapi related - from creating the schema to serving it via a static route.
*/
export default async (app: Application) => {
const storage = getMetadataArgsStorage();
const schemas = validationMetadatasToSchemas({
refPointerPrefix: "#/components/schemas/",
});
//Spec creation based on the previously created schemas
const spec = routingControllersToSpec(
storage,
{
@@ -32,6 +37,8 @@ export default async (app: Application) => {
},
}
);
//Options for swaggerUiExpress
const options = {
explorer: true,
};