28_introduce_rswag #35

Merged
philipp merged 46 commits from 28_introduce_rswag into develop 2023-01-05 13:45:47 +01:00
2 changed files with 51 additions and 37 deletions
Showing only changes of commit 3222e79a34 - Show all commits

View file

@ -9,11 +9,12 @@ describe 'Financial Transaction types', type: :request do
produces 'application/json' produces 'application/json'
parameter name: "per_page", in: :query, type: :integer, required: false parameter name: "per_page", in: :query, type: :integer, required: false
parameter name: "page", in: :query, type: :integer, required: false parameter name: "page", in: :query, type: :integer, required: false
let(:page) { 1 }
let(:per_page) { 10 }
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: {
meta: {
'$ref' => '#/components/schemas/Meta'
},
financial_transaction_type: { financial_transaction_type: {
type: :array, type: :array,
items: { items: {
@ -43,36 +44,12 @@ describe 'Financial Transaction types', type: :request do
} }
} }
} }
let(:id) { FinancialTransactionType.create(name: 'TestType').id } let(:id) { create(:financial_transaction_type).id }
run_test! run_test!
end end
response '401', 'not logged in' do it_handles_invalid_token_with_id :financial_transaction_type
schema type: :object, properties: { it_cannot_find_object 'financial transaction type not found'
financial_transaction_types: {
type: :array,
items: {
'$ref': '#/components/schemas/FinancialTransactionType'
}
}
}
let(:Authorization) { 'abc' }
let(:id) { FinancialTransactionType.create(name: 'TestType').id }
run_test!
end
response '404', 'financial transaction type not found' do
schema type: :object, properties: {
financial_transaction_types: {
type: :array,
items: {
'$ref': '#/components/schemas/FinancialTransactionType'
}
}
}
let(:id) { 'invalid' }
run_test!
end
end end
end end
end end

View file

@ -50,17 +50,20 @@ RSpec.configure do |config|
description: 'when the order was opened' description: 'when the order was opened'
}, },
ends: { ends: {
type: ['string', 'null'], type: :string,
nullable: true,
format: 'date-time', format: 'date-time',
description: 'when the order will close or was closed' description: 'when the order will close or was closed'
}, },
boxfill: { boxfill: {
type: ['string', 'null'], type: :string,
nullable: true,
format: 'date-time', format: 'date-time',
description: 'when the order will enter or entered the boxfill phase' description: 'when the order will enter or entered the boxfill phase'
}, },
pickup: { pickup: {
type: ['string', 'null'], type: :string,
nullable: true,
format: :date, format: :date,
description: 'pickup date' description: 'pickup date'
}, },
@ -88,7 +91,8 @@ RSpec.configure do |config|
description: 'id of supplier, or 0 for stock articles' description: 'id of supplier, or 0 for stock articles'
}, },
supplier_name: { supplier_name: {
type: %w[string null], type: :string,
nullable: true,
description: 'name of the supplier, or null for stock articles' description: 'name of the supplier, or null for stock articles'
}, },
unit: { unit: {
@ -100,15 +104,18 @@ RSpec.configure do |config|
description: 'units can only be ordered from the supplier in multiples of unit_quantity' description: 'units can only be ordered from the supplier in multiples of unit_quantity'
}, },
note: { note: {
type: %w[string null], type: :string,
nullable: true,
description: 'generic note' description: 'generic note'
}, },
manufacturer: { manufacturer: {
type: %w[string null], type: :string,
nullable: true,
description: 'manufacturer' description: 'manufacturer'
}, },
origin: { origin: {
type: %w[string null], type: :string,
nullable: true,
description: 'origin, preferably (starting with a) 2-letter ISO country code' description: 'origin, preferably (starting with a) 2-letter ISO country code'
}, },
article_category_id: { article_category_id: {
@ -187,10 +194,12 @@ RSpec.configure do |config|
}, },
user_id: { user_id: {
type: :integer, type: :integer,
nullable: true,
description: 'id of user who entered the transaction (may be <tt>null</tt> for deleted users or 0 for a system user)' description: 'id of user who entered the transaction (may be <tt>null</tt> for deleted users or 0 for a system user)'
}, },
user_name: { user_name: {
type: :string, type: :string,
nullable: true,
description: 'name of user who entered the transaction (may be <tt>null</tt> or empty string for deleted users or system users)' description: 'name of user who entered the transaction (may be <tt>null</tt> or empty string for deleted users or system users)'
}, },
financial_transaction_type_name: { financial_transaction_type_name: {
@ -244,9 +253,37 @@ RSpec.configure do |config|
}, },
name: { name: {
type: :string type: :string
},
name_short: {
type: :string,
nullable: true,
description: 'short name (used for bank transfers)'
},
bank_account_id: {
type: :integer,
nullable: true,
description: 'id of the bank account used for this transaction type'
},
bank_account_name: {
type: :string,
nullable: true,
description: 'name of the bank account used for this transaction type'
},
bank_account_iban: {
type: :string,
nullable: true,
description: 'IBAN of the bank account used for this transaction type'
},
financial_transaction_class_id: {
type: :integer,
description: 'id of the class of the transaction'
},
financial_transaction_class_name: {
type: :string,
description: 'name of the class of the transaction'
} }
}, },
required: %w[id name financial_transaction_class] required: %w[id name financial_transaction_class_id financial_transaction_class_name]
}, },
GroupOrderArticleForUpdate: { GroupOrderArticleForUpdate: {
type: :object, type: :object,