-
-
Notifications
You must be signed in to change notification settings - Fork 18
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
com.fasterxml.jackson.databind.exc.InvalidDefinitionException: No value type configured for ObjectReader #237
Comments
Hey, unfortunately I'm unable to reproduce this problem in our test setup: nor the real world app that uses config processor: Could you create an example project affected by this bug and send it here? :) |
Hey, I'll try my best to get you a minimal reproduction sometime tomorrow hopefully. |
Facing the same issue, root cause seems to be in My example to reproduce the problem in Javalin import static io.javalin.apibuilder.ApiBuilder.get;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import io.javalin.Javalin;
import io.javalin.http.HttpStatus;
import io.javalin.openapi.plugin.OpenApiPlugin;
import io.javalin.openapi.plugin.swagger.SwaggerPlugin;
import io.javalin.testtools.JavalinTest;
import org.junit.jupiter.api.Test;
class OpenApiTest {
final Javalin javalin =
Javalin.create(
config -> {
// Registering OpenAPI
config.registerPlugin(new SwaggerPlugin());
config.registerPlugin(
new OpenApiPlugin(
pluginConfig ->
pluginConfig.withDefinitionConfiguration(
(version, definition) ->
definition.withInfo(info -> info.setTitle("test")))));
config.router.apiBuilder(() -> get("/api/health", ctx -> ctx.result("OK")));
});
@Test
void hasHealthcheck() {
JavalinTest.test(
javalin,
(server, client) -> {
try (final var healthcheckResponse = client.get("/api/health")) {
assertEquals(
HttpStatus.OK.getCode(), healthcheckResponse.code(), "Response code is not OK");
assertEquals(
"OK", healthcheckResponse.body().string(), "Response body is not text saying 'OK'");
}
});
}
@Test
void hasOpenApiAndSwaggerEndpoints() {
JavalinTest.test(
javalin,
(server, client) -> {
try (final var metricsResponse = client.get("/openapi?v=default")) {
assertEquals(
HttpStatus.OK.getCode(), metricsResponse.code(), "Response code is not OK");
final var responseBody = metricsResponse.body().string();
assertNotNull(responseBody, "Response body is null");
assertFalse(responseBody.isBlank(), "Response body is blank");
}
try (final var metricsResponse = client.get("/swagger")) {
assertEquals(
HttpStatus.OK.getCode(), metricsResponse.code(), "Response code is not OK");
final var responseBody = metricsResponse.body().string();
assertNotNull(responseBody, "Response body is null");
assertFalse(responseBody.isBlank(), "Response body is blank");
}
});
}
} |
Actual behavior (the bug)
When registering OpenApiPlugin with a definition configuration (even if it is empty/blank) trying to access the openapi.json documentation causes a server error
Expected behavior
There shouldn't be an error for adding a definition configuration
To Reproduce
build.gradle.kts
open api setting configuration
Additional context
Add any other context about the bug here
The text was updated successfully, but these errors were encountered: