ahultgren/swagger-elm

Is the 'definitions' section supposed to be mandatory?

Closed this issue · 2 comments

I ran swagger-elm over a swagger file that doesn't include a 'definitions' section and I got this:

errorerror: "Expecting an object with a field named `definitions` but instead got: [omitted]

I added an empty 'definitions' to the file and everything worked just fine.

Is the 'definitions' section actually required? I can't find an answer to this. I'm generating this swagger file via aiohttp-swagger, but I have no idea if it's doing the right thing or not.

If 'definitions' is not required, then swagger-elm shouldn't require it.

Currently it's required, since generating decoders based on definitions is the only thing this project does. When it in the future generates http request handlers it will make sense for it to be optional.

Fair enough. I was just dipping my toes into swagger for the first time (with the plan of using Elm with it), and the toy example I had been playing with didn't include any definitions. So it was a little jarring when swagger-elm wouldn't process the swagger file I generated. Thanks for the response, and hopefully I'll be using this tool in earnest in the near future.