├── .github └── workflows │ ├── danger.yml │ ├── head.yml │ ├── rubocop.yml │ └── test.yml ├── .gitignore ├── .rspec ├── .rubocop.yml ├── .rubocop_todo.yml ├── .ruby-gemset ├── CHANGELOG.md ├── CONTRIBUTING.md ├── Dangerfile ├── Gemfile ├── LICENSE.txt ├── README.md ├── RELEASING.md ├── Rakefile ├── UPGRADING.md ├── app ├── assets │ ├── config │ │ └── grape_swagger_rails_manifest.js │ ├── images │ │ └── grape_swagger_rails │ │ │ ├── collapse.gif │ │ │ ├── expand.gif │ │ │ ├── explorer_icons.png │ │ │ ├── favicon-16x16.png │ │ │ ├── favicon-32x32.png │ │ │ ├── favicon.ico │ │ │ ├── logo_small.png │ │ │ ├── pet_store_api.png │ │ │ ├── throbber.gif │ │ │ └── wordnik_api.png │ ├── javascripts │ │ └── grape_swagger_rails │ │ │ ├── application.js │ │ │ ├── backbone-min.js │ │ │ ├── base64.js │ │ │ ├── es5-shim.js │ │ │ ├── handlebars-2.0.0.js │ │ │ ├── highlight.9.1.0.pack.js │ │ │ ├── highlight.9.1.0.pack_extended.js │ │ │ ├── jquery-1.8.0.min.js │ │ │ ├── jquery.ba-bbq.min.js │ │ │ ├── jquery.slideto.min.js │ │ │ ├── jquery.wiggle.min.js │ │ │ ├── js-yaml.min.js │ │ │ ├── jsoneditor.min.js │ │ │ ├── lodash.min.js │ │ │ ├── marked.js │ │ │ ├── object-assign-pollyfill.js │ │ │ ├── swagger-oauth.js │ │ │ └── swagger-ui.min.js │ └── stylesheets │ │ └── grape_swagger_rails │ │ ├── application.css │ │ ├── print.css │ │ ├── reset.css │ │ ├── screen.css.erb │ │ ├── style.css │ │ └── typography.css ├── controllers │ └── grape_swagger_rails │ │ └── application_controller.rb └── views │ └── grape_swagger_rails │ └── application │ └── index.html.erb ├── config └── routes.rb ├── grape-swagger-rails.gemspec ├── lib ├── grape-swagger-rails.rb ├── grape-swagger-rails │ ├── engine.rb │ └── version.rb ├── javascripts │ └── base64.js ├── script │ └── rails └── tasks │ └── swagger_ui.rake └── spec ├── dummy ├── .gitignore ├── Rakefile ├── app │ ├── api │ │ └── api.rb │ ├── assets │ │ ├── config │ │ │ └── manifest.js │ │ ├── javascripts │ │ │ └── application.js │ │ └── stylesheets │ │ │ └── application.css │ ├── controllers │ │ ├── application_controller.rb │ │ └── welcome_controller.rb │ └── views │ │ ├── layouts │ │ ├── _messages.html.erb │ │ └── application.html.erb │ │ └── welcome │ │ └── index.html.erb ├── bin │ ├── rails │ ├── rake │ └── setup ├── config.ru ├── config │ ├── application.rb │ ├── boot.rb │ ├── environment.rb │ ├── environments │ │ ├── development.rb │ │ ├── production.rb │ │ └── test.rb │ ├── initializers │ │ ├── assets.rb │ │ ├── filter_parameter_logging.rb │ │ ├── inflections.rb │ │ └── swagger.rb │ ├── routes.rb │ └── secrets.yml └── public │ ├── .gitignore │ ├── 404.html │ ├── 422.html │ ├── 500.html │ ├── favicon.ico │ └── robots.txt ├── features ├── grape-swagger-rails_spec.rb ├── swagger_spec.rb └── welcome_spec.rb ├── spec_helper.rb └── support ├── capybara.rb └── rails.rb /.github/workflows/danger.yml: -------------------------------------------------------------------------------- 1 | name: Danger 2 | on: [pull_request] 3 | jobs: 4 | lint: 5 | runs-on: ubuntu-latest 6 | steps: 7 | - uses: actions/checkout@v3 8 | with: 9 | fetch-depth: 0 10 | - name: Set up Ruby 11 | uses: ruby/setup-ruby@v1 12 | with: 13 | ruby-version: "2.7" 14 | bundler-cache: true 15 | - name: Run Danger 16 | run: | 17 | # the token is public, has public_repo scope and belongs to the grape-bot user owned by @dblock, this is ok 18 | TOKEN=$(echo -n Z2hwX2lYb0dPNXNyejYzOFJyaTV3QUxUdkNiS1dtblFwZTFuRXpmMwo= | base64 --decode) 19 | DANGER_GITHUB_API_TOKEN=$TOKEN bundle exec danger --verbose 20 | -------------------------------------------------------------------------------- /.github/workflows/head.yml: -------------------------------------------------------------------------------- 1 | name: Tests (HEAD) 2 | on: [pull_request] 3 | jobs: 4 | test: 5 | runs-on: ubuntu-latest 6 | continue-on-error: true 7 | strategy: 8 | fail-fast: false 9 | matrix: 10 | entry: 11 | - { ruby: "3.2", rails: "edge", grape-swagger: "HEAD" } 12 | - { ruby: "ruby-head", rails: "edge", grape-swagger: "HEAD" } 13 | - { ruby: "jruby-head", rails: "edge", grape-swagger: "HEAD" } 14 | env: 15 | GRAPE_SWAGGER_VERSION: ${{ matrix.entry.grape-swagger }} 16 | RAILS_VERSION: ${{ matrix.entry.rails }} 17 | steps: 18 | - uses: actions/checkout@v3 19 | - name: Set up Ruby 20 | uses: ruby/setup-ruby@v1 21 | with: 22 | ruby-version: ${{ matrix.entry.ruby }} 23 | bundler-cache: true 24 | - name: Print Bundler Versions 25 | run: bundle show 26 | - name: Setup Firefox 27 | uses: browser-actions/setup-firefox@v1 28 | with: 29 | firefox-version: "130.0" 30 | - uses: browser-actions/setup-geckodriver@latest 31 | with: 32 | geckodriver-version: "0.35.0" 33 | - uses: coactions/setup-xvfb@v1 34 | with: 35 | run: bundle exec rake spec 36 | -------------------------------------------------------------------------------- /.github/workflows/rubocop.yml: -------------------------------------------------------------------------------- 1 | name: Rubocop 2 | on: [pull_request] 3 | jobs: 4 | rubocop: 5 | runs-on: ubuntu-latest 6 | steps: 7 | - uses: actions/checkout@v3 8 | - name: Set up Ruby 9 | uses: ruby/setup-ruby@v1 10 | with: 11 | ruby-version: "3.2" 12 | bundler-cache: true 13 | - name: Run Rubocop 14 | run: bundle exec rubocop 15 | -------------------------------------------------------------------------------- /.github/workflows/test.yml: -------------------------------------------------------------------------------- 1 | name: Tests 2 | on: [push, pull_request] 3 | jobs: 4 | test: 5 | runs-on: ubuntu-latest 6 | strategy: 7 | fail-fast: false 8 | matrix: 9 | entry: 10 | - { ruby: "2.7", rails: "6.1.7", grape-swagger: "1.6.1" } 11 | - { ruby: "3.0", rails: "6.1.7", grape-swagger: "1.6.1" } 12 | - { ruby: "3.1", rails: "6.1.7", grape-swagger: "1.6.1" } 13 | - { ruby: "3.1", rails: "7.2.1", grape-swagger: "1.6.1" } 14 | - { ruby: "3.2", rails: "6.1.7", grape-swagger: "1.6.1" } 15 | - { ruby: "3.2", rails: "6.1.7", grape-swagger: "2.1.1" } 16 | - { ruby: "3.2", rails: "7.2.1", grape-swagger: "1.6.1" } 17 | - { ruby: "3.2", rails: "7.2.1", grape-swagger: "2.1.1" } 18 | - { ruby: "3.3", rails: "6.1.7", grape-swagger: "1.6.1" } 19 | - { ruby: "3.3", rails: "6.1.7", grape-swagger: "2.1.1" } 20 | - { ruby: "3.3", rails: "7.2.1", grape-swagger: "1.6.1" } 21 | - { ruby: "3.3", rails: "7.2.1", grape-swagger: "2.1.1" } 22 | - { ruby: "jruby-9.4.6", rails: "6.1.7", grape-swagger: "1.6.1" } 23 | - { ruby: "jruby-9.4.6", rails: "6.1.7", grape-swagger: "2.1.1" } 24 | - { ruby: "jruby-9.4.6", rails: "7.2.1", grape-swagger: "1.6.1" } 25 | - { ruby: "jruby-9.4.6", rails: "7.2.1", grape-swagger: "2.1.1" } 26 | env: 27 | GRAPE_SWAGGER_VERSION: ${{ matrix.entry.grape-swagger }} 28 | RAILS_VERSION: ${{ matrix.entry.rails }} 29 | steps: 30 | - uses: actions/checkout@v3 31 | - name: Set up Ruby 32 | uses: ruby/setup-ruby@v1 33 | with: 34 | ruby-version: ${{ matrix.entry.ruby }} 35 | bundler-cache: true 36 | - name: Print Bundler Versions 37 | run: bundle show 38 | - name: Setup Firefox 39 | uses: browser-actions/setup-firefox@v1 40 | with: 41 | firefox-version: "130.0" 42 | - uses: browser-actions/setup-geckodriver@latest 43 | with: 44 | geckodriver-version: "0.35.0" 45 | - uses: coactions/setup-xvfb@v1 46 | with: 47 | run: bundle exec rake spec 48 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.gem 2 | *.rbc 3 | .bundle 4 | .config 5 | .yardoc 6 | Gemfile.lock 7 | InstalledFiles 8 | _yardoc 9 | coverage 10 | doc/ 11 | lib/bundler/man 12 | pkg 13 | rdoc 14 | spec/reports 15 | test/tmp 16 | test/version_tmp 17 | tmp 18 | .idea 19 | .project -------------------------------------------------------------------------------- /.rspec: -------------------------------------------------------------------------------- 1 | --color 2 | --require spec_helper 3 | --format documentation 4 | -------------------------------------------------------------------------------- /.rubocop.yml: -------------------------------------------------------------------------------- 1 | AllCops: 2 | TargetRubyVersion: 2.7 3 | NewCops: enable 4 | 5 | inherit_from: .rubocop_todo.yml 6 | 7 | require: 8 | - rubocop-capybara 9 | - rubocop-rake 10 | - rubocop-rspec -------------------------------------------------------------------------------- /.rubocop_todo.yml: -------------------------------------------------------------------------------- 1 | # This configuration was generated by 2 | # `rubocop --auto-gen-config` 3 | # on 2024-09-11 20:09:03 UTC using RuboCop version 1.66.1. 4 | # The point is for the user to remove these configuration records 5 | # one by one as the offenses are removed from the code base. 6 | # Note that changes in the inspected code, or installation of new 7 | # versions of RuboCop, may require this file to be generated again. 8 | 9 | # Offense count: 6 10 | # Configuration parameters: EnforcedStyle. 11 | # SupportedStyles: link_or_button, strict 12 | Capybara/ClickLinkOrButtonStyle: 13 | Exclude: 14 | - 'spec/features/swagger_spec.rb' 15 | 16 | # Offense count: 1 17 | Capybara/SpecificMatcher: 18 | Exclude: 19 | - 'spec/features/welcome_spec.rb' 20 | 21 | # Offense count: 1 22 | # Configuration parameters: Severity, Include. 23 | # Include: **/*.gemspec 24 | Gemspec/RequiredRubyVersion: 25 | Exclude: 26 | - 'grape-swagger-rails.gemspec' 27 | 28 | # Offense count: 2 29 | # Configuration parameters: AllowedMethods. 30 | # AllowedMethods: enums 31 | Lint/ConstantDefinitionInBlock: 32 | Exclude: 33 | - 'lib/tasks/swagger_ui.rake' 34 | 35 | # Offense count: 1 36 | Lint/MixedRegexpCaptureTypes: 37 | Exclude: 38 | - 'lib/tasks/swagger_ui.rake' 39 | 40 | # Offense count: 4 41 | # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns, inherit_mode. 42 | # AllowedMethods: refine 43 | Metrics/BlockLength: 44 | Max: 89 45 | 46 | # Offense count: 2 47 | # Configuration parameters: ExpectMatchingDefinition, CheckDefinitionPathHierarchy, CheckDefinitionPathHierarchyRoots, Regex, IgnoreExecutableScripts, AllowedAcronyms. 48 | # CheckDefinitionPathHierarchyRoots: lib, spec, test, src 49 | # AllowedAcronyms: CLI, DSL, ACL, API, ASCII, CPU, CSS, DNS, EOF, GUID, HTML, HTTP, HTTPS, ID, IP, JSON, LHS, QPS, RAM, RHS, RPC, SLA, SMTP, SQL, SSH, TCP, TLS, TTL, UDP, UI, UID, UUID, URI, URL, UTF8, VM, XML, XMPP, XSRF, XSS 50 | Naming/FileName: 51 | Exclude: 52 | - 'Rakefile.rb' 53 | - 'lib/grape-swagger-rails.rb' 54 | - 'spec/features/grape-swagger-rails_spec.rb' 55 | 56 | # Offense count: 13 57 | # Configuration parameters: Prefixes, AllowedPatterns. 58 | # Prefixes: when, with, without 59 | RSpec/ContextWording: 60 | Exclude: 61 | - 'spec/features/swagger_spec.rb' 62 | 63 | # Offense count: 1 64 | # This cop supports unsafe autocorrection (--autocorrect-all). 65 | # Configuration parameters: SkipBlocks, EnforcedStyle, OnlyStaticConstants. 66 | # SupportedStyles: described_class, explicit 67 | RSpec/DescribedClass: 68 | Exclude: 69 | - 'spec/features/grape-swagger-rails_spec.rb' 70 | 71 | # Offense count: 6 72 | # Configuration parameters: CountAsOne. 73 | RSpec/ExampleLength: 74 | Max: 8 75 | 76 | # Offense count: 2 77 | # Configuration parameters: AssignmentOnly. 78 | RSpec/InstanceVariable: 79 | Exclude: 80 | - 'spec/features/swagger_spec.rb' 81 | 82 | # Offense count: 12 83 | RSpec/MultipleExpectations: 84 | Max: 4 85 | 86 | # Offense count: 2 87 | # Configuration parameters: EnforcedStyle, IgnoreSharedExamples. 88 | # SupportedStyles: always, named_only 89 | RSpec/NamedSubject: 90 | Exclude: 91 | - 'spec/features/grape-swagger-rails_spec.rb' 92 | 93 | # Offense count: 12 94 | # Configuration parameters: AllowedGroups. 95 | RSpec/NestedGroups: 96 | Max: 4 97 | 98 | # Offense count: 1 99 | # Configuration parameters: Include, CustomTransform, IgnoreMethods, IgnoreMetadata. 100 | # Include: **/*_spec.rb 101 | RSpec/SpecFilePathFormat: 102 | Exclude: 103 | - '**/spec/routing/**/*' 104 | - 'spec/features/grape-swagger-rails_spec.rb' 105 | 106 | # Offense count: 4 107 | # Configuration parameters: AllowedConstants. 108 | Style/Documentation: 109 | Exclude: 110 | - 'spec/**/*' 111 | - 'test/**/*' 112 | - 'app/controllers/grape_swagger_rails/application_controller.rb' 113 | - 'lib/grape-swagger-rails.rb' 114 | - 'lib/grape-swagger-rails/engine.rb' 115 | 116 | # Offense count: 1 117 | Style/OpenStructUse: 118 | Exclude: 119 | - 'lib/grape-swagger-rails.rb' 120 | 121 | # Offense count: 1 122 | # This cop supports safe autocorrection (--autocorrect). 123 | # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns. 124 | # URISchemes: http, https 125 | Layout/LineLength: 126 | Max: 124 127 | -------------------------------------------------------------------------------- /.ruby-gemset: -------------------------------------------------------------------------------- 1 | grape-swagger-rails 2 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ### 0.6.1 (Next) 2 | 3 | * Your contribution here. 4 | 5 | ### 0.6.0 (2024/11/21) 6 | 7 | * [#124](https://github.com/ruby-grape/grape-swagger-rails/pull/124): Rails 7 compatibility - [@padde](https://github.com/padde). 8 | * [#125](https://github.com/ruby-grape/grape-swagger-rails/pull/125): Add rails versions to CI matrix - [@padde](https://github.com/padde). 9 | * [#126](https://github.com/ruby-grape/grape-swagger-rails/pull/126): Ruby 3.5 compatibility - [@padde](https://github.com/padde). 10 | * [#127](https://github.com/ruby-grape/grape-swagger-rails/pull/127): Bump Firefox and geckodriver - [@padde](https://github.com/padde). 11 | 12 | ### 0.5.0 (2024/04/06) 13 | 14 | * [#110](https://github.com/ruby-grape/grape-swagger-rails/pull/110): Update dummy app to current rails conventions - [@duffn](https://github.com/duffn). 15 | * [#112](https://github.com/ruby-grape/grape-swagger-rails/pull/112): Add RuboCop GHA & autocorrect violations - [@duffn](https://github.com/duffn). 16 | * [#114](https://github.com/ruby-grape/grape-swagger-rails/pull/114): Add `api_key_placeholder` option - [@SofiaSousa](https://github.com/SofiaSousa). 17 | * [#116](https://github.com/ruby-grape/grape-swagger-rails/pull/116): Ensure that `ostruct` is loaded - [@jrmhaig](https://github.com/jrmhaig). 18 | * [#117](https://github.com/ruby-grape/grape-swagger-rails/pull/117): Fix rubygems source code location metadata - [@dblock](https://github.com/dblock). 19 | * [#118](https://github.com/ruby-grape/grape-swagger-rails/pull/118): Split the test matrix, fix JRuby tests - [@dblock](https://github.com/dblock). 20 | 21 | ### 0.4.0 (2023/03/28) 22 | 23 | * [#107](https://github.com/ruby-grape/grape-swagger-rails/pull/107): Add test matrix for multiple ruby versions - [@duffn](https://github.com/duffn). 24 | * [#105](https://github.com/ruby-grape/grape-swagger-rails/pull/105): Migrate to GitHub Actions - [@duffn](https://github.com/duffn). 25 | * [#98](https://github.com/ruby-grape/grape-swagger-rails/pull/98): Fix: test against Rails 6 - [@dblock](https://github.com/dblock). 26 | 27 | ### 0.3.1 (2019/02/16) 28 | 29 | * [#82](https://github.com/ruby-grape/grape-swagger-rails/pull/82): Fixed api_key_default_value - [@konto-andrzeja](https://github.com/konto-andrzeja). 30 | * [#84](https://github.com/ruby-grape/grape-swagger-rails/pull/84): Added the token api_auth type - [@Jack12816](https://github.com/Jack12816). 31 | 32 | ### 0.3.0 (2016/09/22) 33 | 34 | * [#70](https://github.com/ruby-grape/grape-swagger-rails/pull/70): Rails 5 support - [@serggl](https://github.com/serggl). 35 | * [#68](https://github.com/ruby-grape/grape-swagger-rails/pull/68): Added danger, PR linter - [@dblock](https://github.com/dblock). 36 | 37 | ### 0.2.2 (2016/07/13) 38 | 39 | * [#57](https://github.com/ruby-grape/grape-swagger-rails/pull/57): Support Swagger-UI supportedSubmitMethods option - [@ShadowWrathOogles](https://github.com/ShadowWrathOogles). 40 | * [#61](https://github.com/ruby-grape/grape-swagger-rails/pull/61): Removed grape and grape-swagger from required dependencies - [@aschuster3](https://github.com/aschuster3). 41 | 42 | ### 0.2.1 (2016/05/21) 43 | 44 | * Fixed header-based authorization - [@davidbrewer](https://github.com/davidbrewer). 45 | * Support Swagger-UI validatorUrl option - [@davidbrewer](https://github.com/davidbrewer). 46 | * Support for grape 0.14.x through 0.16.x and grape-swagger 0.11.x through 0.20.x - [@dblock](https://github.com/dblock). 47 | * [#55](https://github.com/ruby-grape/grape-swagger-rails/pull/55): Update Swagger-UI assets and add ability to hide input boxes - [@aschuster3](https://github.com/aschuster3). 48 | 49 | ### 0.2.0 (2016/02/23) 50 | 51 | * [#6](https://github.com/ruby-grape/grape-swagger-rails/pull/6): Fix: support multiple predefined headers - [@Tyr0](https://github.com/tyr0). 52 | * Upgraded swagger-ui to v2.1.1 - [@dblock](https://github.com/dblock). 53 | * Grape-swagger 0.7.2 is no longer supported - [@dblock](https://github.com/dblock). 54 | * Implemented RuboCop, Ruby-style linter - [@dblock](https://github.com/dblock). 55 | * [#31](https://github.com/ruby-grape/grape-swagger-rails/pull/31): Support Swagger-UI docExpansion option - [@maruware](https://github.com/maruware). 56 | * [#32](https://github.com/ruby-grape/grape-swagger-rails/pull/32): Fix Ruby 1.9.3 compatibility - [@suan](https://github.com/suan). 57 | * [#39](https://github.com/ruby-grape/grape-swagger-rails/pull/39): Support CSS media queries - [@alexagranov](https://github.com/alexagranov). 58 | * [#42](https://github.com/ruby-grape/grape-swagger-rails/pull/42): Headers added on swaggerUi initialization (before swaggerUi.load() call) - [@sedx](https://github.com/sedx). 59 | 60 | ### 0.1.0 (2015/02/05) 61 | 62 | * [#41](https://github.com/BrandyMint/grape-swagger-rails/pull/41): Compatibility with grape-swagger 0.8.0 and 0.9.0 - [@dblock](https://github.com/dblock). 63 | 64 | ### 0.0.10 (2014/09/30) 65 | 66 | * [#33](https://github.com/BrandyMint/grape-swagger-rails/pull/33): Fix: make the dummy app runnable - [@dblock](https://github.com/dblock). 67 | * [#33](https://github.com/BrandyMint/grape-swagger-rails/pull/33): Fix: headers default to nil - [@dblock](https://github.com/dblock). 68 | * [#33](https://github.com/BrandyMint/grape-swagger-rails/pull/33): Added support for GrapeSwaggerRails.options.headers - [@dblock](https://github.com/dblock). 69 | * [#31](https://github.com/BrandyMint/grape-swagger-rails/pull/31): Get Swagger-UI from dist - [@dblock](https://github.com/dblock). 70 | * [#29](https://github.com/BrandyMint/grape-swagger-rails/pull/29): Add Rails 4.1 support - [@aaronchi](https://github.com/aaronchi). 71 | * [#21](https://github.com/BrandyMint/grape-swagger-rails/pull/21): Corrected initializer paths - [@mrclmrvn](https://github.com/mrclmrvn). 72 | * [#23](https://github.com/BrandyMint/grape-swagger-rails/pull/23): Added auth bearer support - [@shinnyx](https://github.com/shinnyx). 73 | * [#14](https://github.com/BrandyMint/grape-swagger-rails/pull/14): Added app_name to configure title of the app - [@ghilead](https://github.com/ghilead). 74 | * [#12](https://github.com/BrandyMint/grape-swagger-rails/pull/12): Fix: SwaggerUI url is combined with appUrl - [@ghilead](https://github.com/ghilead). 75 | 76 | ### 0.0.8 (2014/02/06) 77 | 78 | * [#11](https://github.com/BrandyMint/grape-swagger-rails/pull/11): Fixed image loading - [@bitboxer](https://github.com/bitboxer). 79 | 80 | ### 0.0.7 (2014/02/05) 81 | 82 | * [#7](https://github.com/BrandyMint/grape-swagger-rails/pull/7): Updated to Swagger-UI 2.0.3 - [@joelvh](https://github.com/joelvh). 83 | * [#6](https://github.com/BrandyMint/grape-swagger-rails/pull/6): Added appName and appUrl configuration options - [@swistaczek](https://github.com/swistaczek). 84 | 85 | ### 0.0.4 (2013/07/16) 86 | 87 | * Configure discoveryUrl from Rails - [@dapi](https://github.com/dapi). 88 | * Added default support for all HTTP methods - [@mtavaresOS](https://github.com/mtavaresOS). 89 | 90 | ### 0.0.3 (2013/05/24) 91 | 92 | * Converted to Rails Engine - [@unloved](https://github.com/unloved). 93 | 94 | ### 0.0.1 (2013/04/05) 95 | 96 | * Initial public release - [@radanisk](https://github.com/Radanisk). 97 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to Grape-Swagger-Rails 2 | 3 | This project is work of [many contributors](https://github.com/ruby-grape/grape-swagger-rails/graphs/contributors). 4 | You're encouraged to submit [pull requests](https://github.com/ruby-grape/grape-swagger-rails/pulls), 5 | [propose features and discuss issues](https://github.com/ruby-grape/grape-swagger-rails/issues). 6 | 7 | In the examples below, substitute your Github username for `contributor` in URLs. 8 | 9 | ## Fork the Project 10 | 11 | Fork the [project on Github](https://github.com/ruby-grape/grape-swagger-rails) and check out your copy. 12 | 13 | ``` 14 | git clone https://github.com/contributor/grape-swagger-rails.git 15 | cd grape-swagger-rails 16 | git remote add upstream https://github.com/ruby-grape/grape-swagger-rails.git 17 | ``` 18 | 19 | ## Create a Topic Branch 20 | 21 | Make sure your fork is up-to-date and create a topic branch for your feature or bug fix. 22 | 23 | ``` 24 | git checkout master 25 | git pull upstream master 26 | git checkout -b my-feature-branch 27 | ``` 28 | 29 | ## Bundle Install and Test 30 | 31 | Ensure that you can build the project and run tests. 32 | 33 | ``` 34 | bundle install 35 | bundle exec rake 36 | ``` 37 | 38 | ## Write Tests 39 | 40 | Try to write a test that reproduces the problem you're trying to fix or describes a feature that you want to build. 41 | Add to [spec](spec). 42 | 43 | We definitely appreciate pull requests that highlight or reproduce a problem, even without a fix. 44 | 45 | ## Write Code 46 | 47 | Implement your feature or bug fix. 48 | 49 | Ruby style is enforced with [RuboCop](https://github.com/bbatsov/rubocop). 50 | Run `bundle exec rubocop` and fix any style issues highlighted. 51 | 52 | Make sure that `bundle exec rake` completes without errors. 53 | 54 | You might find it useful to iterate on code by running the test project from spec/dummy. 55 | 56 | ``` 57 | spec/dummy$ GRAPE_SWAGGER_VERSION=HEAD bundle install 58 | 59 | Updating git://github.com/ruby-grape/grape-swagger.git 60 | Fetching gem metadata from https://rubygems.org/......... 61 | Resolving dependencies... 62 | ... 63 | 64 | spec/dummy$ GRAPE_SWAGGER_VERSION=HEAD rails s 65 | => Booting WEBrick 66 | => Rails 4.1.8 application starting in development on http://0.0.0.0:3000 67 | => Run `rails server -h` for more startup options 68 | => Notice: server is listening on all interfaces (0.0.0.0). Consider using 127.0.0.1 (--binding option) 69 | => Ctrl-C to shutdown server 70 | ... 71 | ``` 72 | 73 | Navigate to http://localhost:3000/swagger. 74 | 75 | ## Write Documentation 76 | 77 | Document any external behavior in the [README](README.md). 78 | 79 | ## Update Changelog 80 | 81 | Add a line to [CHANGELOG](CHANGELOG.md) under *Next Release*. 82 | Make it look like every other line, including your name and link to your Github account. 83 | 84 | ## Push 85 | 86 | ``` 87 | git push origin my-feature-branch 88 | ``` 89 | 90 | ## Make a Pull Request 91 | 92 | Go to https://github.com/contributor/grape-swagger-rails and select your feature branch. 93 | Click the 'Pull Request' button and fill out the form. Pull requests are usually reviewed within a few days. 94 | 95 | ## Update CHANGELOG Again 96 | 97 | Update the [CHANGELOG](CHANGELOG.md) with the pull request number. A typical entry looks as follows. 98 | 99 | ``` 100 | * [#123](https://github.com/ruby-grape/grape-swagger-rails/pull/123): Reticulated splines - [@contributor](https://github.com/contributor). 101 | ``` 102 | 103 | Amend your previous commit and force push the changes. 104 | 105 | ``` 106 | git commit --amend 107 | git push origin my-feature-branch -f 108 | ## Rebase 109 | 110 | If you've been working on a change for a while, rebase with upstream/master. 111 | 112 | ``` 113 | git fetch upstream 114 | git rebase upstream/master 115 | git push origin my-feature-branch -f 116 | ``` 117 | 118 | ## Check on Your Pull Request 119 | 120 | Go back to your pull request after a few minutes and see whether it passed muster with Travis-CI. Everything should look green, otherwise fix issues and amend your commit as described above. 121 | 122 | ## Be Patient 123 | 124 | It's likely that your change will not be merged and that the nitpicky maintainers will ask you to do more, or fix seemingly benign problems. Hang on there! 125 | 126 | ## Thank You 127 | 128 | Please do know that we really appreciate and value your time and work. We love you, really. 129 | -------------------------------------------------------------------------------- /Dangerfile: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | danger.import_dangerfile(gem: 'ruby-grape-danger') 4 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | source 'https://rubygems.org' 4 | 5 | gemspec 6 | 7 | case grape_swagger_version = ENV.fetch('GRAPE_SWAGGER_VERSION', '~> 1.6.0') 8 | when 'HEAD' 9 | gem 'grape-swagger', github: 'ruby-grape/grape-swagger' 10 | else 11 | gem 'grape', '>= 1.3.0' 12 | gem 'grape-swagger', grape_swagger_version 13 | end 14 | 15 | case rails_version = ENV.fetch('RAILS_VERSION', '>= 6.0.6.1') 16 | when 'edge' 17 | gem 'railties', github: 'rails/rails', branch: 'main' 18 | else 19 | gem 'railties', rails_version 20 | end 21 | 22 | group :development, :test do 23 | gem 'capybara' 24 | gem 'grape-swagger-ui' 25 | gem 'jquery-rails' 26 | gem 'mime-types' 27 | gem 'nokogiri' 28 | gem 'rack', '< 3.0' 29 | gem 'rack-cors' 30 | gem 'rake' 31 | gem 'rspec-rails' 32 | gem 'rubocop' 33 | gem 'rubocop-capybara' 34 | gem 'rubocop-rake' 35 | gem 'rubocop-rspec' 36 | gem 'ruby-grape-danger', '~> 0.2.0', require: false 37 | gem 'selenium-webdriver' 38 | gem 'sprockets-rails', require: 'sprockets/railtie' 39 | gem 'uglifier' 40 | gem 'webrick' 41 | end 42 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013-2014 Aleksandr B. Ivanov & Contributors 2 | 3 | MIT License 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | "Software"), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be 14 | included in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # GrapeSwaggerRails 2 | 3 | [![Gem Version](https://badge.fury.io/rb/grape-swagger-rails.svg)](http://badge.fury.io/rb/grape-swagger-rails) 4 | [![Tests](https://github.com/ruby-grape/grape-swagger-rails/actions/workflows/test.yml/badge.svg)](https://github.com/ruby-grape/grape-swagger-rails/actions/workflows/test.yml) 5 | [![Code Climate](https://codeclimate.com/github/ruby-grape/grape-swagger-rails/badges/gpa.svg)](https://codeclimate.com/github/ruby-grape/grape-swagger-rails) 6 | 7 | Swagger UI as Rails Engine for grape-swagger gem. 8 | 9 | # Table of Contents 10 | 11 | - [Installation](#installation) 12 | - [Compatibility](#compatibility) 13 | - [Usage](#usage) 14 | - [Basic Authentication](#basic-authentication) 15 | - [Pre-fill Authentication](#pre-fill-authentication) 16 | - [API Token Authentication](#api-token-authentication) 17 | - [Swagger UI Authorization](#swagger-ui-authorization) 18 | - [Integration with DoorKeeper](#integration-with-doorkeeper) 19 | - [Hiding the API or Authorization text boxes](#hiding-the-api-or-authorization-text-boxes) 20 | - [Updating Swagger UI from Dist](#updating-swagger-ui-from-dist) 21 | - [Enabling in a Rails-API Project](#enabling-in-a-rails-api-project) 22 | - [Enabling in Rails 6 (Sprokets 5)](#enabling-in-rails-6-sprokets-5) 23 | - [Contributors](#contributors) 24 | - [Contributing](#contributing) 25 | - [License](#license) 26 | 27 | ## Installation 28 | 29 | Add this line to your application's Gemfile: 30 | 31 | ```ruby 32 | gem 'grape-swagger-rails' 33 | ``` 34 | 35 | And then execute: 36 | 37 | $ bundle 38 | 39 | Or install it yourself as: 40 | 41 | $ gem install grape-swagger-rails 42 | 43 | ## Compatibility 44 | 45 | GrapeSwaggerRails is compatible with the following versions of grape and grape-swagger. 46 | 47 | grape | grape-swagger 48 | -------|-------------- 49 | 0.9.0 | 0.8.0 50 | 0.10.0 | 0.9.0 51 | 0.16.2 | 0.20.2 52 | 1.8.0 | 1.6.1 53 | 2.2.0 | 2.1.1 54 | 55 | ## Usage 56 | 57 | Add this line to `./config/routes.rb`: 58 | 59 | ```ruby 60 | mount GrapeSwaggerRails::Engine => '/swagger' 61 | ``` 62 | 63 | Create an initializer (e.g. `./config/initializers/swagger.rb`) and specify the URL to your Swagger API schema and app: 64 | 65 | ```ruby 66 | GrapeSwaggerRails.options.url = '/swagger_doc.json' 67 | GrapeSwaggerRails.options.app_url = 'http://swagger.wordnik.com' 68 | ``` 69 | 70 | You can dynamically set `app_url` for each request use a `before_action`: 71 | 72 | ```ruby 73 | GrapeSwaggerRails.options.before_action do 74 | GrapeSwaggerRails.options.app_url = request.protocol + request.host_with_port 75 | end 76 | ``` 77 | 78 | You can set the app name, default is "Swagger". 79 | 80 | ``` ruby 81 | GrapeSwaggerRails.options.app_name = 'Swagger' 82 | ``` 83 | 84 | You can specify additional headers to add to each request: 85 | 86 | ```ruby 87 | GrapeSwaggerRails.options.headers['Special-Header'] = 'Some Secret Value' 88 | ``` 89 | 90 | You can set docExpansion with "none" or "list" or "full", default is "none". 91 | See the official Swagger-UI documentation about [SwaggerUi Parameters](https://github.com/swagger-api/swagger-ui/blob/master/docs/usage/configuration.md#parameters). 92 | 93 | ```ruby 94 | GrapeSwaggerRails.options.doc_expansion = 'list' 95 | ``` 96 | 97 | You can set supportedSubmitMethods with an array of the supported HTTP methods, default is `%w{ get post put delete patch }`. 98 | 99 | See the official Swagger-UI documentation about [SwaggerUi Parameters](https://github.com/swagger-api/swagger-ui/blob/master/docs/usage/configuration.md#parameters). 100 | 101 | ```ruby 102 | GrapeSwaggerRails.options.supported_submit_methods = ["get"] 103 | ``` 104 | 105 | You can set validatorUrl to your own locally deployed Swagger validator, or disable validation by setting this option to nil. 106 | This is useful to avoid error messages when running Swagger-UI on a server which is not accessible from outside your network. 107 | 108 | ```ruby 109 | GrapeSwaggerRails.options.validator_url = nil 110 | ``` 111 | 112 | Using the `headers` option above, you could hard-code Basic Authentication credentials. 113 | Alternatively, you can configure Basic Authentication through the UI, as described below. 114 | 115 | ### Basic Authentication 116 | 117 | If your application uses Basic Authentication, you can setup Swagger to send the username and password to the server with each request to your API: 118 | 119 | ```ruby 120 | GrapeSwaggerRails.options.api_auth = 'basic' # Or 'bearer' for OAuth 121 | GrapeSwaggerRails.options.api_key_name = 'Authorization' 122 | GrapeSwaggerRails.options.api_key_type = 'header' 123 | ``` 124 | 125 | Now you can specify the username and password to your API in the Swagger "API key" field by concatenating the values like this: 126 | 127 | username:password 128 | 129 | The javascript that loads on the Swagger page automatically encodes the username and password and adds the authorization header to your API request. 130 | See the official Swagger documentation about [Custom Header Parameters](https://github.com/wordnik/swagger-ui#custom-header-parameters---for-basic-auth-etc) 131 | 132 | ### Pre-fill Authentication 133 | 134 | If you will know the Authentication key prior to page load or you wish to set it for debug purposes, you can setup so that the `api_key` field is pre-filled on page load: 135 | 136 | ```ruby 137 | GrapeSwaggerRails.options.api_key_default_value = 'your_default_value' 138 | ``` 139 | 140 | To set it based on the `current_user` or other request-based parameters, try using it inside of your `before_action` (See Swagger UI Authorization) 141 | 142 | ### API Token Authentication 143 | 144 | If your application uses token authentication passed as a query param, you can setup Swagger to send the API token along with each request to your API: 145 | 146 | ```ruby 147 | GrapeSwaggerRails.options.api_key_name = 'api_token' 148 | GrapeSwaggerRails.options.api_key_type = 'query' 149 | ``` 150 | 151 | If your application used token authentication passed as a header, like Rails does (`authenticate_or_request_with_http_token`), you can configure Swagger to send the token in this form: 152 | 153 | ``` 154 | Authorization: Token token="WCZZYjnOQFUYfJIN2ShH1iD24UHo58A6TI" 155 | ``` 156 | 157 | by specify: 158 | 159 | ```ruby 160 | GrapeSwaggerRails.options.api_auth = 'token' 161 | GrapeSwaggerRails.options.api_key_name = 'Authorization' 162 | GrapeSwaggerRails.options.api_key_type = 'header' 163 | GrapeSwaggerRails.options.api_key_placeholder = 'authorization_token' 164 | ``` 165 | 166 | You can use the ```authorization_token``` input box to fill in your API token. 167 | ### Swagger UI Authorization 168 | 169 | You may want to authenticate users before displaying the Swagger UI, particularly when the API is protected by Basic Authentication. 170 | Use the `before` option to inspect the request before Swagger UI: 171 | 172 | ```ruby 173 | GrapeSwaggerRails.options.before_action do |request| 174 | # 1. Inspect the `request` or access the Swagger UI controller via `self`. 175 | # 2. Check `current_user` or `can? :access, :api`, etc. 176 | # 3. Redirect or error in case of failure. 177 | end 178 | ``` 179 | 180 | #### Integration with DoorKeeper 181 | 182 | Add the following code to the initializer (swagger.rb): 183 | 184 | ```ruby 185 | GrapeSwaggerRails.options.before_action do |request| 186 | GrapeSwaggerRails.options.api_key_default_value = current_user.token.token 187 | end 188 | ``` 189 | 190 | In your User model (user.rb) add: 191 | 192 | ```ruby 193 | has_one :token, -> { order 'created_at DESC' }, class_name: Doorkeeper::AccessToken, foreign_key: :resource_owner_id 194 | ``` 195 | 196 | ### Hiding the API or Authorization text boxes 197 | 198 | If you know in advance that you would like to prevent changing the Swagger API URL, you can hide it using the following: 199 | 200 | ```ruby 201 | GrapeSwaggerRails.options.hide_url_input = true 202 | ``` 203 | 204 | Similarly, you can hide the Authentication input box by adding this: 205 | 206 | ```ruby 207 | GrapeSwaggerRails.options.hide_api_key_input = true 208 | ``` 209 | 210 | By default, these options are false. 211 | 212 | ### Updating Swagger UI from Dist 213 | 214 | To update Swagger UI from its [distribution](https://github.com/wordnik/swagger-ui), run `bundle exec rake swagger_ui:dist:update`. Examine the changes carefully. 215 | 216 | NOTE: This action should be run part of this gem (not your application). In case if you want to 217 | make it up-to-date, clone the repo, run the rake task, examine the diff, fix any bugs, make sure 218 | tests pass and then send PR here. 219 | 220 | ### Enabling in a Rails-API Project 221 | 222 | The grape-swagger-rails gem uses the Rails asset pipeline for its Javascript and CSS. Enable the asset pipeline with [rails-api](https://github.com/rails-api/rails-api). 223 | 224 | Add sprockets to `config/application.rb`. 225 | 226 | ```ruby 227 | require 'sprockets/railtie' 228 | ``` 229 | 230 | Include JavaScript in `app/assets/javascripts/application.js`. 231 | 232 | ```javascript 233 | // 234 | //= require_tree . 235 | ``` 236 | 237 | Include CSS stylesheets in `app/assets/stylesheets/application.css`. 238 | 239 | ```css 240 | /* 241 | *= require_tree . 242 | */ 243 | ``` 244 | 245 | ### Enabling in Rails 6 (Sprokets 5) 246 | 247 | Rails 6 top-level targets are determined via `./app/assets/config/manifest.js`. Specify `grape-swagger-rails` asset files as follows. 248 | 249 | ```javascript 250 | //= link grape_swagger_rails/application.css 251 | //= link grape_swagger_rails/application.js 252 | ``` 253 | 254 | See [Upgrading Sprokets](https://github.com/rails/sprockets/blob/master/UPGRADING.md#manifestjs) for more information. 255 | 256 | ## Contributors 257 | 258 | * [unloved](https://github.com/unloved) 259 | * [dapi](https://github.com/dapi) 260 | * [joelvh](https://github.com/joelvh) 261 | * [dblock](https://github.com/dblock) 262 | * ... and [more](https://github.com/ruby-grape/grape-swagger-rails/graphs/contributors) ... 263 | 264 | ## Contributing 265 | 266 | See [CONTRIBUTING](CONTRIBUTING.md). 267 | 268 | ## License 269 | 270 | MIT License, see [LICENSE](LICENSE.txt). 271 | -------------------------------------------------------------------------------- /RELEASING.md: -------------------------------------------------------------------------------- 1 | # Releasing Grape-Swagger-Rails 2 | 3 | There're no particular rules about when to release grape-swagger-rails. Release bug fixes frequenty, features not so frequently and breaking API changes rarely. 4 | 5 | ### Release 6 | 7 | Run tests, check that all tests succeed locally. 8 | 9 | ``` 10 | bundle install 11 | rake 12 | ``` 13 | 14 | Check that the last build succeeded in [GitHub Actions](https://github.com/ruby-grape/grape-swagger-rails/actions) for all supported platforms. 15 | 16 | Increment the version, modify [lib/grape-swagger-rails/version.rb](lib/grape-swagger-rails/version.rb). 17 | 18 | * Increment the third number if the release has bug fixes and/or very minor features, only (eg. change `0.1.0` to `0.1.1`). 19 | * Increment the second number if the release contains major features or breaking API changes (eg. change `0.1.0` to `0.2.0`). 20 | 21 | Change "Next Release" in [CHANGELOG.md](CHANGELOG.md) to the new version. 22 | 23 | ``` 24 | ### 0.1.1 (February 5, 2015) 25 | ``` 26 | 27 | Remove the line with "Your contribution here.", since there will be no more contributions to this release. 28 | 29 | Commit your changes. 30 | 31 | ``` 32 | git add CHANGELOG.md lib/grape-swagger-rails/version.rb 33 | git commit -m "Preparing for release, 0.1.1." 34 | git push origin master 35 | ``` 36 | 37 | Release. 38 | 39 | ``` 40 | $ rake release 41 | 42 | grape-swagger-rails 0.1.1 built to pkg/grape-swagger-rails-0.1.1.gem. 43 | Tagged v0.1.1. 44 | Pushed git commits and tags. 45 | Pushed grape-swagger-rails 0.1.1 to rubygems.org. 46 | ``` 47 | 48 | ### Prepare for the Next Version 49 | 50 | Add the next release to [CHANGELOG.md](CHANGELOG.md). 51 | 52 | ``` 53 | ### Next Release 54 | 55 | * Your contribution here. 56 | ``` 57 | 58 | Commit your changes. 59 | 60 | ``` 61 | git add CHANGELOG.md 62 | git commit -m "Preparing for next release." 63 | git push origin master 64 | ``` 65 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'bundler/setup' 4 | require 'bundler/gem_tasks' 5 | 6 | APP_RAKEFILE = File.expand_path('spec/dummy/Rakefile', __dir__) 7 | load 'rails/tasks/engine.rake' 8 | 9 | Dir[File.join(File.dirname(__FILE__), 'lib/tasks/**/*.rake')].each do |f| 10 | load f 11 | end 12 | 13 | require 'rspec/core' 14 | require 'rspec/core/rake_task' 15 | 16 | desc 'Run all specs.' 17 | RSpec::Core::RakeTask.new(:spec) 18 | 19 | require 'rubocop/rake_task' 20 | RuboCop::RakeTask.new(:rubocop) 21 | 22 | task default: %i[rubocop spec] 23 | -------------------------------------------------------------------------------- /UPGRADING.md: -------------------------------------------------------------------------------- 1 | Upgrading Grape Swagger Rails 2 | ============================= 3 | 4 | ### Upgrading to >= 0.2.3 5 | 6 | #### Changes to Options 7 | 8 | The `GrapeSwaggerRails.options.before_filter` option have been deprecated since 0.2.3. 9 | 10 | Please use `GrapeSwaggerRails.options.before_action` instead. -------------------------------------------------------------------------------- /app/assets/config/grape_swagger_rails_manifest.js: -------------------------------------------------------------------------------- 1 | //= link_directory ../stylesheets/grape_swagger_rails .css 2 | //= link_directory ../javascripts/grape_swagger_rails .js 3 | -------------------------------------------------------------------------------- /app/assets/images/grape_swagger_rails/collapse.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ruby-grape/grape-swagger-rails/c4c7fd193439ae3192c68c9e4eb5ceeb5416ecc4/app/assets/images/grape_swagger_rails/collapse.gif -------------------------------------------------------------------------------- /app/assets/images/grape_swagger_rails/expand.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ruby-grape/grape-swagger-rails/c4c7fd193439ae3192c68c9e4eb5ceeb5416ecc4/app/assets/images/grape_swagger_rails/expand.gif -------------------------------------------------------------------------------- /app/assets/images/grape_swagger_rails/explorer_icons.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ruby-grape/grape-swagger-rails/c4c7fd193439ae3192c68c9e4eb5ceeb5416ecc4/app/assets/images/grape_swagger_rails/explorer_icons.png -------------------------------------------------------------------------------- /app/assets/images/grape_swagger_rails/favicon-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ruby-grape/grape-swagger-rails/c4c7fd193439ae3192c68c9e4eb5ceeb5416ecc4/app/assets/images/grape_swagger_rails/favicon-16x16.png -------------------------------------------------------------------------------- /app/assets/images/grape_swagger_rails/favicon-32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ruby-grape/grape-swagger-rails/c4c7fd193439ae3192c68c9e4eb5ceeb5416ecc4/app/assets/images/grape_swagger_rails/favicon-32x32.png -------------------------------------------------------------------------------- /app/assets/images/grape_swagger_rails/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ruby-grape/grape-swagger-rails/c4c7fd193439ae3192c68c9e4eb5ceeb5416ecc4/app/assets/images/grape_swagger_rails/favicon.ico -------------------------------------------------------------------------------- /app/assets/images/grape_swagger_rails/logo_small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ruby-grape/grape-swagger-rails/c4c7fd193439ae3192c68c9e4eb5ceeb5416ecc4/app/assets/images/grape_swagger_rails/logo_small.png -------------------------------------------------------------------------------- /app/assets/images/grape_swagger_rails/pet_store_api.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ruby-grape/grape-swagger-rails/c4c7fd193439ae3192c68c9e4eb5ceeb5416ecc4/app/assets/images/grape_swagger_rails/pet_store_api.png -------------------------------------------------------------------------------- /app/assets/images/grape_swagger_rails/throbber.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ruby-grape/grape-swagger-rails/c4c7fd193439ae3192c68c9e4eb5ceeb5416ecc4/app/assets/images/grape_swagger_rails/throbber.gif -------------------------------------------------------------------------------- /app/assets/images/grape_swagger_rails/wordnik_api.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ruby-grape/grape-swagger-rails/c4c7fd193439ae3192c68c9e4eb5ceeb5416ecc4/app/assets/images/grape_swagger_rails/wordnik_api.png -------------------------------------------------------------------------------- /app/assets/javascripts/grape_swagger_rails/application.js: -------------------------------------------------------------------------------- 1 | //= require ./jquery-1.8.0.min 2 | //= require ./jquery.slideto.min 3 | //= require ./jquery.wiggle.min 4 | //= require ./jquery.ba-bbq.min 5 | //= require ./handlebars-2.0.0 6 | //= require ./marked 7 | //= require ./lodash.min 8 | //= require ./backbone-min 9 | //= require ./swagger-ui.min 10 | //= require ./highlight.9.1.0.pack 11 | //= require ./js-yaml.min 12 | //= require ./jsoneditor.min 13 | //= require ./object-assign-pollyfill 14 | //= require ./swagger-oauth 15 | //= require ./base64 16 | -------------------------------------------------------------------------------- /app/assets/javascripts/grape_swagger_rails/backbone-min.js: -------------------------------------------------------------------------------- 1 | // Backbone.js 1.1.2 2 | 3 | (function(t,e){if(typeof define==="function"&&define.amd){define(["underscore","jquery","exports"],function(i,r,s){t.Backbone=e(t,s,i,r)})}else if(typeof exports!=="undefined"){var i=require("underscore");e(t,exports,i)}else{t.Backbone=e(t,{},t._,t.jQuery||t.Zepto||t.ender||t.$)}})(this,function(t,e,i,r){var s=t.Backbone;var n=[];var a=n.push;var o=n.slice;var h=n.splice;e.VERSION="1.1.2";e.$=r;e.noConflict=function(){t.Backbone=s;return this};e.emulateHTTP=false;e.emulateJSON=false;var u=e.Events={on:function(t,e,i){if(!c(this,"on",t,[e,i])||!e)return this;this._events||(this._events={});var r=this._events[t]||(this._events[t]=[]);r.push({callback:e,context:i,ctx:i||this});return this},once:function(t,e,r){if(!c(this,"once",t,[e,r])||!e)return this;var s=this;var n=i.once(function(){s.off(t,n);e.apply(this,arguments)});n._callback=e;return this.on(t,n,r)},off:function(t,e,r){var s,n,a,o,h,u,l,f;if(!this._events||!c(this,"off",t,[e,r]))return this;if(!t&&!e&&!r){this._events=void 0;return this}o=t?[t]:i.keys(this._events);for(h=0,u=o.length;h").attr(t);this.setElement(r,false)}else{this.setElement(i.result(this,"el"),false)}}});e.sync=function(t,r,s){var n=T[t];i.defaults(s||(s={}),{emulateHTTP:e.emulateHTTP,emulateJSON:e.emulateJSON});var a={type:n,dataType:"json"};if(!s.url){a.url=i.result(r,"url")||M()}if(s.data==null&&r&&(t==="create"||t==="update"||t==="patch")){a.contentType="application/json";a.data=JSON.stringify(s.attrs||r.toJSON(s))}if(s.emulateJSON){a.contentType="application/x-www-form-urlencoded";a.data=a.data?{model:a.data}:{}}if(s.emulateHTTP&&(n==="PUT"||n==="DELETE"||n==="PATCH")){a.type="POST";if(s.emulateJSON)a.data._method=n;var o=s.beforeSend;s.beforeSend=function(t){t.setRequestHeader("X-HTTP-Method-Override",n);if(o)return o.apply(this,arguments)}}if(a.type!=="GET"&&!s.emulateJSON){a.processData=false}if(a.type==="PATCH"&&k){a.xhr=function(){return new ActiveXObject("Microsoft.XMLHTTP")}}var h=s.xhr=e.ajax(i.extend(a,s));r.trigger("request",r,h,s);return h};var k=typeof window!=="undefined"&&!!window.ActiveXObject&&!(window.XMLHttpRequest&&(new XMLHttpRequest).dispatchEvent);var T={create:"POST",update:"PUT",patch:"PATCH","delete":"DELETE",read:"GET"};e.ajax=function(){return e.$.ajax.apply(e.$,arguments)};var $=e.Router=function(t){t||(t={});if(t.routes)this.routes=t.routes;this._bindRoutes();this.initialize.apply(this,arguments)};var S=/\((.*?)\)/g;var H=/(\(\?)?:\w+/g;var A=/\*\w+/g;var I=/[\-{}\[\]+?.,\\\^$|#\s]/g;i.extend($.prototype,u,{initialize:function(){},route:function(t,r,s){if(!i.isRegExp(t))t=this._routeToRegExp(t);if(i.isFunction(r)){s=r;r=""}if(!s)s=this[r];var n=this;e.history.route(t,function(i){var a=n._extractParameters(t,i);n.execute(s,a);n.trigger.apply(n,["route:"+r].concat(a));n.trigger("route",r,a);e.history.trigger("route",n,r,a)});return this},execute:function(t,e){if(t)t.apply(this,e)},navigate:function(t,i){e.history.navigate(t,i);return this},_bindRoutes:function(){if(!this.routes)return;this.routes=i.result(this,"routes");var t,e=i.keys(this.routes);while((t=e.pop())!=null){this.route(t,this.routes[t])}},_routeToRegExp:function(t){t=t.replace(I,"\\$&").replace(S,"(?:$1)?").replace(H,function(t,e){return e?t:"([^/?]+)"}).replace(A,"([^?]*?)");return new RegExp("^"+t+"(?:\\?([\\s\\S]*))?$")},_extractParameters:function(t,e){var r=t.exec(e).slice(1);return i.map(r,function(t,e){if(e===r.length-1)return t||null;return t?decodeURIComponent(t):null})}});var N=e.History=function(){this.handlers=[];i.bindAll(this,"checkUrl");if(typeof window!=="undefined"){this.location=window.location;this.history=window.history}};var R=/^[#\/]|\s+$/g;var O=/^\/+|\/+$/g;var P=/msie [\w.]+/;var C=/\/$/;var j=/#.*$/;N.started=false;i.extend(N.prototype,u,{interval:50,atRoot:function(){return this.location.pathname.replace(/[^\/]$/,"$&/")===this.root},getHash:function(t){var e=(t||this).location.href.match(/#(.*)$/);return e?e[1]:""},getFragment:function(t,e){if(t==null){if(this._hasPushState||!this._wantsHashChange||e){t=decodeURI(this.location.pathname+this.location.search);var i=this.root.replace(C,"");if(!t.indexOf(i))t=t.slice(i.length)}else{t=this.getHash()}}return t.replace(R,"")},start:function(t){if(N.started)throw new Error("Backbone.history has already been started");N.started=true;this.options=i.extend({root:"/"},this.options,t);this.root=this.options.root;this._wantsHashChange=this.options.hashChange!==false;this._wantsPushState=!!this.options.pushState;this._hasPushState=!!(this.options.pushState&&this.history&&this.history.pushState);var r=this.getFragment();var s=document.documentMode;var n=P.exec(navigator.userAgent.toLowerCase())&&(!s||s<=7);this.root=("/"+this.root+"/").replace(O,"/");if(n&&this._wantsHashChange){var a=e.$('