next-rest-framework
Advanced tools
Comparing version
@@ -75,4 +75,10 @@ #!/usr/bin/env node | ||
const getCleanedRpcApiRoutes = (files) => files.filter((file) => file.endsWith('rpc/[operationId].ts')); | ||
const isPathItem = (obj) => typeof obj === 'object'; | ||
const isNrfOasData = (x) => { | ||
if (typeof x !== 'object' || x === null) { | ||
return false; | ||
} | ||
return 'paths' in x; | ||
}; | ||
let paths = {}; | ||
let schemas = {}; | ||
try { | ||
@@ -91,4 +97,5 @@ // Scan `app` folder. | ||
const data = handler._getPaths((0, shared_1.getRouteName)(route)); | ||
if (isPathItem(data)) { | ||
paths = { ...paths, ...data }; | ||
if (isNrfOasData(data)) { | ||
paths = { ...paths, ...data.paths }; | ||
schemas = { ...schemas, ...data.schemas }; | ||
} | ||
@@ -112,4 +119,5 @@ }); | ||
const data = res.default._getPaths((0, shared_1.getApiRouteName)(apiRoute)); | ||
if (isPathItem(data)) { | ||
paths = { ...paths, ...data }; | ||
if (isNrfOasData(data)) { | ||
paths = { ...paths, ...data.paths }; | ||
schemas = { ...schemas, ...data.schemas }; | ||
} | ||
@@ -125,3 +133,6 @@ })); | ||
} | ||
return { paths }; | ||
return { | ||
paths, | ||
schemas | ||
}; | ||
}; | ||
@@ -128,0 +139,0 @@ const findConfig = async ({ distDir, configPath }) => { |
{ | ||
"name": "next-rest-framework", | ||
"version": "4.1.0", | ||
"version": "4.1.1", | ||
"description": "Next REST Framework - Type-safe, self-documenting APIs for Next.js", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
Sorry, the diff of this file is not supported yet
236220
0.13%2532
0.44%