Javalin 4: Construct validator from typed object
See original GitHub issueDescribe 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:
- Created 2 years ago
- Comments:6 (6 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Good question. But I think I have an idea. Will make another PR.
@tipsy Please look at #1396