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

ObjectMapper FAIL_ON_UNKNOWN_PROPERTIES regression in 2.0.0-rc3? #2806

Closed
johnv-git opened this issue Jun 17, 2019 · 3 comments
Closed

ObjectMapper FAIL_ON_UNKNOWN_PROPERTIES regression in 2.0.0-rc3? #2806

johnv-git opened this issue Jun 17, 2019 · 3 comments
Milestone

Comments

@johnv-git
Copy link

I have a 1.3.12 application undergoing an exploratory migration to 2.0.0-rc3. A few working tests are now failing under 2.0.0-rc3. The tests POST an entity with unknown properties: 1.3.12 returns 400, 2.0.0 returns 204. If I explicitly configure the objectmapper with objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true); then the tests work as they did in 1.3.12.

Explicit configuration seems like "the right thing", but regressions make everyone sad.

    // Create an AUTH aware web container with the event resource endpoints available.
    @ClassRule
    public static final ResourceTestRule eventResource = ResourceTestRule.builder()
            .setTestContainerFactory(new GrizzlyWebTestContainerFactory())
            .addProvider(new AuthDynamicFeature(
                            new OAuthCredentialAuthFilter.Builder<>()
                                    .setAuthenticator(new WebTokenAuthenticator())
                                    .setAuthorizer(new WebTokenAuthorizer())
                                    .setPrefix("Bearer")
                                    .buildAuthFilter()
                    )
            )
            .addProvider(RolesAllowedDynamicFeature.class)
            .addProvider(new AuthValueFactoryProvider.Binder<>(MyUser.class))
            .addResource(new EventResource(eventStoreFactory))
            .build();

    @Before
    public void setUp() {
    // this fixes the problem in 2.0.0-rc3
eventResource.getObjectMapper().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true);
    }
@johnv-git
Copy link
Author

Ah this is an intention change as per:
#2567

Should be called out in the migration documentation.

@joschi
Copy link
Member

joschi commented Jun 18, 2019

@meshuga It was added in the documentation: https://github.com/dropwizard/dropwizard/blob/v2.0.0-rc3/docs/source/manual/core.rst#unknown-properties

But I agree that we could make it more obvious in the migration notes.

@joschi joschi reopened this Jun 18, 2019
@joschi joschi added this to the 2.0.0 milestone Jun 18, 2019
@nickbabcock
Copy link
Contributor

I updated the migration notes with a small blurb 🙆‍♂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants