carlansley / swagger2

Loading, parsing and validating requests to HTTP services based on Swagger v2.0 documents
MIT License
25 stars 17 forks source link

Parameters in Path Object lead to Problems #3

Closed cHolzberger closed 7 years ago

cHolzberger commented 7 years ago

when using a Parameter Object directly within an Path Object the compiler will error out.

See http://swagger.io/specification/#pathsObject for the definiton.

this snippet causes the error:

... 
paths: 
  /item/{sku}:
    parameters:
      - name: sku
        in: path
        required: true
        description: sku of the `InventoryItem` to lookup
        type: string
    get:
      summary: Get an item by sku
      description: |
        Returns a signle item identified by sku

      responses:
        200:
          $ref: "#/responses/InventoryItemResponse"
        404:
          $ref: "#/responses/UnknownSkuError"

can provide a whole definition if needed.

not sure whats the right way to fix it. --edit ok i get why the compile fails, parametersis of type array while the code expects only objects inside the path object. which is good - because the other way around this bug would go by unnoticed.

carlansley commented 7 years ago

Thanks for the bug report, I'll merge the test data and have a look.