swagger-express-middleware icon indicating copy to clipboard operation
swagger-express-middleware copied to clipboard

add example to JsonSchema, fix wrap for complicated wrap object

Open grender opened this issue 9 years ago • 2 comments

There is 2 fixes:

  1. add posibility to use example information in JsonSchema
  2. fix wrapping collection with complicating wrap object. For example:
swagger: '2.0'
info:
  version: 0.1.0
  title: Test

paths:
  /items:
    get:
      responses:
        200:
          description: Success
          schema:
            properties:
              status:
                type: string
                example: success
              pagination:
                $ref: '#/definitions/PAGINATION'
              items:
                type: array
                items:
                  $ref: '#/definitions/ITEM'
definitions:
  ITEM:
    properties:
      id:
        type: integer
        example: 12
      name:
        type: string
        example: name
  PAGINATION:
    properties:
      per_page:
        type: integer
        example: 15
      current_page:
        type: integer
        example: 1
      total_pages:
        type: integer
        example: 1

Properties pagination and status not exist in mock without that fix.

grender avatar Jun 19 '15 14:06 grender

Awesome, thanks! I'll take a closer look at it this weekend or early next week and get it merged in.

JamesMessinger avatar Jun 19 '15 14:06 JamesMessinger

Sorry, I haven't had a chance to take a look at this yet. I'm currently working on a refactoring of Swagger Parser, which will have upstream effects on Swagger Express Middleware, so I'm waiting for that refactoring to be done before I merge this Pull Request

JamesMessinger avatar Jul 02 '15 01:07 JamesMessinger