Git Product home page Git Product logo

Comments (8)

poikilotherm avatar poikilotherm commented on July 28, 2024

@f-lopes would you welcome a PR for this? I actually need this... 😉

from spring-mvc-test-utils.

f-lopes avatar f-lopes commented on July 28, 2024

Dear @poikilotherm,

Of course 😃, I will commit my changes soon (#4) to make sure you work on the latest codebase.

from spring-mvc-test-utils.

poikilotherm avatar poikilotherm commented on July 28, 2024

Hey @f-lopes

I started to work on this in https://github.com/poikilotherm/spring-mvc-test-utils/tree/support_mapOmap.

Unfortanetly, I can't get the Smoke Test fullTest() to work, because the three dimensional map seems not to be supported. While using a two dim map, this is no problem at all... 🤔

I tried to use such three dimensional maps in real forms and that was no problem at all... I just don't get it - maybe you have an idea?

from spring-mvc-test-utils.

f-lopes avatar f-lopes commented on July 28, 2024

Hi @poikilotherm,

I saw your work on the fork. Multi-dimensional Map parameters need to be separated by dots "." to instantiate nested properties.
The smoke test is passing when adding the following parameter:
mmData[orgUnit].[employee].[firstName]=John

Could you first write unit tests to validate the three-dimensional map mapping to HTTP parameters?

Thanks.

from spring-mvc-test-utils.

poikilotherm avatar poikilotherm commented on July 28, 2024

Hi @f-lopes,

I already wrote that unit test first... ;-)

Actually I think we cannot use more than two dimensions. After testing this again with some example code, I can use maps with more than 2 dimensions within templates (SpEL seems to be ok with that when used in Thymeleaf), but when I try to submit the data, the binding fails with the exact same error.

I was not able to find any documentation on this and after digging through the Spring Framework source code, I was even more confused of the black magic that happens in the data binding background. Even in the Spring JIRA issues I was not able to find anything... Do you know some of the devs, so we might ask them directly? Not sure if they would react here on GitHub if we mention them...

Using the "dotted" notation you mentioned above might get things to work, but this is no good, as Thymeleaf etc are not using this format (they use the name[key1][key2][...] notation).

So maybe lets stick with 2 dimensions for now? (Will have to redesign my models, but well... things happen...)

from spring-mvc-test-utils.

f-lopes avatar f-lopes commented on July 28, 2024

Hi @poikilotherm,

Sorry, I didn't find the unit test at first ;)

Of course, your solution may be to use a List to model your data. Is the problem related to the "auto-growing/instantiation" of nested Map properties. These discussions might help:

Unfortunately, I don't know any developer from the Spring team.

For your information, I will open a pull request to give you the possibility to discuss the next version (2.0.0) which will rely on Spring's TypeConverter implementation.

from spring-mvc-test-utils.

poikilotherm avatar poikilotherm commented on July 28, 2024

Thank you for the links @f-lopes. Unfortanetly I already had a look at those while digging through Google and they didn't enlighten me regarding this specific problem. The upstream bug report is closed as fixed, too...

As a consequence, I opened a new issue: https://jira.spring.io/browse/SPR-16745

Let's keep our fingers crossed some of the devs find the time to respond.

from spring-mvc-test-utils.

f-lopes avatar f-lopes commented on July 28, 2024

Thanks for the issue.

I've created a pull-request for the next release (#7). Feel free to add your suggestions.

Thanks.

from spring-mvc-test-utils.

Related Issues (9)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.