oliyh / martian

The HTTP abstraction library for Clojure/script, supporting OpenAPI, Swagger, Schema, re-frame and more
MIT License
529 stars 44 forks source link

$ref is not working properly for swagger parameters #195

Closed RafaeLeal closed 8 months ago

RafaeLeal commented 8 months ago

Hi! I think I've discovered a bug related to $ref usage on parameters for swagger. I've tried to reproduce it using OpenAPI v3, but it seems it's working properly there.

Consider the schema:

swagger: "2.0"
info:
  title: "Users API"
  version: "1.0"
definitions:
  userIdParam:
    name: id
    in: query
    description: user's id
    required: true
    type: string
paths:
  /users:
    get:
      operationId: getUsers
      parameters:
        - $ref: "#/definitions/userIdParam"
      responses:
        '200':
          description: "OK"

It's not producing the query schema correctly:

  (let [client (martian-httpkit/bootstrap-openapi "swagger-example.yaml")]
    (martian/explore client :get-users))
=> {:summary nil, :parameters {}, :returns {200 Any}}
oliyh commented 8 months ago

Closing as fixed in #196