0.1.0-beta.3 • Published 5 years ago

swagger-min v0.1.0-beta.3

Weekly downloads
3
License
MIT
Repository
github
Last release
5 years ago

swagger-min

PlatformBadges
LicenseLicense MIT
Circle CICircleCI
Code CoverageCode Coverage
DocumantationDocumentation Status
NPMnpm version npm downloads
DockerDocker Size Docker Pulls

Show only the parts of a swagger document that you are interested in

install swagger-min from npm

npm install -g swagger-min

show relevant swagger for POST /pet from https://petstore.swagger.io/v2/swagger.json

swagger-min --file https://petstore.swagger.io/v2/swagger.json --verb post --route /pet
paths:
  /pet:
    post:
      tags:
        - pet
      summary: Add a new pet to the store
      description: ''
      operationId: addPet
      consumes:
        - application/json
        - application/xml
      produces:
        - application/xml
        - application/json
      parameters:
        - in: body
          name: body
          description: Pet object that needs to be added to the store
          required: true
          schema:
            $ref: '#/definitions/Pet'
      responses:
        '405':
          description: Invalid input
      security:
        - petstore_auth:
            - 'write:pets'
            - 'read:pets'
definitions:
  Pet:
    type: object
    required:
      - name
      - photoUrls
    properties:
      id:
        type: integer
        format: int64
      category:
        $ref: '#/definitions/Category'
      name:
        type: string
        example: doggie
      photoUrls:
        type: array
        xml:
          name: photoUrl
          wrapped: true
        items:
          type: string
      tags:
        type: array
        xml:
          name: tag
          wrapped: true
        items:
          $ref: '#/definitions/Tag'
      status:
        type: string
        description: pet status in the store
        enum:
          - available
          - pending
          - sold
    xml:
      name: Pet
  Category:
    type: object
    properties:
      id:
        type: integer
        format: int64
      name:
        type: string
    xml:
        name: Category
  Tag:
    type: object
    properties:
      id:
        type: integer
        format: int64
      name:
        type: string
    xml:
        name: Tag