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

Correct validation for @Serializable(as = ...) and @Deserializable(as = ...) #651

Merged
merged 1 commit into from Nov 7, 2023

Conversation

dstepanov
Copy link
Contributor

  • Refactored SerdeAnnotationVisitor to throw an exception instead of registering a failure

Fixes #642

@@ -451,6 +451,6 @@ record Test(

then:
def e = thrown(RuntimeException)
e.message.contains("A method annotated with AnyGetter must return a Map")
e.message.contains("A field annotated with AnyGetter must be a Map")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Refactoring corrected the use-case

return status.getCode();
}
}

@Serdeable.Deserializable(as = Another.class)
// Skip validation for this mixin: the deserializable-as cannot be validated for a mixin
@Serdeable.Deserializable(validate = false, as = Another.class)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The validation for the mixin needs to be disabled

Copy link

sonarcloud bot commented Nov 7, 2023

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 6 Code Smells

55.2% 55.2% Coverage
0.0% 0.0% Duplication

idea Catch issues before they fail your Quality Gate with our IDE extension sonarlint SonarLint

@dstepanov dstepanov merged commit c3e9f55 into master Nov 7, 2023
11 of 12 checks passed
@dstepanov dstepanov deleted the correctvali branch November 7, 2023 14:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

@Serializable(as = ...) and @Deserializable(as = ...) doesn't check type compatibility
2 participants