mirror of
https://github.com/AmruthPillai/Reactive-Resume.git
synced 2026-07-25 17:34:52 +10:00
📦 v5.0.7 - Changelog: https://docs.rxresu.me/changelog (#2696)
This commit is contained in:
@@ -1,7 +1,13 @@
|
||||
import { createFileRoute } from "@tanstack/react-router";
|
||||
import { auth } from "@/integrations/auth/config";
|
||||
|
||||
function handler({ request }: { request: Request }) {
|
||||
async function handler({ request }: { request: Request }) {
|
||||
if (request.method === "GET" && request.url.endsWith("/spec.json")) {
|
||||
const spec = await auth.api.generateOpenAPISchema();
|
||||
|
||||
return Response.json(spec);
|
||||
}
|
||||
|
||||
return auth.handler(request);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,25 +2,28 @@ import { SmartCoercionPlugin } from "@orpc/json-schema";
|
||||
import { OpenAPIGenerator } from "@orpc/openapi";
|
||||
import { OpenAPIHandler } from "@orpc/openapi/fetch";
|
||||
import { onError } from "@orpc/server";
|
||||
import { RequestHeadersPlugin } from "@orpc/server/plugins";
|
||||
import { BatchHandlerPlugin, RequestHeadersPlugin, StrictGetMethodPlugin } from "@orpc/server/plugins";
|
||||
import { ZodToJsonSchemaConverter } from "@orpc/zod/zod4";
|
||||
import { createFileRoute } from "@tanstack/react-router";
|
||||
import router from "@/integrations/orpc/router";
|
||||
import { resumeDataSchema } from "@/schema/resume/data";
|
||||
import { env } from "@/utils/env";
|
||||
import { getLocale } from "@/utils/locale";
|
||||
|
||||
const openAPIHandler = new OpenAPIHandler(router, {
|
||||
plugins: [
|
||||
new BatchHandlerPlugin(),
|
||||
new RequestHeadersPlugin(),
|
||||
new StrictGetMethodPlugin(),
|
||||
new SmartCoercionPlugin({
|
||||
schemaConverters: [new ZodToJsonSchemaConverter()],
|
||||
}),
|
||||
],
|
||||
interceptors: [
|
||||
onError((error) => {
|
||||
console.error(`ERROR [OpenAPI]: ${error}`);
|
||||
}),
|
||||
],
|
||||
plugins: [
|
||||
new RequestHeadersPlugin(),
|
||||
new SmartCoercionPlugin({
|
||||
schemaConverters: [new ZodToJsonSchemaConverter()],
|
||||
}),
|
||||
],
|
||||
});
|
||||
|
||||
const openAPIGenerator = new OpenAPIGenerator({
|
||||
@@ -34,13 +37,16 @@ async function handler({ request }: { request: Request }) {
|
||||
const spec = await openAPIGenerator.generate(router, {
|
||||
info: {
|
||||
title: "Reactive Resume",
|
||||
version: "5.0.0",
|
||||
version: __APP_VERSION__,
|
||||
description: "Reactive Resume API",
|
||||
license: { name: "MIT", url: "https://github.com/amruthpillai/reactive-resume/blob/main/LICENSE" },
|
||||
contact: { name: "Amruth Pillai", email: "hello@amruthpillai.com", url: "https://amruthpillai.com" },
|
||||
},
|
||||
servers: [{ url: `${env.APP_URL}/api/openapi` }],
|
||||
externalDocs: { url: "https://docs.rxresu.me", description: "Reactive Resume Documentation" },
|
||||
commonSchemas: {
|
||||
ResumeData: { schema: resumeDataSchema },
|
||||
},
|
||||
components: {
|
||||
securitySchemes: {
|
||||
apiKey: {
|
||||
|
||||
+12
-2
@@ -1,17 +1,27 @@
|
||||
import { onError } from "@orpc/server";
|
||||
import { RPCHandler } from "@orpc/server/fetch";
|
||||
import { BatchHandlerPlugin, RequestHeadersPlugin } from "@orpc/server/plugins";
|
||||
import {
|
||||
BatchHandlerPlugin,
|
||||
RequestHeadersPlugin,
|
||||
SimpleCsrfProtectionHandlerPlugin,
|
||||
StrictGetMethodPlugin,
|
||||
} from "@orpc/server/plugins";
|
||||
import { createFileRoute } from "@tanstack/react-router";
|
||||
import router from "@/integrations/orpc/router";
|
||||
import { getLocale } from "@/utils/locale";
|
||||
|
||||
const rpcHandler = new RPCHandler(router, {
|
||||
plugins: [
|
||||
new BatchHandlerPlugin(),
|
||||
new RequestHeadersPlugin(),
|
||||
new StrictGetMethodPlugin(),
|
||||
new SimpleCsrfProtectionHandlerPlugin(),
|
||||
],
|
||||
interceptors: [
|
||||
onError((error) => {
|
||||
console.error(`ERROR [oRPC]: ${error}`);
|
||||
}),
|
||||
],
|
||||
plugins: [new BatchHandlerPlugin(), new RequestHeadersPlugin()],
|
||||
});
|
||||
|
||||
async function handler({ request }: { request: Request }) {
|
||||
|
||||
Reference in New Issue
Block a user