Skip to content

Commit

Permalink
Relaxed parameter matching requirement (#18667)
Browse files Browse the repository at this point in the history
  • Loading branch information
kjduensing authored Sep 27, 2024
1 parent 151e571 commit 8e49691
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion app/swagger/swagger/requests/travel_pay.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class TravelPay
parameter do
key :name, 'id'
key :in, :path
key :description, 'The non-PII/PHI id of a claim (UUIDv4)'
key :description, 'The non-PII/PHI id of a claim (UUID - any version)'
key :required, true
key :type, :string
end
Expand Down
8 changes: 4 additions & 4 deletions modules/travel_pay/app/services/travel_pay/claims_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ def get_claims(veis_token, btsss_token, params = {})
end

def get_claim_by_id(veis_token, btsss_token, claim_id)
# ensure claim ID is the right format
uuid_v4_format = /^[0-9A-F]{8}-[0-9A-F]{4}-[4][0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i
# ensure claim ID is the right format, allowing any version
uuid_all_version_format = /^[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[89ABCD][0-9A-F]{3}-[0-9A-F]{12}$/i

unless uuid_v4_format.match?(claim_id)
raise ArgumentError, message: "Expected claim id to be a valid v4 UUID, got #{claim_id}."
unless uuid_all_version_format.match?(claim_id)
raise ArgumentError, message: "Expected claim id to be a valid UUID, got #{claim_id}."
end

claims_response = client.get_claims(veis_token, btsss_token)
Expand Down
2 changes: 1 addition & 1 deletion modules/travel_pay/spec/services/claims_service_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
service = TravelPay::ClaimsService.new

expect { service.get_claim_by_id(*tokens, claim_id) }
.to raise_error(ArgumentError, /valid v4 UUID/i)
.to raise_error(ArgumentError, /valid UUID/i)
end
end

Expand Down

0 comments on commit 8e49691

Please sign in to comment.