1

can swagger docs be automated instead of typing it manually ? does anyone know some tools ? or libraries? . based from the sample below , instead og typing those manually is there a tool that can auto generate it based on models? , and it loopback can do it? or anyone know some tools? . and does it true loopback supports swagger docs generation. Thank You.

swagger: '2.0'
info:
  version: 1.0.0
  title: customcat
basePath: /api
host: 127.0.0.1:3333
consumes:
  - application/json
  - application/x-www-form-urlencoded
  - application/xml
  - text/xml
produces:
  - application/json
  - application/xml
  - text/xml
  - application/javascript
  - text/javascript
paths:
  /notes:
    post:
      tags:
        - note
      summary: Create a new instance of the model and persist it into the data source.
      operationId: note.create
      parameters:
        - name: data
          in: body
          description: Model instance data
          required: false
          schema:
            $ref: '#/definitions/note'
      responses:
        '200':
          description: Request was successful
          schema:
            $ref: '#/definitions/note'
      deprecated: false
    put:
      tags:
        - note
      summary: >-
        Update an existing model instance or insert a new one into the data
        source.
      operationId: note.upsert
      parameters:
        - name: data
          in: body
          description: Model instance data
          required: false
          schema:
            $ref: '#/definitions/note'
      responses:
        '200':
          description: Request was successful
          schema:
            $ref: '#/definitions/note'
      deprecated: false
    get:
      tags:
        - note
      summary: Find all instances of the model matched by filter from the data source.
      operationId: note.find
      parameters:
        - name: filter
          in: query
          description: 'Filter defining fields, where, include, order, offset, and limit'
          required: false
          type: string
          format: JSON
      responses:
        '200':
          description: Request was successful
          schema:
            type: array
            items:
              $ref: '#/definitions/note'
      deprecated: false
  • Possible duplicate of [Generate Swagger Document for existing NodeJS server](https://stackoverflow.com/questions/33534488/generate-swagger-document-for-existing-nodejs-server) – Helen Mar 19 '18 at 07:10

1 Answers1

0

There is an online visual API builder, try: https://apibldr.com. It will give you a visual way of building it, without writing the code.

Gen4ik
  • 360
  • 1
  • 8
  • so you mean it will build docs crude , get post , add ,deltete , put based on models? –  Mar 19 '18 at 09:16
  • Yes, it just select the operations and add the model there. Create new path and add your operations. Then you can add the model. – Gen4ik Mar 20 '18 at 10:19