Generic Commit; Most likely a fix or small feature
This commit is contained in:
11
src/index.ts
11
src/index.ts
@@ -1,4 +1,6 @@
|
|||||||
import { logInfo } from "@dpu/shared/dist/logger.js";
|
import { logInfo } from "@dpu/shared/dist/logger.js";
|
||||||
|
import fastifySwagger from "@fastify/swagger";
|
||||||
|
import fastifySwaggerUi from "@fastify/swagger-ui";
|
||||||
import type { FastifyReply, FastifyRequest } from "fastify";
|
import type { FastifyReply, FastifyRequest } from "fastify";
|
||||||
import Fastify from "fastify";
|
import Fastify from "fastify";
|
||||||
import fastifyAxios from "fastify-axios";
|
import fastifyAxios from "fastify-axios";
|
||||||
@@ -7,7 +9,7 @@ import {
|
|||||||
validatorCompiler,
|
validatorCompiler,
|
||||||
type ZodTypeProvider,
|
type ZodTypeProvider,
|
||||||
} from "fastify-type-provider-zod";
|
} from "fastify-type-provider-zod";
|
||||||
import z from "zod";
|
import { z } from "zod";
|
||||||
import { Config } from "./config.js";
|
import { Config } from "./config.js";
|
||||||
import { HomeAssistantClient } from "./homeassistant/client.js";
|
import { HomeAssistantClient } from "./homeassistant/client.js";
|
||||||
import { homeAssistantRoutes } from "./homeassistant/routes.js";
|
import { homeAssistantRoutes } from "./homeassistant/routes.js";
|
||||||
@@ -21,7 +23,7 @@ const fastify = Fastify().withTypeProvider<ZodTypeProvider>();
|
|||||||
fastify.setValidatorCompiler(validatorCompiler);
|
fastify.setValidatorCompiler(validatorCompiler);
|
||||||
fastify.setSerializerCompiler(serializerCompiler);
|
fastify.setSerializerCompiler(serializerCompiler);
|
||||||
|
|
||||||
await fastify.register(require("@fastify/swagger"), {
|
await fastify.register(fastifySwagger, {
|
||||||
openapi: {
|
openapi: {
|
||||||
info: {
|
info: {
|
||||||
title: "DPU API",
|
title: "DPU API",
|
||||||
@@ -30,12 +32,9 @@ await fastify.register(require("@fastify/swagger"), {
|
|||||||
},
|
},
|
||||||
servers: [{ url: "http://localhost:8080", description: "Development" }],
|
servers: [{ url: "http://localhost:8080", description: "Development" }],
|
||||||
},
|
},
|
||||||
transform: ({ schema, url }: { schema: unknown; url: string }) => {
|
|
||||||
return { schema, url };
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
|
||||||
await fastify.register(require("@fastify/swagger-ui"), {
|
await fastify.register(fastifySwaggerUi, {
|
||||||
routePrefix: "/docs",
|
routePrefix: "/docs",
|
||||||
uiConfig: {
|
uiConfig: {
|
||||||
docExpansion: "list",
|
docExpansion: "list",
|
||||||
|
|||||||
Reference in New Issue
Block a user