3

I am using apipie gem for api documentation. Under my api folder, there is one version**(api/v1)

When I access http://localhost:3000/apipie it shows me the documentation but when clicking on api document url ie POST /api/chats

It redirects to http://localhost:3000/apipie/public/chats/create.en.html

It displays error Oops!! Method create.en not found for resource chats.

But when I remove .en form url manually it displays right api documentation. ie http://localhost:3000/apipie/public/chats/create.html.

I am confusing why api doc redirect to .en.html and how I avoid adding .en in api doc url.

sschrass
  • 7,014
  • 6
  • 43
  • 62
Pankaj
  • 150
  • 1
  • 6

2 Answers2

8

This is an bug which is already reported here

You can fix the problem by adding following line into apipie.rb file

config.translate = false
Ganesh
  • 1,924
  • 1
  • 18
  • 31
0

If you dont want to translate, you can add the following to apipie.rb file

config.translate = false

or if you want to translate and if you are using I18n to translate you can simply use

config.languages                = %w[en fr] #replace this with list of #locales you use in your app
  config.default_locale           = 'en'
  config.locale                   = lambda { |loc| loc ? I18n.locale = loc : I18n.locale }
  config.translate                = lambda do |str, loc|
    return '' if str.blank?

    I18n.t str, locale: loc, scope: 'doc'
  end