richhollis / swagger-docs

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

Do not depend on "rails" gem, depend on parts of Rails that swagger-docs uses #172

Open adamniedzielski opened 7 years ago

adamniedzielski commented 7 years ago

Description

swagger-docs specifies a dependency on rails gem - https://github.com/richhollis/swagger-docs/blob/372e05ce944860ea35ca3496564492ae1e502100/swagger-docs.gemspec#L29

rails is just an "umbrella gem" that depends on all the components of Ruby on Rails framework - https://github.com/rails/rails/blob/86ca5b254109e64edeb6e142e656b8a8c247cac8/rails.gemspec - ActiveSupport, ActionPack, ActiveRecord, ...

I want to avoid installing actioncable gem in my Rails application. When swagger-docs specifies rails gem as a dependency then actioncable becomes my transitive dependency automatically and there is no way to avoid installing it.

Proposal

Depend only on these parts of Rails that swagger-docs actually uses, for example:

spec.add_runtime_dependency "activerecord", ">= 3"
spec.add_runtime_dependency "activesupport", ">= 3"

I'm happy to make a PR if you accept the change.

richhollis commented 7 years ago

Hi Adam

Open to PR on this - makes sense.

Rich