Skip to content

Improve rendering of collection-like properties using MongoJsonSchemaCreator #3766

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

Closed
MateuszWicherski opened this issue Aug 10, 2021 · 5 comments
Assignees
Labels
type: enhancement A general enhancement

Comments

@MateuszWicherski
Copy link

Hi!

I think that MongoJsonSchemaCreator is treating collection like fields of a @Document class incorrectly:

  • for simple and enum lists (e.g. List<String>, List<Enum>), information about expected array type is lost and they are included in a resulting schema as array
  • complex lists (e.g. List<ObjectType>), are resolved as an object with properties taken from ObjectType - the information that it is an array is lost completely (and results in not being able to insert correct document into the database).

Minimal example to reproduce the issue can be found here:
https://github.com/MateuszWicherski/spring-data-mongodb-bug

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Aug 10, 2021
@christophstrobl
Copy link
Member

Thanks for bringing this up. We'll have a look!

@christophstrobl
Copy link
Member

We updated the MappingMongoJsonSchemaCreator to include items in case you want to give #3837 a try.

@christophstrobl christophstrobl added status: waiting-for-feedback We need additional information before we can continue and removed status: waiting-for-triage An issue we've not yet triaged labels Sep 24, 2021
@spring-projects-issues
Copy link

If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.

@spring-projects-issues spring-projects-issues added the status: feedback-reminder We've sent a reminder that we need additional information before we can continue label Oct 1, 2021
@christophstrobl christophstrobl removed status: waiting-for-feedback We need additional information before we can continue status: feedback-reminder We've sent a reminder that we need additional information before we can continue labels Oct 1, 2021
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Oct 1, 2021
@MateuszWicherski
Copy link
Author

Hi! Sorry for delay, I had no time to check it. The fix looks nice, I have checked it against my code and it is working as expected. 5 star job!

@christophstrobl
Copy link
Member

@MateuszWicherski thanks for giving it a try!

@mp911de mp911de closed this as completed in bbe8410 Oct 7, 2021
mp911de added a commit that referenced this issue Oct 7, 2021
Remove code duplications. Reuse target type computation for enum types. Refine method names.

See #3766
Closes #3837
@mp911de mp911de added this to the 3.3 RC1 (2021.1.0) milestone Oct 7, 2021
@mp911de mp911de added type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged labels Oct 7, 2021
@mp911de mp911de changed the title Issue with autogenerating JSON schema based on @Document with MongoJsonSchemaCreator Improve rendering of collection-like properties using MongoJsonSchemaCreator Oct 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A general enhancement
Projects
None yet
4 participants