jejacks0n / apitome Goto Github PK
View Code? Open in Web Editor NEWApitome: /iˈpitəmē/ An API documentation presentation layer for RSpec API Documentation output.
Apitome: /iˈpitəmē/ An API documentation presentation layer for RSpec API Documentation output.
fails with stacktrace
ActionView::Template::Error (Apitome::FileNotFound):
1: <% resources.each do |resource| %>
2: <section class="example" id="<%= id_for(resource['name']) %>">
3: <% resource['examples'].each do |example| %>
4: <article id="<%= id_for(example['link'].gsub('.json', '')) %>">
vendor/ruby/1.9.1/bundler/gems/apitome-ecc650b51ab0/app/controllers/apitome/docs_controller.rb:17:in `file_for'
vendor/ruby/1.9.1/bundler/gems/apitome-ecc650b51ab0/app/controllers/apitome/docs_controller.rb:22:in `resources'
vendor/ruby/1.9.1/gems/actionpack-3.2.14/lib/abstract_controller/helpers.rb:53:in `resources'
I assume this is because I haven't created documentation for apitome to render, however even though the RAD gem is in the gemspec I do not seem to have access to the rake task needed to run the generator. Maybe there needs to be some specification in the README on how to get the docs created initially? Once i expressly install the RAD gem in my Gemfile, I have access to the rake task, so maybe there is a way to specify in the gemspec to load this task, I'm not sure how to do that. Did a little google searching and didn't find a good answer.
Maybe it is common place just to modify the generator?
I tried adding a lib/tasks
dir to apitome and requiring the RAD task from there assuming that would get picked up in the gemspec.files configuration, but no luck....
Hi,
I'm using rspec_api_documentation with apitome.
I'm wondering if it's possible to break line in parameters description:
parameter :param_name, "Param description. - an interesting point - another interesting point", "Type" => "Array", required: true
I tried adding both '\n' antislash n and '< br />' br html tag but all the content display in one line.
Thanks for possible help !
I have included some response_fields in my rspec_api_documentation tests.
The rake task generates the html and json files with these response_fields. However, apitome will not render them.
I'm pretty sure (but please correct me if I'm wrong) that when invoking generate apitome:install
, the --assets option is supposed to default to false (based on reading the code). However, for me it's true by default:
$ rails generate apitome:install --help
Usage:
rails generate apitome:install [options]
Options:
-a, [--assets], [--no-assets] # Install the javascript and stylesheet assets to /public
# Default: true
Runtime options:
-f, [--force] # Overwrite files that already exist
-p, [--pretend], [--no-pretend] # Run but do not make any changes
-q, [--quiet], [--no-quiet] # Suppress status output
-s, [--skip], [--no-skip] # Skip files that already exist
Installs the Apitome initializer and markdown file into your application.
To a new user, having css and js files dropped in my /public folder was quite confusing, it took me a while to figure out if I could delete them or not.
See the documentation page for the example.
I get a "Bad Request" error page served from WEBrick.
Maybe it's time to release new version of gem? :)
Move translations into some namespace(e.x. apitome), as they are overriden by app where is being used. I can make PR for that.
Some additional comments on configuration would be useful and here is my suggestion. I'm fairly new to ruby and finding the place to make these changes took more than time than I'd like to admit.
Great work! Apitome makes my api docs look great.
After installation, your app will have an apitome initializer (app/config/initializers/apitome.rb). You will find the following parameters that can be used to customize apitome. Note: Restart rails after changing any of these parameters.
Do you think it is a good idea generate documentation on disks by running a rake task? Some people who don't want to serve documentation on their web server, then they can upload files to S3, and also they don't have to add the gem into production group.
I have configured an HTTP basic auth on my app/controllers/application_controller.rb
but apitome doesn't take it into account. How to configure my HTTP basic auth to work with apitome ?
Thanks
config.url_formatter = -> (str) { str.gsub(/\.json$/, '').underscore.gsub(/[^[:word:]]/, '-') }
maybe better then
config.url_formatter = -> (str) { str.gsub(/\.json$/, '').underscore.gsub(/[^0-9a-z\:]+/i, '-') }
If you use config.mount_at
as nil, and then mount the engine yourself in your routes (because you want it behind authentication), all of the paths to the new simulate endpoints are 404s (they link to /simulate
instead of /where/you/mounted/simulate
)
Perhaps we need a 2nd config option for "do not mount automatically"? Then mount_at can still be used for figuring out the similation path?
It would be nice not to rely on Rails' Asset Pipeline, so Apitome could be used with rails-api.
Apitome in its current version doesn't work with jruby since it relies on the github-markdown gem which is not compatible with jruby due to it's c-extensions.
We've created a fork and replaced github markdown with kramdown which makes it jruby compatible.
Let us know if you want this as a pull request.
thanks
Georg & Joseph
RAD allows you to create groups and send those Examples to different folders. I'd like to be able to support a Public and a Private folder with a separate README.md for each. Is that possible?
I'm trying to make app/views/layouts/application.html.erb
the default layout container. I see this is done here: https://github.com/modeset/apitome/blob/master/lib/generators/apitome/install/templates/initializer.rb#L20
However, this...
config.layout = 'app/views/layouts/application.html.erb'
... does not seem to work:
ActionView::MissingTemplate at /
Missing partial apitome/docs/_head with {:locale=>[:en], :formats=>[:html], :variants=>[], :handlers=>[:erb, :builder, :raw, :ruby, :coffee, :jbuilder]}. Searched in:
* "/Users/jcursi/.rvm/gems/ruby-2.2.0@vault/gems/web-console-2.0.0/lib/action_dispatch/templates"
* "/Users/jcursi/Sites/vault/app/views"
* "/Users/jcursi/.rvm/gems/ruby-2.2.0@vault/gems/devise-3.4.1/app/views"
* "/Users/jcursi/.rvm/gems/ruby-2.2.0@vault/gems/apitome-0.0.8/app/views"
What is the proper entry for this config key? Thanks!
Hi folks!
Just upgraded apitome
gem from version 0.1.0
to 0.2.0
, and getting the following error when visiting the API docs page:
undefined local variable or method apitome `apitome'
Error points to this line:
https://github.com/jejacks0n/apitome/blob/master/app/views/apitome/docs/_example.html.erb#L20
When I replaced apitome.simulated_path(link)
with simulated_path(link)
, the docs page loaded OK, and 'Simulated Response' link worked fine. I do not see the apitome
variable being used anywhere else in the templates.
Started GET "/api/docs" for ::1 at 2020-01-29 19:34:08 +0530
Processing by Apitome::DocsController#index as HTML
Rendering /home/kiran/.rvm/gems/ruby-2.6.0/gems/apitome-0.3.0/app/views/apitome/docs/index.html.erb within layouts/apitome/application
Rendered /home/kiran/.rvm/gems/ruby-2.6.0/gems/apitome-0.3.0/app/views/apitome/docs/_explanation.html.erb (Duration: 1.6ms | Allocations: 6077)
Rendered /home/kiran/.rvm/gems/ruby-2.6.0/gems/apitome-0.3.0/app/views/apitome/docs/_endpoint.html.erb (Duration: 0.1ms | Allocations: 77)
Rendered /home/kiran/.rvm/gems/ruby-2.6.0/gems/apitome-0.3.0/app/views/apitome/docs/_params.html.erb (Duration: 0.3ms | Allocations: 291)
Rendered /home/kiran/.rvm/gems/ruby-2.6.0/gems/apitome-0.3.0/app/views/apitome/docs/_route.html.erb (Duration: 0.1ms | Allocations: 77)
Rendered /home/kiran/.rvm/gems/ruby-2.6.0/gems/apitome-0.3.0/app/views/apitome/docs/_headers.html.erb (Duration: 0.1ms | Allocations: 87)
Rendered /home/kiran/.rvm/gems/ruby-2.6.0/gems/apitome-0.3.0/app/views/apitome/docs/_query.html.erb (Duration: 0.1ms | Allocations: 83)
Rendered /home/kiran/.rvm/gems/ruby-2.6.0/gems/apitome-0.3.0/app/views/apitome/docs/_status.html.erb (Duration: 0.1ms | Allocations: 77)
Rendered /home/kiran/.rvm/gems/ruby-2.6.0/gems/apitome-0.3.0/app/views/apitome/docs/_headers.html.erb (Duration: 0.1ms | Allocations: 92)
Rendered /home/kiran/.rvm/gems/ruby-2.6.0/gems/apitome-0.3.0/app/views/apitome/docs/_body.html.erb (Duration: 0.8ms | Allocations: 2425)
Rendered /home/kiran/.rvm/gems/ruby-2.6.0/gems/apitome-0.3.0/app/views/apitome/docs/_example.html.erb (Duration: 4.8ms | Allocations: 10099)
Rendered /home/kiran/.rvm/gems/ruby-2.6.0/gems/apitome-0.3.0/app/views/apitome/docs/_all_examples.html.erb (Duration: 5.3ms | Allocations: 10775)
Rendered /home/kiran/.rvm/gems/ruby-2.6.0/gems/apitome-0.3.0/app/views/apitome/docs/index.html.erb within layouts/apitome/application (Duration: 7.1ms | Allocations: 15511)
Completed 500 Internal Server Error in 8ms (ActiveRecord: 0.0ms | Allocations: 16267)
ActionView::Template::Error (JSON::ParserError):
1:
<%= formatted_body(body, type) %>
apitome (0.3.0) app/controllers/apitome/docs_controller.rb:90:in rescue in formatted_body' apitome (0.3.0) app/controllers/apitome/docs_controller.rb:82:in
formatted_body'
actionpack (6.0.2.1) lib/abstract_controller/helpers.rb:67:in formatted_body' apitome (0.3.0) app/views/apitome/docs/_body.html.erb:3 actionview (6.0.2.1) lib/action_view/base.rb:274:in
_run'
actionview (6.0.2.1) lib/action_view/template.rb:185:in block in render' activesupport (6.0.2.1) lib/active_support/notifications.rb:180:in
block in instrument'
activesupport (6.0.2.1) lib/active_support/notifications/instrumenter.rb:24:in instrument' activesupport (6.0.2.1) lib/active_support/notifications.rb:180:in
instrument'
actionview (6.0.2.1) lib/action_view/template.rb:386:in instrument_render_template' actionview (6.0.2.1) lib/action_view/template.rb:183:in
render'
actionview (6.0.2.1) lib/action_view/renderer/partial_renderer.rb:358:in block in render_partial' actionview (6.0.2.1) lib/action_view/renderer/abstract_renderer.rb:89:in
block in instrument'
activesupport (6.0.2.1) lib/active_support/notifications.rb:180:in block in instrument' activesupport (6.0.2.1) lib/active_support/notifications/instrumenter.rb:24:in
instrument'
activesupport (6.0.2.1) lib/active_support/notifications.rb:180:in instrument' actionview (6.0.2.1) lib/action_view/renderer/abstract_renderer.rb:88:in
instrument'
actionview (6.0.2.1) lib/action_view/renderer/partial_renderer.rb:347:in render_partial' actionview (6.0.2.1) lib/action_view/renderer/partial_renderer.rb:317:in
render'
actionview (6.0.2.1) lib/action_view/renderer/renderer.rb:65:in render_partial_to_object' actionview (6.0.2.1) lib/action_view/renderer/renderer.rb:27:in
render_to_object'
actionview (6.0.2.1) lib/action_view/renderer/renderer.rb:22:in render' actionview (6.0.2.1) lib/action_view/helpers/rendering_helper.rb:34:in
block in render'
actionview (6.0.2.1) lib/action_view/base.rb:304:in in_rendering_context' actionview (6.0.2.1) lib/action_view/helpers/rendering_helper.rb:30:in
render'
haml (5.1.2) lib/haml/helpers/action_view_mods.rb:15:in render' apitome (0.3.0) app/views/apitome/docs/_example.html.erb:26 apitome (0.3.0) app/views/apitome/docs/_example.html.erb:7:in
each'
apitome (0.3.0) app/views/apitome/docs/_example.html.erb:7:in each_with_index' apitome (0.3.0) app/views/apitome/docs/_example.html.erb:7 actionview (6.0.2.1) lib/action_view/base.rb:274:in
_run'
actionview (6.0.2.1) lib/action_view/template.rb:185:in block in render' activesupport (6.0.2.1) lib/active_support/notifications.rb:180:in
block in instrument'
activesupport (6.0.2.1) lib/active_support/notifications/instrumenter.rb:24:in instrument' activesupport (6.0.2.1) lib/active_support/notifications.rb:180:in
instrument'
actionview (6.0.2.1) lib/action_view/template.rb:386:in instrument_render_template' actionview (6.0.2.1) lib/action_view/template.rb:183:in
render'
actionview (6.0.2.1) lib/action_view/renderer/partial_renderer.rb:358:in block in render_partial' actionview (6.0.2.1) lib/action_view/renderer/abstract_renderer.rb:89:in
block in instrument'
activesupport (6.0.2.1) lib/active_support/notifications.rb:180:in block in instrument' activesupport (6.0.2.1) lib/active_support/notifications/instrumenter.rb:24:in
instrument'
activesupport (6.0.2.1) lib/active_support/notifications.rb:180:in instrument' actionview (6.0.2.1) lib/action_view/renderer/abstract_renderer.rb:88:in
instrument'
actionview (6.0.2.1) lib/action_view/renderer/partial_renderer.rb:347:in render_partial' actionview (6.0.2.1) lib/action_view/renderer/partial_renderer.rb:317:in
render'
actionview (6.0.2.1) lib/action_view/renderer/renderer.rb:65:in render_partial_to_object' actionview (6.0.2.1) lib/action_view/renderer/renderer.rb:27:in
render_to_object'
actionview (6.0.2.1) lib/action_view/renderer/renderer.rb:22:in render' actionview (6.0.2.1) lib/action_view/helpers/rendering_helper.rb:34:in
block in render'
actionview (6.0.2.1) lib/action_view/base.rb:304:in in_rendering_context' actionview (6.0.2.1) lib/action_view/helpers/rendering_helper.rb:30:in
render'
haml (5.1.2) lib/haml/helpers/action_view_mods.rb:15:in render' apitome (0.3.0) app/views/apitome/docs/_all_examples.html.erb:10 apitome (0.3.0) app/views/apitome/docs/_all_examples.html.erb:7:in
each'
apitome (0.3.0) app/views/apitome/docs/_all_examples.html.erb:7
apitome (0.3.0) app/views/apitome/docs/_all_examples.html.erb:1:in each' apitome (0.3.0) app/views/apitome/docs/_all_examples.html.erb:1 actionview (6.0.2.1) lib/action_view/base.rb:274:in
_run'
actionview (6.0.2.1) lib/action_view/template.rb:185:in block in render' activesupport (6.0.2.1) lib/active_support/notifications.rb:180:in
block in instrument'
activesupport (6.0.2.1) lib/active_support/notifications/instrumenter.rb:24:in instrument' activesupport (6.0.2.1) lib/active_support/notifications.rb:180:in
instrument'
actionview (6.0.2.1) lib/action_view/template.rb:386:in instrument_render_template' actionview (6.0.2.1) lib/action_view/template.rb:183:in
render'
actionview (6.0.2.1) lib/action_view/renderer/partial_renderer.rb:358:in block in render_partial' actionview (6.0.2.1) lib/action_view/renderer/abstract_renderer.rb:89:in
block in instrument'
activesupport (6.0.2.1) lib/active_support/notifications.rb:180:in block in instrument' activesupport (6.0.2.1) lib/active_support/notifications/instrumenter.rb:24:in
instrument'
activesupport (6.0.2.1) lib/active_support/notifications.rb:180:in instrument' actionview (6.0.2.1) lib/action_view/renderer/abstract_renderer.rb:88:in
instrument'
actionview (6.0.2.1) lib/action_view/renderer/partial_renderer.rb:347:in render_partial' actionview (6.0.2.1) lib/action_view/renderer/partial_renderer.rb:317:in
render'
actionview (6.0.2.1) lib/action_view/renderer/renderer.rb:65:in render_partial_to_object' actionview (6.0.2.1) lib/action_view/renderer/renderer.rb:53:in
render_partial'
actionview (6.0.2.1) lib/action_view/helpers/rendering_helper.rb:38:in render' haml (5.1.2) lib/haml/helpers/action_view_mods.rb:15:in
render'
apitome (0.3.0) app/views/apitome/docs/index.html.erb:11
actionview (6.0.2.1) lib/action_view/base.rb:274:in _run' actionview (6.0.2.1) lib/action_view/template.rb:185:in
block in render'
activesupport (6.0.2.1) lib/active_support/notifications.rb:180:in block in instrument' activesupport (6.0.2.1) lib/active_support/notifications/instrumenter.rb:24:in
instrument'
activesupport (6.0.2.1) lib/active_support/notifications.rb:180:in instrument' actionview (6.0.2.1) lib/action_view/template.rb:386:in
instrument_render_template'
actionview (6.0.2.1) lib/action_view/template.rb:183:in render' actionview (6.0.2.1) lib/action_view/renderer/template_renderer.rb:59:in
block (2 levels) in render_template'
actionview (6.0.2.1) lib/action_view/renderer/abstract_renderer.rb:89:in block in instrument' activesupport (6.0.2.1) lib/active_support/notifications.rb:180:in
block in instrument'
activesupport (6.0.2.1) lib/active_support/notifications/instrumenter.rb:24:in instrument' activesupport (6.0.2.1) lib/active_support/notifications.rb:180:in
instrument'
actionview (6.0.2.1) lib/action_view/renderer/abstract_renderer.rb:88:in instrument' actionview (6.0.2.1) lib/action_view/renderer/template_renderer.rb:58:in
block in render_template'
actionview (6.0.2.1) lib/action_view/renderer/template_renderer.rb:66:in render_with_layout' actionview (6.0.2.1) lib/action_view/renderer/template_renderer.rb:57:in
render_template'
actionview (6.0.2.1) lib/action_view/renderer/template_renderer.rb:13:in render' actionview (6.0.2.1) lib/action_view/renderer/renderer.rb:61:in
render_template_to_object'
actionview (6.0.2.1) lib/action_view/renderer/renderer.rb:29:in render_to_object' actionview (6.0.2.1) lib/action_view/rendering.rb:118:in
block in _render_template'
actionview (6.0.2.1) lib/action_view/base.rb:304:in in_rendering_context' actionview (6.0.2.1) lib/action_view/rendering.rb:117:in
_render_template'
actionpack (6.0.2.1) lib/action_controller/metal/streaming.rb:219:in _render_template' actionview (6.0.2.1) lib/action_view/rendering.rb:103:in
render_to_body'
actionpack (6.0.2.1) lib/action_controller/metal/rendering.rb:52:in render_to_body' actionpack (6.0.2.1) lib/action_controller/metal/renderers.rb:142:in
render_to_body'
actionpack (6.0.2.1) lib/abstract_controller/rendering.rb:25:in render' actionpack (6.0.2.1) lib/action_controller/metal/rendering.rb:36:in
render'
actionpack (6.0.2.1) lib/action_controller/metal/instrumentation.rb:44:in block (2 levels) in render' activesupport (6.0.2.1) lib/active_support/core_ext/benchmark.rb:14:in
block in ms'
/home/kiran/.rvm/rubies/ruby-2.6.0/lib/ruby/2.6.0/benchmark.rb:308:in realtime' activesupport (6.0.2.1) lib/active_support/core_ext/benchmark.rb:14:in
ms'
actionpack (6.0.2.1) lib/action_controller/metal/instrumentation.rb:44:in block in render' actionpack (6.0.2.1) lib/action_controller/metal/instrumentation.rb:85:in
cleanup_view_runtime'
activerecord (6.0.2.1) lib/active_record/railties/controller_runtime.rb:34:in cleanup_view_runtime' actionpack (6.0.2.1) lib/action_controller/metal/instrumentation.rb:43:in
render'
actionpack (6.0.2.1) lib/action_controller/metal/implicit_render.rb:35:in default_render' actionpack (6.0.2.1) lib/action_controller/metal/basic_implicit_render.rb:6:in
block in send_action'
actionpack (6.0.2.1) lib/action_controller/metal/basic_implicit_render.rb:6:in tap' actionpack (6.0.2.1) lib/action_controller/metal/basic_implicit_render.rb:6:in
send_action'
actionpack (6.0.2.1) lib/abstract_controller/base.rb:196:in process_action' actionpack (6.0.2.1) lib/action_controller/metal/rendering.rb:30:in
process_action'
actionpack (6.0.2.1) lib/abstract_controller/callbacks.rb:42:in block in process_action' activesupport (6.0.2.1) lib/active_support/callbacks.rb:135:in
run_callbacks'
actionpack (6.0.2.1) lib/abstract_controller/callbacks.rb:41:in process_action' actionpack (6.0.2.1) lib/action_controller/metal/rescue.rb:22:in
process_action'
actionpack (6.0.2.1) lib/action_controller/metal/instrumentation.rb:33:in block in process_action' activesupport (6.0.2.1) lib/active_support/notifications.rb:180:in
block in instrument'
activesupport (6.0.2.1) lib/active_support/notifications/instrumenter.rb:24:in instrument' activesupport (6.0.2.1) lib/active_support/notifications.rb:180:in
instrument'
actionpack (6.0.2.1) lib/action_controller/metal/instrumentation.rb:32:in process_action' actionpack (6.0.2.1) lib/action_controller/metal/params_wrapper.rb:245:in
process_action'
activerecord (6.0.2.1) lib/active_record/railties/controller_runtime.rb:27:in process_action' actionpack (6.0.2.1) lib/abstract_controller/base.rb:136:in
process'
actionview (6.0.2.1) lib/action_view/rendering.rb:39:in process' actionpack (6.0.2.1) lib/action_controller/metal.rb:191:in
dispatch'
actionpack (6.0.2.1) lib/action_controller/metal.rb:252:in dispatch' actionpack (6.0.2.1) lib/action_dispatch/routing/route_set.rb:51:in
dispatch'
actionpack (6.0.2.1) lib/action_dispatch/routing/route_set.rb:33:in serve' actionpack (6.0.2.1) lib/action_dispatch/journey/router.rb:49:in
block in serve'
actionpack (6.0.2.1) lib/action_dispatch/journey/router.rb:32:in each' actionpack (6.0.2.1) lib/action_dispatch/journey/router.rb:32:in
serve'
actionpack (6.0.2.1) lib/action_dispatch/routing/route_set.rb:837:in call' railties (6.0.2.1) lib/rails/engine.rb:526:in
call'
railties (6.0.2.1) lib/rails/railtie.rb:190:in public_send' railties (6.0.2.1) lib/rails/railtie.rb:190:in
method_missing'
actionpack (6.0.2.1) lib/action_dispatch/routing/mapper.rb:19:in block in <class:Constraints>' actionpack (6.0.2.1) lib/action_dispatch/routing/mapper.rb:48:in
serve'
actionpack (6.0.2.1) lib/action_dispatch/journey/router.rb:49:in block in serve' actionpack (6.0.2.1) lib/action_dispatch/journey/router.rb:32:in
each'
actionpack (6.0.2.1) lib/action_dispatch/journey/router.rb:32:in serve' actionpack (6.0.2.1) lib/action_dispatch/routing/route_set.rb:837:in
call'
newrelic_rpm (6.8.0.360) lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in call' newrelic_rpm (6.8.0.360) lib/new_relic/rack/agent_hooks.rb:30:in
traced_call'
newrelic_rpm (6.8.0.360) lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in call' newrelic_rpm (6.8.0.360) lib/new_relic/rack/browser_monitoring.rb:32:in
traced_call'
newrelic_rpm (6.8.0.360) lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in call' versionist (2.0.1) lib/versionist/middleware.rb:39:in
_call'
versionist (2.0.1) lib/versionist/middleware.rb:17:in call' newrelic_rpm (6.8.0.360) lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in
call'
rack (2.1.1) lib/rack/tempfile_reaper.rb:17:in call' newrelic_rpm (6.8.0.360) lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in
call'
rack (2.1.1) lib/rack/etag.rb:27:in call' newrelic_rpm (6.8.0.360) lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in
call'
rack (2.1.1) lib/rack/conditional_get.rb:27:in call' newrelic_rpm (6.8.0.360) lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in
call'
rack (2.1.1) lib/rack/head.rb:14:in call' newrelic_rpm (6.8.0.360) lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in
call'
actionpack (6.0.2.1) lib/action_dispatch/http/content_security_policy.rb:18:in call' newrelic_rpm (6.8.0.360) lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in
call'
rack (2.1.1) lib/rack/session/abstract/id.rb:277:in context' rack (2.1.1) lib/rack/session/abstract/id.rb:271:in
call'
newrelic_rpm (6.8.0.360) lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in call' actionpack (6.0.2.1) lib/action_dispatch/middleware/cookies.rb:648:in
call'
newrelic_rpm (6.8.0.360) lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in call' activerecord (6.0.2.1) lib/active_record/migration.rb:567:in
call'
newrelic_rpm (6.8.0.360) lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in call' actionpack (6.0.2.1) lib/action_dispatch/middleware/callbacks.rb:27:in
block in call'
activesupport (6.0.2.1) lib/active_support/callbacks.rb:101:in run_callbacks' actionpack (6.0.2.1) lib/action_dispatch/middleware/callbacks.rb:26:in
call'
newrelic_rpm (6.8.0.360) lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in call' actionpack (6.0.2.1) lib/action_dispatch/middleware/executor.rb:14:in
call'
newrelic_rpm (6.8.0.360) lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in call' actionpack (6.0.2.1) lib/action_dispatch/middleware/actionable_exceptions.rb:17:in
call'
newrelic_rpm (6.8.0.360) lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in call' rollbar (2.23.2) lib/rollbar/middleware/rails/rollbar.rb:25:in
block in call'
rollbar (2.23.2) lib/rollbar.rb:145:in scoped' rollbar (2.23.2) lib/rollbar/middleware/rails/rollbar.rb:22:in
call'
newrelic_rpm (6.8.0.360) lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in call' actionpack (6.0.2.1) lib/action_dispatch/middleware/debug_exceptions.rb:32:in
call'
rollbar (2.23.2) lib/rollbar/middleware/rails/show_exceptions.rb:22:in call_with_rollbar' newrelic_rpm (6.8.0.360) lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in
call'
web-console (4.0.1) lib/web_console/middleware.rb:132:in call_app' web-console (4.0.1) lib/web_console/middleware.rb:28:in
block in call'
web-console (4.0.1) lib/web_console/middleware.rb:17:in catch' web-console (4.0.1) lib/web_console/middleware.rb:17:in
call'
newrelic_rpm (6.8.0.360) lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in call' actionpack (6.0.2.1) lib/action_dispatch/middleware/show_exceptions.rb:33:in
call'
newrelic_rpm (6.8.0.360) lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in call' railties (6.0.2.1) lib/rails/rack/logger.rb:38:in
call_app'
railties (6.0.2.1) lib/rails/rack/logger.rb:26:in block in call' activesupport (6.0.2.1) lib/active_support/tagged_logging.rb:80:in
block in tagged'
activesupport (6.0.2.1) lib/active_support/tagged_logging.rb:28:in tagged' activesupport (6.0.2.1) lib/active_support/tagged_logging.rb:80:in
tagged'
railties (6.0.2.1) lib/rails/rack/logger.rb:26:in call' newrelic_rpm (6.8.0.360) lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in
call'
sprockets-rails (3.2.1) lib/sprockets/rails/quiet_assets.rb:13:in call' newrelic_rpm (6.8.0.360) lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in
call'
actionpack (6.0.2.1) lib/action_dispatch/middleware/remote_ip.rb:81:in call' newrelic_rpm (6.8.0.360) lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in
call'
request_store (1.5.0) lib/request_store/middleware.rb:19:in call' newrelic_rpm (6.8.0.360) lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in
call'
actionpack (6.0.2.1) lib/action_dispatch/middleware/request_id.rb:27:in call' newrelic_rpm (6.8.0.360) lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in
call'
rack (2.1.1) lib/rack/method_override.rb:24:in call' newrelic_rpm (6.8.0.360) lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in
call'
rack (2.1.1) lib/rack/runtime.rb:24:in call' newrelic_rpm (6.8.0.360) lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in
call'
activesupport (6.0.2.1) lib/active_support/cache/strategy/local_cache_middleware.rb:29:in call' newrelic_rpm (6.8.0.360) lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in
call'
actionpack (6.0.2.1) lib/action_dispatch/middleware/executor.rb:14:in call' newrelic_rpm (6.8.0.360) lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in
call'
actionpack (6.0.2.1) lib/action_dispatch/middleware/static.rb:126:in call' newrelic_rpm (6.8.0.360) lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in
call'
rack (2.1.1) lib/rack/sendfile.rb:113:in call' newrelic_rpm (6.8.0.360) lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in
call'
actionpack (6.0.2.1) lib/action_dispatch/middleware/host_authorization.rb:83:in call' newrelic_rpm (6.8.0.360) lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in
call'
railties (6.0.2.1) lib/rails/engine.rb:526:in call' newrelic_rpm (6.8.0.360) lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in
call'
puma (3.12.2) lib/puma/configuration.rb:227:in call' puma (3.12.2) lib/puma/server.rb:674:in
handle_request'
puma (3.12.2) lib/puma/server.rb:476:in process_client' puma (3.12.2) lib/puma/server.rb:334:in
block in run'
puma (3.12.2) lib/puma/thread_pool.rb:135:in `block in spawn_thread'
As far as I can tell, the only thing holding it back from compatibility is that the markdown parser you use has a C extension. If you took that dependency off or offered an alternative for jruby platform, it'd probably work in both.
seems like just require aiptome in the gemfile isn't enough to get the other libs loaded. i tried a variety of things like loading raddocs
and rspec_api_documentations/dsl
but, nothing. Rails version 4.1.9. rspec 3.1.7
I have some JSON documentation that was generated by the https://github.com/zipmark/rspec_api_documentation gem, and we are using the apitome gem to display the documentation.
I've noticed some of the left-navigation menu items don't highlight correctly. I am not 100% sure whether the problem is with the generation of the JSON or whether it's a problem with the display and the javascript highlighting the left nav and scrolling.
I have created a project in my own (non-work) github repo that's a subset of the work project, just enough to demonstrate the issues. I put that here https://github.com/gayle/api_docs
This is just a barebones generated rails app, where I added the apitome gem, and copied over the JSON files that were generated from my other project into the doc directory of this project. I didn't include the rspec test that generated them for the sake of simplicity, because I suspect it's a javascript problem not something with the JSON.
Here's what happens after I load the http://localhost:3000/api/docs page
When I click 'Certificate':
When I click 'Application' that works as expected
When I click 'Request Status'
One of the issues seems to be that certain menu items, when clicked, get an "active" class added to the DOM element, but others aren't correctly getting the "active" class added for some reason. I wanted to try to fix it myself and contribute to your project. But, wow, that's some complex Javascript. :) I'm impressed. But after adding lots of console.log statements I still couldn't figure out what's triggering 'active'. I'll still help out anyway I can, further troubleshooting or testing or whatever, if that's helpful. If you do see something wrong w/ the JSON itself let me know and I'll see what I can figure out about how it was generated.
I've been using apitome with a single page until today.
Since it's starting to take some time to load the page I've changed the single_page in the initializer to false.
I can load the api home, but when I click on a link in the menu (eg http://localhost:3000/api/docs/activities/fetch_an_activity
) it throws undefined method 'gsub' for nil:NilClass
apitome (0.1.0) app/views/apitome/docs/show.html.erb
<%= render 'example', locals: { example: example, link: example['link'].gsub('.json', '') } %>
This is the content of example
in the web console
>> example
=> {"resource"=>"Activities", "http_method"=>"GET", "route"=>"/api/v1/activities/:id", "description"=>"Fetch an Activity", "explanation"=>"Fetch the details of an existing Activity.", "parameters"=>[{"required"=>true, "name"=>"id", "description"=>"Integer"}, {"name"=>"include ", "description"=>"String - List of related documents types to include in the response, separated by comma"}], "response_fields"=>[], "requests"=>[{"request_method"=>"GET", "request_path"=>"/api/v1/activities/707832245", "request_body"=>nil, "request_headers"=>{"Accept"=>"application/vnd.api+json;revision=1.0", "Content-Type"=>"application/vnd.api+json"}, "request_query_parameters"=>{}, "request_content_type"=>"application/vnd.api+json", "response_status"=>200, "response_status_text"=>"OK", "response_body"=>"{\"activities\":[{\"id\":\"707832245\",\"activity_type\":\"user_created\",\"extra_info\":{},\"created_at\":\"2011-01-01T00:00:00.000Z\",\"href\":\"/api/v1/activities/707832245\",\"links\":{\"user\":\"425868780\"}}],\"meta\":{\"activities\":{\"page\":1,\"page_size\":10,\"count\":1,\"include\":[],\"page_count\":1,\"previous_page\":null,\"next_page\":null,\"first_href\":\"/api/v1/activities?id=707832245\",\"previous_href\":null,\"next_href\":null,\"last_href\":\"/api/v1/activities?id=707832245\"}}}", "response_headers"=>{"Content-Type"=>"application/json; charset=utf-8", "Content-Length"=>"945"}, "response_content_type"=>"application/json; charset=utf-8", "curl"=>"curl \"http://localhost:3000/api/v1/activities/707832245\" -X GET \\\n\t-H \"Accept: application/vnd.api+json;revision=1.0\" \\\n\t-H \"Content-Type: application/vnd.api+json\""}]}
I've also noticed that links in the left menu are all exploded when the page is loaded, it'd be nice to have them compacted like in the single page mode
I am using:
ruby '2.5.1' and 'rails', '5.0.2' and using capistrano for deploying.
When i try to deploy i am getting the error
NameError: uninitialized constant Apitome
/config/initializers/apitome.rb:1:in `<top (required)>'
config/initializer/apitome.rb
Apitome.setup do |config|
config.mount_at = "/api/docs"
config.root = nil
config.doc_path = "doc/api"
config.title = "API Documentation"
config.layout = "apitome/application"
config.code_theme = "default"
config.css_override = nil
config.js_override = nil
config.readme = "../api.md"
config.single_page = true
end
And my spec_helper includes
require 'rails_helper'
require 'rspec_api_documentation'
require 'rspec_api_documentation/dsl'
RspecApiDocumentation.configure do |config|
config.format = [:json, :combined_text, :html]
config.curl_host = 'http://localhost:3000'
config.api_name = 'API'
config.keep_source_order = true
config.docs_dir = Rails.root.join('public', 'docs', 'api')
end
I am not able to solve this problem.
Thanks in advance!
I am extending apitome controller in order to implement authorization for accessing the api docs, as discussed in #22 and #31 :
class ApidocsController < Apitome::DocsController
before_filter :authenticate_user!
end
In order to not pollute the routes, I need to add these entries in routes.rb with the current implementation of partial rendering:
get '/api/docs', to: 'apidocs#index'
get '/simulate/*path', to: 'apidocs#simulate'
get '/*path', to: 'apidocs#show'
Example of such apitome partial rendering:
<%= link_to('Simulated Response', "#{Apitome.configuration.mount_at}/simulate/#{link}") %>
I am happy to implement a more generic solution. For instance, another config param:
config.root_path = '/api/docs'
If nil, it could default to mount_at path.
Then, in the templates, use root_path instead of mount_at.
Does it sound good? Or maybe I am missing something as a rails newbie?
I'd like to restrict access to the documentation to logged-in users. I use devise for authentication. I guess this is not implemented, right?
i modded apitome in my fork:
https://github.com/mooreniemi/apitome/blob/master/app/controllers/apitome/docs_controller.rb
so that i can have a client app hit the end point for live fixtures in jasmine tests. i'll let you know when i have an example client app capable of doing so.
I'm curious about how apitome look, we're currently using slate and I'm kind of bored to write our docs manually.
Using rails 5.2.2.1
and ruby 2.5.5
with apitome 0.3.0
, am getting the following error when access the documentation path:
Failure/Error: click_link 'Documentation'
ActionView::Template::Error:
undefined method `simulated_path' for #<#<Class:0x00007fe01f8d3450>:0x00007fe01f8d1ad8>
My initializer uses default settings, apart from
config.doc_path = "doc/api"
config.title = "The API Documentation"
config.layout = "layouts/apidocs.html.erb"
config.readme = "../api.md"
At the end of my routes file, I have
mount Apitome::Engine => 'apidocs#index'
and I do have authentication using
class ApiController < ActionController::API
include Response
include ExceptionHandler
before_action :authorize_request
attr_reader :current_user
private
def authorize_request
@current_user = (AuthorizeApiRequest.new(request.headers).call)[:user]
end
end
As this looks similar to this issue, I tried
using the master branch and also ref: "c779d67"
, but to no avail. It looks like the problem starts in 0.2.1.
The link provided in Customization section in README is broken and returns 404
.
We don't need to have rspec_api_documentation gem in runtime dependency. It would be better to use it in development dependency. PR has been already created.
I changed config.single_page
from true
to false
, and it started giving Apitome::FileNotFoundError
.
params
are coming as,
{"controller"=>"apitome/docs", "action"=>"show", "path"=>"businesses/5", "format"=>"_getting_list_of_subscription_plans"}
I've set doc description as "5. Getting list of subscription plans", and link for it is generating like
/api/docs/businesses/5._getting_list_of_subscription_plans
.
Seems that, .
in description is causing the issue.
Thoughts ? I can send patch for it, if valid.
I have been trying to figure out if Apitome has a config option on a spec that would skip it during generation instead of just generating all feature specs?
Rails doesn't detect the generator generator apitome:install
as apitome generates the docs, this is how they come out organized on the sidebar (having clicked PoolingLocation as an example):
README
BusinessHoursSchedule
InventoryTransaction
PoolingLocation
DELETE /pooling_locations/:id
GET /pooling_locations
GET /pooling_locations/:id
invalid POST /pooling_locations
invalid PUT /pooling_locations/:id
valid POST /pooling_locations
valid PUT /pooling_locations/:id
PoolingReservation
ReservationService
this corresponds to
post '/pooling_vehicles' do
example_request 'invalid POST /pooling_vehicles' do
this is weirdly organized, as it groups invalid examples together, rather than grouping by verb. could you specify in the documentation the best way to handle this while keeping it readable?
Is code_theme configuration option really implemented? It doesn't seem to work, and looking at the code I don't see where it's really used.
Thanks
This is what I get in production environment:
[2014-12-03 09:34:47.563[FATAL] ActionView::Template::Error (apitome/highlight_themes/default.css isn't precompiled):
3: <head>
4: <title><%= Apitome.configuration.title %></title>
5: <meta name="viewport" content="width=device-width, initial-scale=1.0">
6: <%= stylesheet_link_tag Apitome.configuration.code_theme_url, media: 'all' %>
7: <%= stylesheet_link_tag Apitome.configuration.css_override || 'apitome/application', media: 'all' %>
8: <%= javascript_include_tag Apitome.configuration.js_override || 'apitome/application' %>
9: </head>
actionpack (3.2.18) lib/sprockets/helpers/rails_helper.rb:142:in `digest_for'
actionpack (3.2.18) lib/sprockets/helpers/rails_helper.rb:151:in `rewrite_asset_path'
I want to show api docs for different microservices on a single page. Is it possible to archive that using apitome?
This awesome library uses highlightjs but it's a much older version than current. Would be great to get the new theme styles in. Some templates may need to be changed - not sure if directly including the assets is the best way to go though.
After migrating to Rails 6 the engine stopped working with the next error
ActionView::Template::Error: The asset "apitome/highlight_themes/default.css" is not present in the asset pipeline.
It might me needed to create assets/config/manifest.js
for engine
Hello, Is there a way to add basic auth protection to the docs page?
Great gem.
Unfortunately, after upgrading to get the cool new features, I got this exception for any rake task I launch:
rake aborted!
NoMethodError: undefined method `assets' for #<Rails::Engine::Configuration:0x0000000431ae58>
/home/user/.rvm/gems/ruby-2.1.2@myproject/gems/railties-3.2.18/lib/rails/railtie/configuration.rb:85:in `method_missing'
/home/user/.rvm/gems/ruby-2.1.2@myproject/gems/apitome-0.0.8/lib/apitome/engine.rb:5:in `<class:Engine>'
/home/user/.rvm/gems/ruby-2.1.2@myproject/gems/apitome-0.0.8/lib/apitome/engine.rb:2:in `<module:Apitome>'
/home/user/.rvm/gems/ruby-2.1.2@myproject/gems/apitome-0.0.8/lib/apitome/engine.rb:1:in `<top (required)>'
/home/user/.rvm/gems/ruby-2.1.2@myproject/gems/activesupport-3.2.18/lib/active_support/dependencies.rb:251:in `require'
/home/user/.rvm/gems/ruby-2.1.2@myproject/gems/activesupport-3.2.18/lib/active_support/dependencies.rb:251:in `block in require'
/home/user/.rvm/gems/ruby-2.1.2@myproject/gems/activesupport-3.2.18/lib/active_support/dependencies.rb:236:in `load_dependency'
/home/user/.rvm/gems/ruby-2.1.2@myproject/gems/activesupport-3.2.18/lib/active_support/dependencies.rb:251:in `require'
/home/user/.rvm/gems/ruby-2.1.2@myproject/gems/apitome-0.0.8/lib/apitome.rb:5:in `<top (required)>'
/home/user/.rvm/gems/ruby-2.1.2@global/gems/bundler-1.6.5/lib/bundler/runtime.rb:76:in `require'
/home/user/.rvm/gems/ruby-2.1.2@global/gems/bundler-1.6.5/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
/home/user/.rvm/gems/ruby-2.1.2@global/gems/bundler-1.6.5/lib/bundler/runtime.rb:72:in `each'
/home/user/.rvm/gems/ruby-2.1.2@global/gems/bundler-1.6.5/lib/bundler/runtime.rb:72:in `block in require'
/home/user/.rvm/gems/ruby-2.1.2@global/gems/bundler-1.6.5/lib/bundler/runtime.rb:61:in `each'
/home/user/.rvm/gems/ruby-2.1.2@global/gems/bundler-1.6.5/lib/bundler/runtime.rb:61:in `require'
/home/user/.rvm/gems/ruby-2.1.2@global/gems/bundler-1.6.5/lib/bundler.rb:132:in `require'
/home/user/projects/myproject/config/application.rb:7:in `<top (required)>'
/home/user/projects/myproject/Rakefile:5:in `require'
/home/user/projects/myproject/Rakefile:5:in `<top (required)>'
/home/user/.rvm/gems/ruby-2.1.2@myproject/bin/ruby_executable_hooks:15:in `eval'
/home/user/.rvm/gems/ruby-2.1.2@myproject/bin/ruby_executable_hooks:15:in `<main>'
(See full trace by running task with --trace)
Documentation mentions a configuration option for setting the parent controller with "parent_controller" key. But this raises undefined method parent_controller exception. What is the option then?
Thanks.
There are log files in there that are not needed in the repository.
What is the problem here? Anyone else has this issue?
Missing template apitome/docs/simulate with {:locale=>[:de], :formats=>[:html], :variants=>[], :handlers=>[:raw, :erb, :html, :builder, :ruby, :haml, :jbuilder]}.
This occures when I click the simulate button in the generated docs.
If I attempt to override the _example.html.erb
with:
<header>
<h3><%= example['description'] %></h3>
</header>
<%= render partial: 'explanation', locals: {explaination: example['explanation']} if example['explanation'] %>
<%= render partial: 'params', locals: {params: example['parameters']} if example['parameters'].size > 0 %>
<% example['requests'].each_with_index do |request, index| %>
<div id="<%= "request-#{index}" %>">
<h3><%= t(:request) %></h3>
<div class="request">
<%= render partial: 'route', locals: {request: request, index: index} %>
<%= render partial: 'headers', locals: {request: request, index: index, headers: request['request_headers']} %>
<%= render partial: 'query', locals: {request: request, index: index} unless request['request_query_parameters'].empty? %>
<%= render partial: 'body', locals: {request: request, index: index, body: request['request_body'], type: request['request_content_type']} if request['request_body'] %>
<%= render partial: 'curl', locals: {request: request, index: index} if request['curl'] %>
</div>
<h3><%= t(:response) %></h3>
<div class="response">
<%= render partial: 'response_fields', locals: {params: example['response_fields']} if example['response_fields'].size > 0 %>
<%= render partial: 'status', locals: {request: request, index: index} %>
<%= render partial: 'headers', locals: {request: request, index: index, headers: request['response_headers']} %>
<%= render partial: 'body', locals: {request: request, index: index, body: request['response_body'], type: request['response_content_type']} if request['response_body'] %>
</div>
</div>
<% end %>
Apitome blows up...
I have to remove:
<%= render partial: 'response_fields', locals: {params: example['response_fields']} if example['response_fields'].size > 0 %>
to fix the issue.. thoughts?
When using with Rails API, 5.2.2
and running rails generate apitome:install
it fails with errors:
/Users/Serguei/.rvm/gems/ruby-2.6.1/gems/railties-5.2.1/lib/rails/railtie/configuration.rb:97:in `method_missing': undefined method `assets' for #<Rails::Engine::Configuration:0x00007ff03542cc78> (NoMethodError)
from /Users/Serguei/.rvm/gems/ruby-2.6.1/gems/apitome-0.2.1/lib/apitome/engine.rb:8:in `<class:Engine>'
from /Users/Serguei/.rvm/gems/ruby-2.6.1/gems/apitome-0.2.1/lib/apitome/engine.rb:2:in `<module:Apitome>'
from /Users/Serguei/.rvm/gems/ruby-2.6.1/gems/apitome-0.2.1/lib/apitome/engine.rb:1:in `<main>'
from /Users/Serguei/.rvm/gems/ruby-2.6.1/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require'
from /Users/Serguei/.rvm/gems/ruby-2.6.1/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `block in require_with_bootsnap_lfi'
from /Users/Serguei/.rvm/gems/ruby-2.6.1/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/loaded_features_index.rb:65:in `register'
from /Users/Serguei/.rvm/gems/ruby-2.6.1/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:20:in `require_with_bootsnap_lfi'
from /Users/Serguei/.rvm/gems/ruby-2.6.1/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:29:in `require'
from /Users/Serguei/.rvm/gems/ruby-2.6.1/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:287:in `block in require'
from /Users/Serguei/.rvm/gems/ruby-2.6.1/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:253:in `load_dependency'
from /Users/Serguei/.rvm/gems/ruby-2.6.1/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:287:in `require'
from /Users/Serguei/.rvm/gems/ruby-2.6.1/gems/apitome-0.2.1/lib/apitome.rb:7:in `<main>'
from /Users/Serguei/.rvm/gems/ruby-2.6.1/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require'
from /Users/Serguei/.rvm/gems/ruby-2.6.1/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `block in require_with_bootsnap_lfi'
from /Users/Serguei/.rvm/gems/ruby-2.6.1/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/loaded_features_index.rb:65:in `register'
from /Users/Serguei/.rvm/gems/ruby-2.6.1/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:20:in `require_with_bootsnap_lfi'
from /Users/Serguei/.rvm/gems/ruby-2.6.1/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:29:in `require'
from /Users/Serguei/.rvm/rubies/ruby-2.6.1/lib/ruby/site_ruby/2.6.0/bundler/runtime.rb:81:in `block (2 levels) in require'
from /Users/Serguei/.rvm/rubies/ruby-2.6.1/lib/ruby/site_ruby/2.6.0/bundler/runtime.rb:76:in `each'
from /Users/Serguei/.rvm/rubies/ruby-2.6.1/lib/ruby/site_ruby/2.6.0/bundler/runtime.rb:76:in `block in require'
from /Users/Serguei/.rvm/rubies/ruby-2.6.1/lib/ruby/site_ruby/2.6.0/bundler/runtime.rb:65:in `each'
from /Users/Serguei/.rvm/rubies/ruby-2.6.1/lib/ruby/site_ruby/2.6.0/bundler/runtime.rb:65:in `require'
from /Users/Serguei/.rvm/rubies/ruby-2.6.1/lib/ruby/site_ruby/2.6.0/bundler.rb:114:in `require'
from /Users/Serguei/projects/rails/draft-api/config/application.rb:18:in `<top (required)>'
from /Users/Serguei/.rvm/gems/ruby-2.6.1/gems/spring-2.0.2/lib/spring/application.rb:92:in `require'
from /Users/Serguei/.rvm/gems/ruby-2.6.1/gems/spring-2.0.2/lib/spring/application.rb:92:in `preload'
from /Users/Serguei/.rvm/gems/ruby-2.6.1/gems/spring-2.0.2/lib/spring/application.rb:153:in `serve'
from /Users/Serguei/.rvm/gems/ruby-2.6.1/gems/spring-2.0.2/lib/spring/application.rb:141:in `block in run'
from /Users/Serguei/.rvm/gems/ruby-2.6.1/gems/spring-2.0.2/lib/spring/application.rb:135:in `loop'
from /Users/Serguei/.rvm/gems/ruby-2.6.1/gems/spring-2.0.2/lib/spring/application.rb:135:in `run'
from /Users/Serguei/.rvm/gems/ruby-2.6.1/gems/spring-2.0.2/lib/spring/application/boot.rb:19:in `<top (required)>'
from /Users/Serguei/.rvm/rubies/ruby-2.6.1/lib/ruby/site_ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /Users/Serguei/.rvm/rubies/ruby-2.6.1/lib/ruby/site_ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from -e:1:in `<main>'
What am I missing ?
I'm using
Ruby 2.6.1
Rails API 5.2.2
macOS
Thank you.
We have this problem when access Apitome on Linux.
In osx work great. But in linux we have this error:
Started GET "/api/docs" for 127.0.0.1 at 2014-01-31 10:53:16 -0200
Processing by Apitome::DocsController#index as HTML
Rendered apitome/docs/_all_examples.html.erb (1.8ms)
Rendered apitome/docs/index.html.erb within layouts/apitome/application (2.9ms)
Completed 500 Internal Server Error in 5ms
Apitome::FileNotFound - Apitome::FileNotFound:
apitome (0.0.4) app/controllers/apitome/docs_controller.rb:17:in `file_for'
apitome (0.0.4) app/controllers/apitome/docs_controller.rb:30:in `set_example'
actionpack (3.2.13) lib/abstract_controller/helpers.rb:53:in `set_example'
app/views/apitome/docs/_all_examples.html.erb:6:in `block (2 levels) in _app_views_apitome_docs__all_examples_html_erb__1177919334922981887_39658920'
app/views/apitome/docs/_all_examples.html.erb:4:in `block in _app_views_apitome_docs__all_examples_html_erb__1177919334922981887_39658920'
app/views/apitome/docs/_all_examples.html.erb:1:in `_app_views_apitome_docs__all_examples_html_erb__1177919334922981887_39658920'
actionpack (3.2.13) lib/action_view/template.rb:145:in `block in render'
activesupport (3.2.13) lib/active_support/notifications.rb:125:in `instrument'
actionpack (3.2.13) lib/action_view/template.rb:143:in `render'
actionpack (3.2.13) lib/action_view/renderer/partial_renderer.rb:265:in `render_partial'
actionpack (3.2.13) lib/action_view/renderer/partial_renderer.rb:238:in `block in render'
actionpack (3.2.13) lib/action_view/renderer/abstract_renderer.rb:38:in `block in instrument'
activesupport (3.2.13) lib/active_support/notifications.rb:123:in `block in instrument'
activesupport (3.2.13) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (3.2.13) lib/active_support/notifications.rb:123:in `instrument'
actionpack (3.2.13) lib/action_view/renderer/abstract_renderer.rb:38:in `instrument'
actionpack (3.2.13) lib/action_view/renderer/partial_renderer.rb:237:in `render'
actionpack (3.2.13) lib/action_view/renderer/renderer.rb:41:in `render_partial'
actionpack (3.2.13) lib/action_view/helpers/rendering_helper.rb:27:in `render'
app/views/apitome/docs/index.html.erb:6:in `_app_views_apitome_docs_index_html_erb__3195967804236131545_17532200'
actionpack (3.2.13) lib/action_view/template.rb:145:in `block in render'
activesupport (3.2.13) lib/active_support/notifications.rb:125:in `instrument'
actionpack (3.2.13) lib/action_view/template.rb:143:in `render'
actionpack (3.2.13) lib/action_view/renderer/template_renderer.rb:47:in `block (2 levels) in render_template'
actionpack (3.2.13) lib/action_view/renderer/abstract_renderer.rb:38:in `block in instrument'
activesupport (3.2.13) lib/active_support/notifications.rb:123:in `block in instrument'
activesupport (3.2.13) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (3.2.13) lib/active_support/notifications.rb:123:in `instrument'
actionpack (3.2.13) lib/action_view/renderer/abstract_renderer.rb:38:in `instrument'
actionpack (3.2.13) lib/action_view/renderer/template_renderer.rb:46:in `block in render_template'
actionpack (3.2.13) lib/action_view/renderer/template_renderer.rb:54:in `render_with_layout'
actionpack (3.2.13) lib/action_view/renderer/template_renderer.rb:45:in `render_template'
actionpack (3.2.13) lib/action_view/renderer/template_renderer.rb:18:in `render'
actionpack (3.2.13) lib/action_view/renderer/renderer.rb:36:in `render_template'
actionpack (3.2.13) lib/action_view/renderer/renderer.rb:17:in `render'
actionpack (3.2.13) lib/abstract_controller/rendering.rb:110:in `_render_template'
actionpack (3.2.13) lib/action_controller/metal/streaming.rb:225:in `_render_template'
actionpack (3.2.13) lib/abstract_controller/rendering.rb:103:in `render_to_body'
actionpack (3.2.13) lib/action_controller/metal/renderers.rb:28:in `render_to_body'
actionpack (3.2.13) lib/action_controller/metal/compatibility.rb:50:in `render_to_body'
actionpack (3.2.13) lib/abstract_controller/rendering.rb:88:in `render'
actionpack (3.2.13) lib/action_controller/metal/rendering.rb:16:in `render'
actionpack (3.2.13) lib/action_controller/metal/instrumentation.rb:40:in `block (2 levels) in render'
activesupport (3.2.13) lib/active_support/core_ext/benchmark.rb:5:in `block in ms'
/usr/lib/ruby/1.9.1/benchmark.rb:295:in `realtime'
activesupport (3.2.13) lib/active_support/core_ext/benchmark.rb:5:in `ms'
actionpack (3.2.13) lib/action_controller/metal/instrumentation.rb:40:in `block in render'
actionpack (3.2.13) lib/action_controller/metal/instrumentation.rb:83:in `cleanup_view_runtime'
activerecord (3.2.13) lib/active_record/railties/controller_runtime.rb:24:in `cleanup_view_runtime'
tire-contrib (0.1.3) lib/tire/rails/logger/controller_runtime.rb:14:in `cleanup_view_runtime'
actionpack (3.2.13) lib/action_controller/metal/instrumentation.rb:39:in `render'
actionpack (3.2.13) lib/action_controller/metal/implicit_render.rb:10:in `default_render'
actionpack (3.2.13) lib/action_controller/metal/implicit_render.rb:5:in `send_action'
actionpack (3.2.13) lib/abstract_controller/base.rb:167:in `process_action'
actionpack (3.2.13) lib/action_controller/metal/rendering.rb:10:in `process_action'
actionpack (3.2.13) lib/abstract_controller/callbacks.rb:18:in `block in process_action'
activesupport (3.2.13) lib/active_support/callbacks.rb:425:in `_run__3502535296246227906__process_action__1093324822614988833__callbacks'
activesupport (3.2.13) lib/active_support/callbacks.rb:405:in `__run_callback'
activesupport (3.2.13) lib/active_support/callbacks.rb:385:in `_run_process_action_callbacks'
activesupport (3.2.13) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (3.2.13) lib/abstract_controller/callbacks.rb:17:in `process_action'
actionpack (3.2.13) lib/action_controller/metal/rescue.rb:29:in `process_action'
actionpack (3.2.13) lib/action_controller/metal/instrumentation.rb:30:in `block in process_action'
activesupport (3.2.13) lib/active_support/notifications.rb:123:in `block in instrument'
activesupport (3.2.13) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (3.2.13) lib/active_support/notifications.rb:123:in `instrument'
actionpack (3.2.13) lib/action_controller/metal/instrumentation.rb:29:in `process_action'
actionpack (3.2.13) lib/action_controller/metal/params_wrapper.rb:207:in `process_action'
activerecord (3.2.13) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
actionpack (3.2.13) lib/abstract_controller/base.rb:121:in `process'
actionpack (3.2.13) lib/abstract_controller/rendering.rb:45:in `process'
actionpack (3.2.13) lib/action_controller/metal.rb:203:in `dispatch'
actionpack (3.2.13) lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
actionpack (3.2.13) lib/action_controller/metal.rb:246:in `block in action'
actionpack (3.2.13) lib/action_dispatch/routing/route_set.rb:73:in `dispatch'
actionpack (3.2.13) lib/action_dispatch/routing/route_set.rb:36:in `call'
journey (1.0.4) lib/journey/router.rb:68:in `block in call'
journey (1.0.4) lib/journey/router.rb:56:in `call'
actionpack (3.2.13) lib/action_dispatch/routing/route_set.rb:612:in `call'
railties (3.2.13) lib/rails/engine.rb:479:in `call'
railties (3.2.13) lib/rails/railtie/configurable.rb:30:in `method_missing'
journey (1.0.4) lib/journey/router.rb:68:in `block in call'
journey (1.0.4) lib/journey/router.rb:56:in `call'
actionpack (3.2.13) lib/action_dispatch/routing/route_set.rb:612:in `call'
meta_request (0.2.8) lib/meta_request/middlewares/app_request_handler.rb:13:in `call'
rack-contrib (1.1.0) lib/rack/contrib/response_headers.rb:17:in `call'
meta_request (0.2.8) lib/meta_request/middlewares/headers.rb:16:in `call'
meta_request (0.2.8) lib/meta_request/middlewares/meta_request_handler.rb:13:in `call'
warden (1.2.3) lib/warden/manager.rb:35:in `block in call'
warden (1.2.3) lib/warden/manager.rb:34:in `call'
actionpack (3.2.13) lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
rack (1.4.5) lib/rack/etag.rb:23:in `call'
rack (1.4.5) lib/rack/conditionalget.rb:25:in `call'
actionpack (3.2.13) lib/action_dispatch/middleware/head.rb:14:in `call'
actionpack (3.2.13) lib/action_dispatch/middleware/params_parser.rb:21:in `call'
actionpack (3.2.13) lib/action_dispatch/middleware/flash.rb:242:in `call'
rack (1.4.5) lib/rack/session/abstract/id.rb:210:in `context'
rack (1.4.5) lib/rack/session/abstract/id.rb:205:in `call'
actionpack (3.2.13) lib/action_dispatch/middleware/cookies.rb:341:in `call'
activerecord (3.2.13) lib/active_record/query_cache.rb:64:in `call'
activerecord (3.2.13) lib/active_record/connection_adapters/abstract/connection_pool.rb:479:in `call'
actionpack (3.2.13) lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
activesupport (3.2.13) lib/active_support/callbacks.rb:405:in `_run__435750210335531878__call__2243942583549576752__callbacks'
activesupport (3.2.13) lib/active_support/callbacks.rb:405:in `__run_callback'
activesupport (3.2.13) lib/active_support/callbacks.rb:385:in `_run_call_callbacks'
activesupport (3.2.13) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (3.2.13) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
actionpack (3.2.13) lib/action_dispatch/middleware/reloader.rb:65:in `call'
actionpack (3.2.13) lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
better_errors (1.1.0) lib/better_errors/middleware.rb:84:in `protected_app_call'
better_errors (1.1.0) lib/better_errors/middleware.rb:79:in `better_errors_call'
better_errors (1.1.0) lib/better_errors/middleware.rb:56:in `call'
actionpack (3.2.13) lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
actionpack (3.2.13) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
railties (3.2.13) lib/rails/rack/logger.rb:32:in `call_app'
railties (3.2.13) lib/rails/rack/logger.rb:16:in `block in call'
activesupport (3.2.13) lib/active_support/tagged_logging.rb:22:in `tagged'
railties (3.2.13) lib/rails/rack/logger.rb:16:in `call'
quiet_assets (1.0.2) lib/quiet_assets.rb:18:in `call_with_quiet_assets'
actionpack (3.2.13) lib/action_dispatch/middleware/request_id.rb:22:in `call'
rack (1.4.5) lib/rack/methodoverride.rb:21:in `call'
rack (1.4.5) lib/rack/runtime.rb:17:in `call'
activesupport (3.2.13) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
rack (1.4.5) lib/rack/lock.rb:15:in `call'
actionpack (3.2.13) lib/action_dispatch/middleware/static.rb:63:in `call'
railties (3.2.13) lib/rails/engine.rb:479:in `call'
railties (3.2.13) lib/rails/application.rb:223:in `call'
rack (1.4.5) lib/rack/content_length.rb:14:in `call'
railties (3.2.13) lib/rails/rack/log_tailer.rb:17:in `call'
thin (1.6.1) lib/thin/connection.rb:82:in `block in pre_process'
thin (1.6.1) lib/thin/connection.rb:80:in `pre_process'
thin (1.6.1) lib/thin/connection.rb:55:in `process'
thin (1.6.1) lib/thin/connection.rb:41:in `receive_data'
eventmachine (1.0.3) lib/eventmachine.rb:187:in `run'
thin (1.6.1) lib/thin/backends/base.rb:73:in `start'
thin (1.6.1) lib/thin/server.rb:162:in `start'
rack (1.4.5) lib/rack/handler/thin.rb:13:in `run'
rack (1.4.5) lib/rack/server.rb:268:in `start'
railties (3.2.13) lib/rails/commands/server.rb:70:in `start'
railties (3.2.13) lib/rails/commands.rb:55:in `block in <top (required)>'
railties (3.2.13) lib/rails/commands.rb:50:in `<top (required)>'
script/rails:6:in `<main>'
script/rails:0:in `<main>'
Started POST "/api/docs/__better_errors/42918820/variables" for 127.0.0.1 at 2014-01-31 10:53:16 -0200
I asked the following question on SO but received no answer.
I am using the rspec_api_documentation
and apitome
gems in a version 5.2 ruby on rails app.
This produces excellent documentation, and has a sidebar (div#sidebar) to allow quick access to the correct part of the documentation. When I choose the
config.layout = "layouts/application.html.erb"
option in the apitome.rb
initializer, the documentation is rendered, but the sidebar has disappeared. Looking at the page source, the code for the sidebar is not being rendered, i.e. it is not a css problem, the sidebar html is not being put into the layout. To make sure it was not something unusual in my application.html.erb file, I simplified it to this
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<%= yield %>
</body>
</html>
This sidebar is very useful, so how do I render it in a layout?
I cannot redirect Apitome routes.
Per #36, I have done the following:
# config/initializers/apitome.rb
Apitome.setup do |config|
config.mount_at = nil
end
And added my custom routing
# config/routes.rb
Rails.routes.draw do
namespace :docs, constraints: {subdomain: 'api'} do
namespace :v1 do
mount Apitome::Engine => '/'
end
end
end
$ rails routes
Prefix Verb URI Pattern Controller#Action
docs_v1_apitome /docs/v1 Apitome::Engine {:subdomain=>"api"}
Routes for Apitome::Engine:
root GET / apitome/docs#index
simulated GET /simulate/*path(.:format) apitome/docs#simulate
rails s
and Visiting api.localhost:3000/docs/v1 raises ActionController::RoutingError (No route matches [GET] "/docs/v1")
I have also tried writing out explicitly the Apitome routes, which gives me new routes, but they don't work:
# ...
# mount Apitome::Engine => '/'
root to: "doc#index"
get "/simulate/*path", to: "doc#simulate"
get "/*path", to: "doc#show"
$ rails routes
Prefix Verb URI Pattern Controller#Action
apitome /api/docs Apitome::Engine
docs_v1_root GET /docs/v1(.:format) docs/v1/doc#index {:subdomain=>"api"}
docs_v1 GET /docs/v1/simulate/*path(.:format) docs/v1/doc#simulate {:subdomain=>"api"}
GET /docs/v1/*path(.:format) docs/v1/doc#show {:subdomain=>"api"}
Again, rails s
and Visiting api.localhost:3000/docs/v1 raises ActionController::RoutingError (No route matches [GET] "/docs/v1")
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.