Git Product home page Git Product logo

next-openapi-json-generator's Introduction

next-openapi-json-generator's People

Contributors

omermecitoglu avatar summer-2014 avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

summer-2014

next-openapi-json-generator's Issues

Security Schemas

@omermecitoglu I was looking to add security schemas.

The current documentation suggests this:

const spec = await generateOpenApiSpec({
    schema
  });

I see no way to edit the info or components:

  return {
    openapi: "3.1.0",
    info: {
      title: metadata.serviceName,
      version: metadata.version,
    },
    paths: bundlePaths(validRoutes, schemas),
    components: {
      schemas: bundleSchemas(schemas),
    },
    tags: [],
  } as OpenApiDocument;

Would it be possible to provide a way to extend the info, component security schemas?
Here's a repo you might find helpful for inspiration: https://github.com/jellydn/next-swagger-doc

createSwaggerSpec({
    apiFolder: 'app/api', // define api folder under app folder
    definition: {
      openapi: '3.0.0',
      info: {
        title: 'Next Swagger API Example',
        version: '1.0'
      },
      components: {
        securitySchemes: {
          BearerAuth: {
            type: 'http',
            scheme: 'bearer',
            bearerFormat: 'JWT'
          }
        }
      },
      security: []
    }
  });

Invalid operation path on windows

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", "");
}

Warning pnpm: "critical dependency: the request of a dependency is an expression"

When using pnpm to run "@omer-x/next-openapi-json-generator": "^0.2.5" there's a warning that occurs every single time generateOpenApiSpec is called.

 โš  ./node_modules/.pnpm/[email protected]/node_modules/typescript/lib/typescript.js
Critical dependency: the request of a dependency is an expression

Import trace for requested module:
./node_modules/.pnpm/[email protected]/node_modules/typescript/lib/typescript.js
./node_modules/.pnpm/@[email protected]_@[email protected][email protected][email protected]/node_modules/@omer-x/next-openapi-json-generator/dist/index.js
./app/openapi/route.ts

A quick start option without a Route Handler, based on JSDoc?

Hi. Found this, looks cool.

But for starters (and existing project with a lot of routes) it would be great to generate a spec simply based on standard Next.js route.ts handlers and JSDoc. It would be really cool.

I checked Route Handler as well, looks pretty useful. But migration would take a lot of time and I need a quicker solution for now over my plain Next.js app codepase to at least list all API endpoints (and use some data from JSDoc if possible).

Does it make sense?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.