MVP of swagger documentation
This commit is contained in:
parent
8a3469447b
commit
bcbcf9b469
3
.gitignore
vendored
3
.gitignore
vendored
@ -33,3 +33,6 @@
|
|||||||
|
|
||||||
# Ignore master key for decrypting credentials and more.
|
# Ignore master key for decrypting credentials and more.
|
||||||
/config/master.key
|
/config/master.key
|
||||||
|
|
||||||
|
# Ignore swagger generated documentation
|
||||||
|
swagger/v1/swagger.yaml
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
# syntax = docker/dockerfile:1
|
# syntax = docker/dockerfile:1
|
||||||
|
|
||||||
# Make sure RUBY_VERSION matches the Ruby version in .ruby-version and Gemfile
|
# Make sure RUBY_VERSION matches the Ruby version in .ruby-version and Gemfile
|
||||||
ARG RUBY_VERSION=3.3.5
|
ARG RUBY_VERSION=3.3.6
|
||||||
FROM registry.docker.com/library/ruby:$RUBY_VERSION-slim as base
|
FROM registry.docker.com/library/ruby:$RUBY_VERSION-slim as base
|
||||||
|
|
||||||
# Rails app lives here
|
# Rails app lives here
|
||||||
|
@ -8,7 +8,7 @@ Rswag::Ui.configure do |c|
|
|||||||
# (under openapi_root) as JSON or YAML endpoints, then the list below should
|
# (under openapi_root) as JSON or YAML endpoints, then the list below should
|
||||||
# correspond to the relative paths for those endpoints.
|
# correspond to the relative paths for those endpoints.
|
||||||
|
|
||||||
c.swagger_endpoint '/api-docs/v1/swagger.yaml', 'API V1 Docs'
|
c.swagger_endpoint '/api/api-docs/v1/swagger.yaml', 'API V1 Docs'
|
||||||
|
|
||||||
# Add Basic Auth in case your API is private
|
# Add Basic Auth in case your API is private
|
||||||
# c.basic_auth_enabled = true
|
# c.basic_auth_enabled = true
|
||||||
|
19
spec/requests/groups_spec.rb
Normal file
19
spec/requests/groups_spec.rb
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
require 'swagger_helper'
|
||||||
|
|
||||||
|
RSpec.describe 'groups', type: :request do
|
||||||
|
path '/groups' do
|
||||||
|
get('list groups') do
|
||||||
|
response(200, 'successful') do
|
||||||
|
|
||||||
|
after do |example|
|
||||||
|
example.metadata[:response][:content] = {
|
||||||
|
'application/json' => {
|
||||||
|
example: JSON.parse(response.body, symbolize_names: true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
end
|
||||||
|
run_test!
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
@ -24,10 +24,10 @@ RSpec.configure do |config|
|
|||||||
paths: {},
|
paths: {},
|
||||||
servers: [
|
servers: [
|
||||||
{
|
{
|
||||||
url: 'https://{defaultHost}',
|
url: 'http://{defaultHost}/api',
|
||||||
variables: {
|
variables: {
|
||||||
defaultHost: {
|
defaultHost: {
|
||||||
default: 'www.example.com'
|
default: 'libre-wedding-planner.app.localhost'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user