sourcey / spectacle

Beautiful static documentation generator for OpenAPI/Swagger 2.0
https://sourcey.com/spectacle
Other
1.28k stars 337 forks source link

Fix displaying a response examples #186

Closed elyesbenabdelkader closed 5 years ago

elyesbenabdelkader commented 5 years ago

This PR fixes issue #181 According to the OpenAPI v2.0 Specifications*, response examples have to be defined in a 'examples' field, not 'example'. Furthermore, an example must be an Example Object**.

* https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#response-object ** https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#example-object

auscaster commented 5 years ago

Nice work!

I'll merge this, but will replace this condition so we can keep backward compatibility:

    if (value.example) {
      return value.example;