Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added validation for transaction uuid #134

Merged
merged 3 commits into from
Sep 22, 2023
Merged

added validation for transaction uuid #134

merged 3 commits into from
Sep 22, 2023

Conversation

maurafortino
Copy link
Contributor

@maurafortino maurafortino added the bug Something isn't working label Aug 28, 2023
@maurafortino maurafortino self-assigned this Aug 28, 2023
@maurafortino maurafortino changed the title WIP: added validation for transaction uuid added validation for transaction uuid Aug 28, 2023
@codecov
Copy link

codecov bot commented Aug 28, 2023

Codecov Report

Merging #134 (fc2dc49) into main (3855006) will increase coverage by 0.09%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main     #134      +/-   ##
==========================================
+ Coverage   47.69%   47.79%   +0.09%     
==========================================
  Files          24       24              
  Lines        4344     4352       +8     
==========================================
+ Hits         2072     2080       +8     
  Misses       2087     2087              
  Partials      185      185              
Flag Coverage Δ
unittests 47.79% <100.00%> (+0.09%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Changed Coverage Δ
messages.go 96.99% <100.00%> (ø)
messagetype.go 95.12% <100.00%> (ø)
wrphttp/handler.go 100.00% <100.00%> (ø)

@@ -128,6 +129,15 @@ func (wh *wrpHandler) ServeHTTP(httpResponse http.ResponseWriter, httpRequest *h
return
}

if entity.Message.Type == 3 && entity.Message.TransactionUUID == "" {
Copy link
Contributor

@johnabass johnabass Aug 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aren't there additional message types that require a TransactionUUID? I thought all the CRUD ones do as well.

In any case, I would use the MessageType.SupportsTransaction method to determine if it has a message type:

if entity.Message.Type.SupportsTransaction() && len(entity.Message.TransactionUUID) == 0 {
    // etc
}

Given that we're requiring a transaction UUID now, that method should probably change to something clearer, like RequiresTransactionUUID.

EDIT:
For reference: https:/xmidt-org/wrp-go/blob/main/messagetype.go#L50

@schmidtw schmidtw merged commit 166b282 into main Sep 22, 2023
16 checks passed
@schmidtw schmidtw deleted the tid-validation branch September 22, 2023 23:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants