cowboy_swagger icon indicating copy to clipboard operation
cowboy_swagger copied to clipboard

Swagger compliance

Open jonasrichard opened this issue 8 years ago • 2 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/

jonasrichard avatar May 03 '16 13:05 jonasrichard

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

philipcristiano avatar May 12 '20 12:05 philipcristiano

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 😄

paulo-ferraz-oliveira avatar Oct 28 '20 11:10 paulo-ferraz-oliveira