blomqma / next-rest-framework

Type-safe, self-documenting APIs for Next.js
https://next-rest-framework.vercel.app
Other
159 stars 20 forks source link

Not Working on Next Js App router #182

Open Eyuelb opened 1 month ago

Eyuelb commented 1 month ago

npx next-rest-framework validate is not working

"custom-generate-openapi": "npx tsx ./scripts/custom-generate-openapi.ts",

import { generate } from 'next-rest-framework/dist/cli/generate';

generate({ configPath: '/api/v2' })
  .then(() => {
    console.log('Completed building OpenAPI schema from custom script.');
  })
  .catch(console.error);

res: A configPath parameter with a value of /api/v2 was provided but no Next REST Framework configs were found.

"custom-validate-openapi": "npx tsx ./scripts/custom-validate-openapi.ts"

import { validate } from 'next-rest-framework/dist/cli/validate';

validate({ configPath: '/api/v2' })
  .then(() => {
    console.log('Completed validating OpenAPI schema from custom script.');
  })
  .catch(console.error);
// app/api/v2/route.ts

import { docsRoute } from "next-rest-framework";
export const { GET } = docsRoute({
});

"next": "14.2.8", "typescript": "^5.6.2",

xzenon commented 1 month ago

npx next-rest-framework validate is not working

"custom-generate-openapi": "npx tsx ./scripts/custom-generate-openapi.ts",

import { generate } from 'next-rest-framework/dist/cli/generate';

generate({ configPath: '/api/v2' })
  .then(() => {
    console.log('Completed building OpenAPI schema from custom script.');
  })
  .catch(console.error);

res: A configPath parameter with a value of /api/v2 was provided but no Next REST Framework configs were found.

"custom-validate-openapi": "npx tsx ./scripts/custom-validate-openapi.ts"

import { validate } from 'next-rest-framework/dist/cli/validate';

validate({ configPath: '/api/v2' })
  .then(() => {
    console.log('Completed validating OpenAPI schema from custom script.');
  })
  .catch(console.error);
// app/api/v2/route.ts

import { docsRoute } from "next-rest-framework";
export const { GET } = docsRoute({
});

"next": "14.2.8", "typescript": "^5.6.2",