omermecitoglu / next-openapi-json-generator

a Next.js plugin to generate OpenAPI documentation from route handlers
MIT License
1 stars 1 forks source link

Invalid operation path on windows #2

Closed summer-2014 closed 3 months ago

summer-2014 commented 3 months ago

On Windows, the path of the operation is invalid.

Perhaps it can be solved like this:

function getRoutePathName(filePath: string, rootPath: string) {
  return filePath
    .replace(rootPath, "")
    .replace("[", "{")
    .replace("]", "}")
    .replaceAll("\\", "/")    // add this line
    .replace("/route.ts", "");
}
omermecitoglu commented 3 months ago

Good catch. Why don't you make a pr and join as a contributor? 😉 I'll merge and release a quick patch for that.