richhollis / swagger-docs

Generates swagger-ui json files for Rails APIs with a simple DSL.
MIT License
749 stars 150 forks source link

Does not work transform_path #149

Open viveki2it opened 8 years ago

viveki2it commented 8 years ago

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 ?

legendetm commented 7 years ago

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',
   ...
)