2025-01-13 20:38:47 +00:00
|
|
|
# Copyright (C) 2024 Manuel Bustillo
|
|
|
|
|
2025-01-13 21:37:02 +01:00
|
|
|
# Copyright (C) 2024-2025 LibreWeddingPlanner contributors
|
2024-11-15 17:29:56 +00:00
|
|
|
|
2024-11-15 08:45:56 +01:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'rails_helper'
|
2024-12-28 18:07:22 +01:00
|
|
|
require_relative 'swagger_response_helper'
|
|
|
|
require_relative 'requests/schemas'
|
2024-11-16 02:16:19 +01:00
|
|
|
|
2024-12-28 18:07:22 +01:00
|
|
|
include SwaggerResponseHelper # rubocop:disable Style/MixinUsage
|
2024-11-15 08:45:56 +01:00
|
|
|
|
|
|
|
RSpec.configure do |config|
|
|
|
|
# Specify a root folder where Swagger JSON files are generated
|
|
|
|
# NOTE: If you're using the rswag-api to serve API descriptions, you'll need
|
|
|
|
# to ensure that it's configured to serve Swagger from the same folder
|
|
|
|
config.openapi_root = Rails.root.join('swagger').to_s
|
|
|
|
|
|
|
|
# Define one or more Swagger documents and provide global metadata for each one
|
|
|
|
# When you run the 'rswag:specs:swaggerize' rake task, the complete Swagger will
|
|
|
|
# be generated at the provided relative path under openapi_root
|
|
|
|
# By default, the operations defined in spec files are added to the first
|
|
|
|
# document below. You can override this behavior by adding a openapi_spec tag to the
|
|
|
|
# the root example_group in your specs, e.g. describe '...', openapi_spec: 'v2/swagger.json'
|
|
|
|
config.openapi_specs = {
|
|
|
|
'v1/swagger.yaml' => {
|
|
|
|
openapi: '3.0.1',
|
|
|
|
info: {
|
|
|
|
title: 'API V1',
|
|
|
|
version: 'v1'
|
|
|
|
},
|
|
|
|
paths: {},
|
|
|
|
servers: [
|
2024-11-15 19:04:22 +01:00
|
|
|
{
|
|
|
|
url: 'http://libre-wedding-planner.app.localhost/api',
|
|
|
|
description: 'Suitable for development'
|
2024-11-15 08:45:56 +01:00
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
# Specify the format of the output Swagger file when running 'rswag:specs:swaggerize'.
|
|
|
|
# The openapi_specs configuration option has the filename including format in
|
|
|
|
# the key, this may want to be changed to avoid putting yaml in json files.
|
|
|
|
# Defaults to json. Accepts ':json' and ':yaml'.
|
|
|
|
config.openapi_format = :yaml
|
|
|
|
end
|