SOLR-18191: draft - #4329
Conversation
|
@malliaridis I believe my changes to org.apache.solr.jersey.MessageBodyReaders.CachingJsonMessageBodyReader is an existing bug, don't see why we should not use SolrJacksonMapper.getObjectMapper() |
malliaridis
left a comment
There was a problem hiding this comment.
I was hoping for a simple flag that can be set in the object mapper or somewhere else that turns off the lenient behavior, but apparently jackson does not have such flag. Instead, you have to configure each feature / flag individually and set them all to the strict behavior (whether this is true or false) manually. And Jackson has a lot of flags.
| .registerModule(customTypeModule); | ||
|
|
||
| mapper | ||
| .coercionConfigFor(LogicalType.Textual) |
There was a problem hiding this comment.
- This only covers lenient cases for where text / string is expected. For cases where a number is expected and a text is provided, this will not catch a bad type.
- This approach only covers cases that are listed. For example, I am allowed to provide
trueinstead of a string and it will not fail. - When running into this coercion violation, the message could be optimized by customizing it (if possible). Right now it says:
"msg": "Cannot coerce Integer value (123) to `java.lang.String` value (but could if coercion was enabled using `CoercionConfig`)"
There was a problem hiding this comment.
Hi @malliaridis
I think we have covered all the case you mention, have a look at the tests.
I managed to change the error message, you pass in "name": 123 you get now:
"Invalid value for field 'name': expected String.
…t.java Co-authored-by: Christos Malliaridis <c.malliaridis@gmail.com>
| if (v1ParamMap.get("newCollection") instanceof String newCollectionStr) { | ||
| v1ParamMap.put("newCollection", Boolean.valueOf(newCollectionStr)); | ||
| } | ||
|
|
There was a problem hiding this comment.
@malliaridis Your tests are passing now, but I had to do these changes, else it blows up already on the test setup, with this exception:
org.apache.solr.client.solrj.RemoteSolrException: Error from server at http://127.0.0.1:53370/solr: org.apache.solr.common.SolrException: Underlying core creation failed while creating collection: collection1 at __randomizedtesting.SeedInfo.seed([99D40937BA20F6D9]:0) at app//org.apache.solr.client.solrj.apache.HttpSolrClient.executeMethod(HttpSolrClient.java:685) at app//org.apache.solr.client.solrj.apache.HttpSolrClient.request(HttpSolrClient.java:255) at app//org.apache.solr.client.solrj.apache.HttpSolrClient.request(HttpSolrClient.java:234) at app//org.apache.solr.client.solrj.impl.LBSolrClient.doRequest(LBSolrClient.java:629) at app//org.apache.solr.client.solrj.impl.LBSolrClient.doRequest(LBSolrClient.java:613) at app//org.apache.solr.client.solrj.impl.LBSolrClient.doRequest(LBSolrClient.java:638) at app//org.apache.solr.client.solrj.impl.LBSolrClient.request(LBSolrClient.java:582) at app//org.apache.solr.client.solrj.impl.CloudSolrClient.sendRequest(CloudSolrClient.java:1596) at app//org.apache.solr.client.solrj.impl.CloudSolrClient.requestWithRetryOnStaleState(CloudSolrClient.java:1231) at app//org.apache.solr.client.solrj.impl.CloudSolrClient.request(CloudSolrClient.java:1153) at app//org.apache.solr.client.solrj.SolrRequest.process(SolrRequest.java:302) at app//org.apache.solr.client.solrj.SolrRequest.process(SolrRequest.java:348) at app//org.apache.solr.handler.V2ApiIntegrationTest.createCluster(V2ApiIntegrationTest.java:62)
What do you think?
There was a problem hiding this comment.
@malliaridis Any other cases we need to consider?
No description provided.