jopenapi

1.0.6 • Public • Published

JOpenApi

Permite generar un archivo json de acuerdo a Openapi 3.0.0 apartir de los comentarios en un archivo

Documentar

/**
* @post /clients 
* Registra un nuevo cliente
* @body {
*  phone: 2221234567, // celular del cliente
*  full_name: "Jorge Hernández", // nombre completo
* }
* 
* @200{ 
*  phone: "222" // celular del cliente
*  full_name: "aaa", // nombre completo
*  id_cliente:1,
*  uuid:"123123-123123-13",
* }
* */
// tú código normal
router.post("/clients"

Genera

Esto genera un path de la siguiente forma

/clients:
    post:
      summary: 'Registra un nuevo cliente '
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                phone:
                  example: '2221234567'
                  type: string
              required:
                - phone
      parameters: []
      responses:
        '200':
          content:
            application/json:
              schema:
                type: object
                properties:
                  phone:
                    example: '222'
                    type: string
                  id_cliente:
                    example: '1'
                    type: number
                  uuid:
                    example: 123123-123123-13
                    type: string

Instalar

    npm i jopenapi

Como usar

   const j=require("jopenapi")
   const open=new j.OpenApi();
   await open.setFiles("./src/Api/", { fileFilter: "*Controller.ts" });
   await p.generate("./openapi3.0.json");

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.6
    0
    • latest

Version History

Package Sidebar

Install

npm i jopenapi

Weekly Downloads

1

Version

1.0.6

License

ISC

Unpacked Size

52.8 kB

Total Files

19

Last publish

Collaborators

  • jorgehr