First iteration of rspec driven swagger

This commit is contained in:
domaindrivendev
2016-04-06 09:19:41 -07:00
parent d579dab7d8
commit 63861a3940
17 changed files with 312 additions and 445 deletions

View File

@@ -7,10 +7,19 @@ module SwaggerRails
end
class << self
attr_accessor :swagger_docs
attr_accessor :doc_factories
@@doc_factories = {}
@@swagger_docs = {
'V1' => 'v1/swagger.json'
}
def swagger_doc(path, &block)
@@doc_factories[path] = block
end
def swagger_docs
Hash[
@@doc_factories.map do |path, factory|
[ path, { swagger: '2.0' }.merge(factory.call) ]
end
]
end
end
end