Skip to content

Commit

Permalink
Merge pull request #79 from stymoshchuk/RB-schema-upd
Browse files Browse the repository at this point in the history
RB-schema-up Changes to schema
  • Loading branch information
axshani authored Mar 3, 2024
2 parents 27bcbe4 + db6e4ec commit 0c4a854
Show file tree
Hide file tree
Showing 58 changed files with 3,866 additions and 2,647 deletions.
39 changes: 39 additions & 0 deletions changes_script.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
require 'fileutils'

source_dir = '../openapi-unit-sdk/schemas'
target_dir = '../openapi-unit-sdk/schemas_with_one_of'

exclusions = [
'account.json',
'application.json',
'authorization_request.json',
'card.json',
'customer.json',
'limits.json',
'payment.json',
'recurring_payment.json',
'repayment.json',
'transaction.json'
]

def copy_files(source, target, exclusions)
FileUtils.mkdir_p(target) unless File.exist?(target)

Dir.foreach(source) do |item|
next if item == '.' or item == '..'
next if exclusions.include?(item)

source_path = File.join(source, item)
target_path = File.join(target, item)

if File.directory?(source_path)
copy_files(source_path, target_path, exclusions)
else
FileUtils.cp(source_path, target_path)
end
end
end

copy_files(source_dir, target_dir, exclusions)

puts "Files copied successfully, excluding specified files."
52 changes: 41 additions & 11 deletions generate.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,15 @@ def replace_paths_with_one_of(openapi_file, new_paths)
"/applications/{applicationId}": {
"$ref": "./schemas_with_one_of/application_paths.json#/application"
},
"/applications/{applicationId}/cancel": {
"$ref": "./schemas_with_one_of/application_paths.json#/cancel_application"
},
"/applications": {
"$ref": "./schemas_with_one_of/application_paths.json#/applications"
},
"/application-forms": {
"$ref": "./schemas_with_one_of/application_paths.json#/application_forms"
},
"/applications/{applicationId}/documents/{documentId}": {
"$ref": "./schemas_with_one_of/application_paths.json#/upload_pdf_file"
},
Expand All @@ -34,14 +43,26 @@ def replace_paths_with_one_of(openapi_file, new_paths)
"/applications/{applicationId}/documents/{documentId}/?": {
"$ref": "./schemas_with_one_of/application_paths.json#/upload_jpg_file"
},
"/applications/{applicationId}/cancel": {
"$ref": "./schemas_with_one_of/application_paths.json#/cancel_application"
"/applications/{applicationId}/documents/{documentId}/back": {
"$ref": "./schemas_with_one_of/application_paths.json#/upload_pdf_file_back"
},
"/applications": {
"$ref": "./schemas_with_one_of/application_paths.json#/applications"
"/applications/{applicationId}/documents/{documentId}/back/": {
"$ref": "./schemas_with_one_of/application_paths.json#/upload_png_file_back"
},
"/application-forms": {
"$ref": "./schemas_with_one_of/application_paths.json#/application_forms"
"/applications/{applicationId}/documents/{documentId}/back/?": {
"$ref": "./schemas_with_one_of/application_paths.json#/upload_jpg_file_back"
},
"/applications/{applicationId}/documents": {
"$ref": "./schemas_with_one_of/application_paths.json#/documents"
},
"/applications/{applicationId}/documents/{documentId}/verify": {
"$ref": "./schemas_with_one_of/application_paths.json#/verify_document"
},
"/applications/{applicationId}/documents/{documentId}/download": {
"$ref": "./schemas_with_one_of/application_paths.json#/download_document"
},
"/applications/{applicationId}/documents/{documentId}/download/back": {
"$ref": "./schemas_with_one_of/application_paths.json#/download_back_side_document"
},
"/application-forms/{applicationFormId}": {
"$ref": "./schemas_with_one_of/application_paths.json#/application_form"
Expand Down Expand Up @@ -218,10 +239,7 @@ def replace_paths_with_one_of(openapi_file, new_paths)
"$ref": "./schemas_with_one_of/check_deposit_paths.json#/get_back_check_deposit"
},
"/users/{userId}/api-tokens": {
"$ref": "./schemas_with_one_of/token_paths.json#/create_token"
},
"/users": {
"$ref": "./schemas_with_one_of/token_paths.json#/list_tokens"
"$ref": "./schemas_with_one_of/token_paths.json#/api_tokens"
},
"/users/{userId}/api-tokens/{tokenId}": {
"$ref": "./schemas_with_one_of/token_paths.json#/delete_token"
Expand Down Expand Up @@ -274,13 +292,25 @@ def replace_paths_with_one_of(openapi_file, new_paths)
"/check-payments/{checkPaymentId}/approve": {
"$ref": "./schemas_with_one_of/check_payment_paths.json#/check_payment_approve"
},
"/check-payments/{checkPaymentId}/cancel": {
"$ref": "./schemas_with_one_of/check_payment_paths.json#/check_payment_cancel"
},
"/check-payments/{checkPaymentId}/return": {
"$ref": "./schemas_with_one_of/check_payment_paths.json#/check_payment_return"
},
"/check-payments/{checkPaymentId}/front": {
"$ref": "./schemas_with_one_of/check_payment_paths.json#/get_check_payment_front"
},
"/check-payments/{checkPaymentId}/back": {
"$ref": "./schemas_with_one_of/check_payment_paths.json#/get_check_payment_back"
},
"/stop-payments": {
"$ref": "./schemas_with_one_of/stop_payment_paths.json#/stop_payments"
},
"/stop-payments/{stop_payment_id}": {
"$ref": "./schemas_with_one_of/stop_payment_paths.json#/stop_payment"
},
"/stop-payments/disable": {
"/stop-payments/{stop_payment_id}/disable": {
"$ref": "./schemas_with_one_of/stop_payment_paths.json#/disable_stop_payment"
}
}
Expand Down
1 change: 1 addition & 0 deletions schemas_with_one_of/account.json
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@
"$ref": "customer.json#/definitions/customerLinkage"
}
},
"additionalProperties": true,
"oneOf": [
{
"required": [
Expand Down
Loading

0 comments on commit 0c4a854

Please sign in to comment.