Module: Apigen::Formats::Swagger::V2
- Extended by:
- JsonBase
- Defined in:
- lib/apigen/formats/swagger.rb
Overview
Swagger 2 (aka OpenAPI 2) generator.
Class Method Summary collapse
Class Method Details
.generate(api) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/apigen/formats/swagger.rb', line 15 def generate(api) # TODO: Allow overriding any of the hardcoded elements. { 'swagger' => '2.0', 'info' => { 'version' => '1.0.0', 'title' => 'API', 'description' => api.description, 'termsOfService' => '', 'contact' => { 'name' => '' }, 'license' => { 'name' => '' } }, 'host' => 'localhost', 'basePath' => '/', 'schemes' => %w[ http https ], 'consumes' => [ 'application/json' ], 'produces' => [ 'application/json' ], 'paths' => paths(api), 'definitions' => definitions(api) }.to_yaml end |