question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Javalin 4: Construct validator from typed object

See original GitHub issue

Describe the feature In Javalin 3 Validator could be constructed from typed object:

open class Validator<T>(val value: T?, val messagePrefix: String = "Value", val key: String = "Parameter") {
...

In Javalin 4 the only way to construct Validator is to convert from string to typed object.

Additional context This makes harder to convert code from Javalin 3 to Javalin 4, when Javalin’s Validator used for validation of existing typed objects. To migrate such code, I’d not like to convert back and forth to/from string to get object into Validator, especially if object contains input stream with potentially long data.

p.s. I can try to submit patch for this.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
IvanPizhenkocommented, Sep 19, 2021

Good question. But I think I have an idea. Will make another PR.

0reactions
IvanPizhenkocommented, Sep 19, 2021

@tipsy Please look at #1396

Read more comments on GitHub >

github_iconTop Results From Across the Web

Javalin 4: Construct validator from typed object · Issue #1393 - GitHub
In Javalin 4 the only way to construct Validator is to convert from string to typed object. Additional context. This makes harder to...
Read more >
Documentation - A lightweight Java and Kotlin web framework
Validation. You can use Javalin's Validator class for query, form, and path parameters, as well as headers and the request body:.
Read more >
Javalin 4: How to write properly check in call to Validator ...
I am trying to adopt existing code of parameter validation from Javalin 3 to Javalin 4. It uses Javalin's Validator class.
Read more >
Javalin: A Simple, Modern Web Server Framework - Oracle Blogs
Javalin is a very lightweight web framework for Java 8 (and later) and Kotlin. It supports modern features such as HTTP/2, WebSocket, and...
Read more >
javalin-io/general - Gitter
pathParamOrThrow(pathParamMap, key, matchedPath) /** * Creates a [Validator] for the pathParam() value, with the prefix "Path parameter '$key' with value ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found