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

IllegalArgumentException when using Optional #65

Open
cuzz22000 opened this issue Aug 11, 2015 · 0 comments
Open

IllegalArgumentException when using Optional #65

cuzz22000 opened this issue Aug 11, 2015 · 0 comments

Comments

@cuzz22000
Copy link

When using Guava's Optional with a @QueryParam annotation the scanner does not recognize the object defining it as null producing the following exception.

io.federecio.dropwizard.junitrunner.DropwizardJunitRunnerException: java.lang.IllegalArgumentException: Unrecognized Type: [null]
    ...
Caused by: java.lang.IllegalArgumentException: Unrecognized Type: [null]
    at com.fasterxml.jackson.databind.type.TypeFactory._constructType(TypeFactory.java:405)
    at com.fasterxml.jackson.databind.type.TypeFactory.constructType(TypeFactory.java:354)
    at com.fasterxml.jackson.databind.ObjectMapper.constructType(ObjectMapper.java:1330)
    at com.wordnik.swagger.jackson.ModelResolver.resolveProperty(ModelResolver.java:62)
    ...

To reproduce the exception during unit tests I've added an Optional argument to io.federecio.dropwizard.swagger.TestResource.

 @GET
    @ApiOperation(OPERATION_DESCRIPTION)
    public Response dummyEndpoint(@QueryParam("dummy") final Optional<String> dummy) {
        return Response.ok().build();
    }

Branch containing the updated method can be found here -> https://github.com/TimeIncOSS/dropwizard-swagger/tree/optional-issue

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

No branches or pull requests

1 participant