28_introduce_rswag #35

Merged
philipp merged 46 commits from 28_introduce_rswag into develop 2023-01-05 13:45:47 +01:00
8 changed files with 13 additions and 17 deletions
Showing only changes of commit 18358484ba - Show all commits

View file

@ -7,8 +7,7 @@ describe 'Article Categories', type: :request do
get 'article categories' do get 'article categories' do
tags 'Category' tags 'Category'
produces 'application/json' produces 'application/json'
parameter name: "per_page", in: :query, type: :integer, required: false pagination_param
parameter name: "page", in: :query, type: :integer, required: false
let(:order_article) { create(:order, article_count: 1).order_articles.first } let(:order_article) { create(:order, article_count: 1).order_articles.first }
let(:stock_article) { create(:stock_article) } let(:stock_article) { create(:stock_article) }
let(:stock_order_article) { create(:stock_order, article_ids: [stock_article.id]).order_articles.first } let(:stock_order_article) { create(:stock_order, article_ids: [stock_article.id]).order_articles.first }

View file

@ -7,8 +7,7 @@ describe 'Financial Transaction Classes', type: :request do
get 'financial transaction classes' do get 'financial transaction classes' do
tags 'Category' tags 'Category'
produces 'application/json' produces 'application/json'
parameter name: "per_page", in: :query, type: :integer, required: false pagination_param
parameter name: "page", in: :query, type: :integer, required: false
let(:financial_transaction_class) { create(:financial_transaction_class) } let(:financial_transaction_class) { create(:financial_transaction_class) }
response '200', 'success' do response '200', 'success' do

View file

@ -7,8 +7,7 @@ describe 'Financial Transaction types', type: :request do
get 'financial transaction types' do get 'financial transaction types' do
tags 'Category' tags 'Category'
produces 'application/json' produces 'application/json'
parameter name: "per_page", in: :query, type: :integer, required: false pagination_param
parameter name: "page", in: :query, type: :integer, required: false
let(:financial_transaction_type) { create(:financial_transaction_type) } let(:financial_transaction_type) { create(:financial_transaction_type) }
response '200', 'success' do response '200', 'success' do
schema type: :object, properties: { schema type: :object, properties: {

View file

@ -11,8 +11,7 @@ describe 'Financial Transaction', type: :request do
get 'financial transactions' do get 'financial transactions' do
tags 'Financial Transaction' tags 'Financial Transaction'
produces 'application/json' produces 'application/json'
parameter name: "per_page", in: :query, type: :integer, required: false pagination_param
parameter name: "page", in: :query, type: :integer, required: false
response '200', 'success' do response '200', 'success' do
schema type: :object, properties: { schema type: :object, properties: {

View file

@ -8,9 +8,7 @@ describe 'Orders', type: :request do
get 'orders' do get 'orders' do
tags 'Order' tags 'Order'
produces 'application/json' produces 'application/json'
parameter name: "per_page", in: :query, type: :integer, required: false pagination_param
parameter name: "page", in: :query, type: :integer, required: false
let(:order) { create(:order) } let(:order) { create(:order) }
response '200', 'success' do response '200', 'success' do

View file

@ -59,9 +59,7 @@ describe 'User', type: :request do
get "financial transactions of the member's ordergroup" do get "financial transactions of the member's ordergroup" do
tags 'User', 'Financial Transaction' tags 'User', 'Financial Transaction'
produces 'application/json' produces 'application/json'
parameter name: "per_page", in: :query, type: :integer, required: false pagination_param
parameter name: "page", in: :query, type: :integer, required: false
response '200', 'success' do response '200', 'success' do
schema type: :object, properties: { schema type: :object, properties: {

View file

@ -19,8 +19,7 @@ describe 'User', type: :request do
get 'group order articles' do get 'group order articles' do
tags 'User', 'Order' tags 'User', 'Order'
produces 'application/json' produces 'application/json'
parameter name: "per_page", in: :query, type: :integer, required: false pagination_param
parameter name: "page", in: :query, type: :integer, required: false
q_ordered_url_param q_ordered_url_param
response '200', 'success' do response '200', 'success' do

View file

@ -71,8 +71,13 @@ module ApiHelper
parameter name: :id, in: :path, type: :integer, required: true parameter name: :id, in: :path, type: :integer, required: true
end end
def self.pagination_param
parameter name: :per_page, in: :query, type: :integer, required: false
parameter name: :page, in: :query, type: :integer, required: false
end
def self.q_ordered_url_param def self.q_ordered_url_param
parameter name: 'q', in: :query, required: false, parameter name: :q, in: :query, required: false,
description: "'member' show articles ordered by the user's ordergroup, 'all' by all members, and 'supplier' ordered at the supplier", description: "'member' show articles ordered by the user's ordergroup, 'all' by all members, and 'supplier' ordered at the supplier",
schema: { '$ref' => '#/components/schemas/q_ordered' } schema: { '$ref' => '#/components/schemas/q_ordered' }
end end