inaka / cowboy_swagger

Swagger integration for Cowboy (built on trails)
http://inaka.net/blog/2015/08/19/cowboy-swagger/
Apache License 2.0
121 stars 58 forks source link

support component parameters #140

Closed zhongwencool closed 3 years ago

zhongwencool commented 3 years ago

support component parameters.

"components": {
  "schemas": {...}
  "parameters":  
      "per-page": {
         "name": "per_page",
         "description": "Results per page (max 100)",
         "in": "query",
         "schema": {
            "type": "integer",
            "default": 30
         }
       },
      "cursor": {
        "name": "cursor",
        "description": "Used for pagination....",
        "in": "query",
        "required": false,
        "schema": {
           "type": "string"
        }
      }
}

use as ref:

"parameters": [
          {
            "$ref": "#/components/parameters/per-page"
          },
          {
            "$ref": "#/components/parameters/cursor"
          }
        ]
zhongwencool commented 3 years ago

ping @elbrujohalcon :0

elbrujohalcon commented 3 years ago

Hummm… it looks like you introduced an unused export… 🤔

zhongwencool commented 3 years ago

Hummm… it looks like you introduced an unused export… 🤔

cowboy_swagger:get_existing_definitions/1 only use by ct test, I change it to cowboy_swagger:get_existing_definitions/2.

I let xref to ignore this.

elbrujohalcon commented 3 years ago

👌🏻

elbrujohalcon commented 3 years ago

Well… now elvis is complaining 🤷🏻

zhongwencool commented 3 years ago

Well… now elvis is complaining 🤷🏻

done....

elbrujohalcon commented 3 years ago

😢 We still have trailing whitespaces 🤷🏻

zhongwencool commented 3 years ago

@elbrujohalcon WOW, Thank you very much for this very useful library. 👍 Could you give me a new tag?

elbrujohalcon commented 3 years ago

You got it!