Skip to content

Commit b42c679

Browse files
authored
Merge pull request #2 from SiloGecho97/add-openapi-ui
feat: Add OpenAPI UI using scalar
2 parents afe1fc2 + ee70055 commit b42c679

File tree

4 files changed

+9
-0
lines changed

4 files changed

+9
-0
lines changed

Gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ gem "thruster", require: false
3535
# Use Rack CORS for handling Cross-Origin Resource Sharing (CORS), making cross-origin Ajax possible
3636
# gem "rack-cors"
3737
gem "committee"
38+
gem "scalar_ruby", "~> 1.1"
3839

3940
group :development, :test do
4041
# See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem

Gemfile.lock

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,7 @@ GEM
249249
rubocop-performance (>= 1.24)
250250
rubocop-rails (>= 2.30)
251251
ruby-progressbar (1.13.0)
252+
scalar_ruby (1.1.0)
252253
securerandom (0.4.1)
253254
solid_cable (3.0.7)
254255
actioncable (>= 7.2)
@@ -309,6 +310,7 @@ DEPENDENCIES
309310
puma (>= 5.0)
310311
rails (~> 8.0.2)
311312
rubocop-rails-omakase
313+
scalar_ruby (~> 1.1)
312314
solid_cable
313315
solid_cache
314316
solid_queue

config/initializers/scalar.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# config/initializers/scalar.rb
2+
3+
Scalar.setup do |config|
4+
config.specification = File.read(Rails.root.join("docs/openapi.json"))
5+
end

config/routes.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
Rails.application.routes.draw do
2+
mount Scalar::UI, at: "/docs"
23
resources :comments
34
# Define your application routes per the DSL in https://guides.rubyonrails.org/routing.html
45

0 commit comments

Comments
 (0)