inaka / cowboy_swagger

Swagger integration for Cowboy (built on trails)

Home Page:http://inaka.net/blog/2015/08/19/cowboy-swagger/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Swagger compliance

jonasrichard opened this issue · comments

I ran some compliance issues which can be fixed in the examples section (how to use cowboy-swagger), or in the code itself (what cowboy-swagger generates).

  • in the info object version of the api is required (there should be some generated version in default)
  • swagger editor [1] also complained about the missing basePath. Even when I specified basePath in the app.config I didn't see in the json, probably it didn't pick up the value.
  • a path parameter needs a type field (it seems to be required), it can be string or number see spec [2]. format which is optional but in numeric cases would be good to see an example.
  • when responses are needed, it needs at least:
"responses": {
    "default": {
        "description": ""
    }
}

but one can specify schema per http response code. See links below [2].

  • For body parameters I needed to define a "schema": {} at least, in order that the JSON would be compliant. required is not required here, type is forbidden.

I didn't have time to discover all parts of schema, but it would be a good example how to define request bodies which conform to a json.

[1] http://editor.swagger.io/#/
[2] http://swagger.io/specification/

I also ran into the missing version issue after following the examples.

I'm tentatively assigning this to me. Can't guarantee I'll have the time to look at it, but it'll stay in my TO DO list, at least 😄