class Apipie::Configuration
Attributes
matcher to be used in Dir.glob to find controllers to be reloaded e.g.
"#{Rails.root}/app/controllers/api/*.rb"
specify routes if used router differ from default e.g.
Api::Engine.routes
comment to put before docs that was generated automatically. It’s used to determine if the description should be overwritten next recording. If you want to keep the documentation (prevent from overriding), remove the line above the docs.
array of controller names (strings) (might include actions as well) to be ignored # when generationg the documentation e.g. %w[Api::CommentsController Api::PostsController#post]
array of controller names (strings) (might include actions as well) to be ignored # when extracting description form calls. e.g. %w[Api::CommentsController Api::PostsController#post]
set to true if you want to reload the controllers at each refresh of the documentation. It requires :api_controllers_matcher
to be set to work properly.
a object responsible for transforming the routes loaded from Rails to a form to be used in the documentation, when using the ‘api!` keyword. By default, it’s Apipie::RoutesFormatter
. To customize the behaviour, one can inherit from from this class and override the methods as needed.
set to true if you want to use pregenerated documentation cache and avoid generating the documentation on runtime (usefull for production environment). You can generate the cache by running
rake apipie:cache
set to true if you want to use pregenerated documentation cache and avoid generating the documentation on runtime (usefull for production environment). You can generate the cache by running
rake apipie:cache
Public Class Methods
Source
# File lib/apipie/configuration.rb, line 147 def initialize @markup = Apipie::Markup::RDoc.new @app_name = "Another API" @app_info = HashWithIndifferentAccess.new @copyright = nil @validate = :implicitly @validate_value = true @validate_presence = true @validate_key = false @action_on_non_validated_keys = :raise @required_by_default = false @api_base_url = HashWithIndifferentAccess.new @doc_base_url = "/apipie" @layout = "apipie/apipie" @disqus_shortname = nil @default_version = "1.0" @debug = false @ignore_allow_blank_false = false @version_in_url = true @namespaced_resources = false @doc_path = "doc" @process_params = false @checksum_path = [@doc_base_url, '/api/'] @update_checksum = false @link_extension = ".html" @record = false @languages = [] @default_locale = 'en' @locale = lambda { |locale| @default_locale } @translate = lambda { |str, locale| str } @persist_show_in_doc = false @routes_formatter = RoutesFormatter.new @swagger_content_type_input = :form_data # this can be :json or :form_data @swagger_json_input_uses_refs = false @swagger_include_warning_tags = false @swagger_suppress_warnings = false #[105,100,102] @swagger_api_host = "localhost:3000" @swagger_generate_x_computed_id_field = false @swagger_allow_additional_properties_in_response = false @swagger_responses_use_refs = true @swagger_schemes = [:https] @swagger_security_definitions = {} @swagger_global_security = [] end
Public Instance Methods
Source
# File lib/apipie/configuration.rb, line 138 def api_base_url=(url) version = Apipie.configuration.default_version @api_base_url[version] = url end
set base url for default version of API to set it for specific version use config.api_base_url = url
Source
# File lib/apipie/configuration.rb, line 130 def app_info=(description) version = Apipie.configuration.default_version @app_info[version] = description end
set app description for default version to maintain backward compatibility new way: config.app_info = description
Source
# File lib/apipie/configuration.rb, line 79 def cache_dir @cache_dir ||= File.join(Rails.root, "public", "apipie-cache") end
Source
# File lib/apipie/configuration.rb, line 119 def generated_doc_disclaimer @generated_doc_disclaimer ||= "# DOC GENERATED AUTOMATICALLY: REMOVE THIS LINE TO PREVENT REGENERATING NEXT TIME" end
Source
# File lib/apipie/configuration.rb, line 105 def ignored @ignored ||= [] @ignored.map(&:to_s) end
Source
# File lib/apipie/configuration.rb, line 96 def ignored_by_recorder @ignored_by_recorder ||= [] @ignored_by_recorder.map(&:to_s) end
Source
# File lib/apipie/configuration.rb, line 66 def process_value? @process_params end
Source
# File lib/apipie/configuration.rb, line 46 def reload_controllers? @reload_controllers = Rails.env.development? unless defined? @reload_controllers return @reload_controllers && @api_controllers_matcher end
Source
# File lib/apipie/configuration.rb, line 123 def use_disqus? !@disqus_shortname.blank? end