richhollis / swagger-docs

Generates swagger-ui json files for Rails APIs with a simple DSL.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Does not work transform_path

viveki2it opened this issue · comments

I have added to below code to the my initializers config file.

class Swagger::Docs::Config
def self.transform_path(path, api_version)
# Make a distinction between the APIs and API documentation paths.
"apidocs/#{path}"
end

end

But it is not creating the current paths ...

Please let me know what i have to do ?

commented

The documentation says that the transform_path transformation will be applied to all API path values in the generated api-docs.json file, so this does NOT change the location of generated docs.

You need to use :api_file_path option in conjunction with the transform_path to change the location.

class Swagger::Docs::Config
  def self.transform_path(path, api_version)
    "api-docs/#{path}"
  end
end

Swagger::Docs::Config.register_apis(
  'v1': {
    api_file_path: 'public/api-docs',
   ...
)