如何在控制器外使用 apipie 创建 api 文档
How to create api documentation using apipie outside the controller
我将 apipie 用于 API 文档。
我现在面临的问题是为文档提供的大量信息正在破坏我在控制器中的代码结构。
如何在控制器文件之外编写文档,
以便代码 结构 可读?
您可以在本文档中找到有关如何在控制器外部使用 apipie 的很好的解释 https://ilyabylich.svbtle.com/apipie-amazing-tool-for-documenting-your-rails-api
总结一下(来自link的例子):
# app/docs/users_doc.rb
module UsersDoc
# we need the DSL, right?
extend Apipie::DSL::Concern
api :GET, '/users', 'List users'
def show
# Nothing here, it's just a stub
end
end
# app/controller/users_controller.rb
class UsersController < ApplicationController
include UsersDoc
def show
# Application code goes here
# and it overrides blank method
# from the module
end
end
我将 apipie 用于 API 文档。 我现在面临的问题是为文档提供的大量信息正在破坏我在控制器中的代码结构。
如何在控制器文件之外编写文档, 以便代码 结构 可读?
您可以在本文档中找到有关如何在控制器外部使用 apipie 的很好的解释 https://ilyabylich.svbtle.com/apipie-amazing-tool-for-documenting-your-rails-api
总结一下(来自link的例子):
# app/docs/users_doc.rb
module UsersDoc
# we need the DSL, right?
extend Apipie::DSL::Concern
api :GET, '/users', 'List users'
def show
# Nothing here, it's just a stub
end
end
# app/controller/users_controller.rb
class UsersController < ApplicationController
include UsersDoc
def show
# Application code goes here
# and it overrides blank method
# from the module
end
end