[JAVA-2620] @BsonIgnore doesn't prevent PojoBuilderHelper.configureClassModelBuilder from calling getTypeData on ignored fields Created: 04/Oct/17 Updated: 29/Oct/23 Resolved: 04/Dec/17 |
|
| Status: | Closed |
| Project: | Java Driver |
| Component/s: | POJO |
| Affects Version/s: | 3.5.0 |
| Fix Version/s: | 3.6.0 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Kieron Edwards | Assignee: | Ross Lawley |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Description |
|
In a POJO if you have a field or method that is marked with @BsonIgnore , and if this is a type disallowed by the TypeData$Builder the class model creation will fail - despite this field / method not being required. Example exception
Here the pojo contains a Map keyed on an enum. This map is marked with @BsonIgnore, hence I would not expect the failure above. |
| Comments |
| Comment by Christian H. [ 03/Feb/21 ] |
|
I'd also love to be able to use enums as map keys |
| Comment by Githook User [ 04/Dec/17 ] |
|
Author: {'username': 'rozza', 'email': 'ross.lawley@gmail.com', 'name': 'Ross Lawley'}Message: TypeData no longer validates data. With the introduction of PropertyCodecProviders the This changes behavior for "invalid Maps" to a possible The side effect of this change is @BsonIgnore and
|
| Comment by Githook User [ 04/Dec/17 ] |
|
Author: {'username': 'rozza', 'email': 'ross.lawley@gmail.com', 'name': 'Ross Lawley'}Message: TypeData no longer validates data. With the introduction of PropertyCodecProviders the This changes behavior for "invalid Maps" to a possible The side effect of this change is @BsonIgnore and
|
| Comment by Ross Lawley [ 05/Oct/17 ] |
|
Thanks edwaki, Interesting case, the issue here is Conventions such as the AnnotationConvention are only applied after the initial mapping of the POJO. Here the error is occurring during the initial mapping. I'll have to consider how best to handle scenarios like this in the future. Ross |