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

cleanup validation tests #3534

Merged
merged 2 commits into from
Sep 18, 2024

Conversation

kliushnichenko
Copy link
Contributor

just a bit of cleaning

@@ -576,7 +576,7 @@ a javadoc:Session[] but the lifecycle is shorter: *data is kept for only one req
});

post("/save", ctx -> {
ctx.flash("success", "Item created"); <1>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

just aligning the doc with what we have at the moment. There is no ctx.flash(str,str) method

@@ -22,12 +22,6 @@ public Bean validateFormBean(@Valid @FormParam Bean bean) {
return bean;
}

// todo: revive when flash `toNullable` will be fixed
Copy link
Contributor Author

Choose a reason for hiding this comment

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

What I meant here is that it is possible to define the param as object @FlashParam Bean bean
and apt will generate the code that is not executable, since toNullable is not there for flash/session/...
image

The use-case a bit synthetic, but still, I can add some type checking if you think it makes sense

Copy link
Member

Choose a reason for hiding this comment

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

Let's add the type check

@@ -22,12 +22,6 @@ public Bean validateFormBean(@Valid @FormParam Bean bean) {
return bean;
}

// todo: revive when flash `toNullable` will be fixed
Copy link
Member

Choose a reason for hiding this comment

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

Let's add the type check

@kliushnichenko
Copy link
Contributor Author

Added type verification.

Flash, Session, Cookie, and Header params are now restricted to BUILT_IN types.
Let me know if I missed smthg.

Error message will look like this:

Illegal argument type at 'tests.verifyarg.ControllerFlash.param()'. 
Parameter 'param' annotated as [io.jooby.annotation.FlashParam] cannot be of type 'java.lang.Object'. 
Supported types are: [java.lang.Byte, java.lang.Short, java.lang.Character, java.lang.String, short, int, java.net.URI, java.lang.Float, java.lang.Boolean, float, char, java.time.LocalDateTime, byte, java.lang.Enum, java.math.BigInteger, java.util.UUID, java.util.Date, java.lang.Long, java.math.BigDecimal, io.jooby.StatusCode, java.lang.Double, boolean, java.net.URL, java.time.ZoneId, java.util.TimeZone, java.lang.Integer, java.time.LocalDate, java.time.Instant, java.time.Duration, java.nio.charset.Charset, java.time.Period, double, long]

@jknack jknack added this to the 3.4.0 milestone Sep 18, 2024
@jknack jknack merged commit 7433c2c into jooby-project:3.x Sep 18, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants