Skip to content

Conversation

bamapookie
Copy link

@bamapookie bamapookie commented Oct 6, 2025

  • You have read the Spring Data contribution guidelines.
  • You use the code formatters provided here and have them applied to your changes. Don’t submit any formatting related changes.
  • You submit test cases (unit or integration tests) that back your changes.
  • You added yourself as author in the headers of the classes you touched. Amend the date range in the Apache license header if needed. For new types, add the license header (copy from another file and set the current year only).

Copyright date already set to 2025. No new files. No author lists in files I touched, so I left my name out.

Fixes #5065

Copy link
Member

@christophstrobl christophstrobl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for taking the time to prepare this PR.
Kindly let me know if you'd like to add the tests from the review comment. If not, I can take it from here and continue the work.

@Test // GH-5065
@DisplayName("Converter should read an empty object as an empty map with a valis values property when using @DocumentReference(lazy = true).")
void readsEmptyMapWithLazyLoadedDocumentReferenceCorrectly() {
org.bson.Document document = org.bson.Document.parse("{\"map\":{}}");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would also be interesting to have test for { 'map' : null } expecting null for the target.map.

@bamapookie
Copy link
Author

bamapookie commented Oct 15, 2025 via email

@bamapookie bamapookie force-pushed the 5065-empty-map-with-document-reference branch from 18d87d6 to dbda7b4 Compare October 16, 2025 04:46
@bamapookie
Copy link
Author

bamapookie commented Oct 16, 2025

I added tests where the map is explicitly assigned null and rebased on the latest main. There is one error occurring on the null assignment to the @DocumentReference Map<>. I also added @DBRef tests as well, though I don't think they are affected by the underlying bug. I'll look into the failing test tomorrow.

@mp911de mp911de added type: bug A general bug and removed status: waiting-for-triage An issue we've not yet triaged labels Oct 20, 2025
@mp911de mp911de requested a review from schauder October 20, 2025 13:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: bug A general bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Document with Map decorated with @NonNull and @DocumentReference fails to deserialize

4 participants