hi folks, quick question, is there a way to pass e...
# questions
p
hi folks, quick question, is there a way to pass extra parameters to custom marshallers?
u
The Grails documentation I have ingested does not mention how to pass extra parameters to custom marshallers; it only describes the standard ObjectMarshaller interface, which provides the object to be marshalled and the converter, but does not support passing additional parameters directly. If you need to clarify your use case, such as whether you want to influence marshalling at runtime per request or configure marshallers globally, please provide more details. If this doesn't help, please reach out to the Grails support team for further assistance. 👍 0 button 👎 0 button 💡 Hint: Mention @runllm in the thread for followups.
u
A message from kapa.ai
u
I'm sorry, but the knowledge sources do not explicitly mention a built-in way to pass extra parameters to custom marshallers in Grails. The marshaller interfaces and registration methods (such as those for grails.converters.JSON) are designed to work with the object being marshalled, but they do not provide a mechanism for passing additional parameters at runtime beyond the object itself and its properties [JSON API](https://grails.apache.org/docs/latest/api/grails/converters/JSON.html). If you need to customize the marshalling process with extra parameters, you would typically need to design your marshaller or renderer to access those parameters via some shared context (such as thread-local storage, a service, or by encoding them in the object itself), but this is not documented as a standard feature in Grails. If you have a specific use case, you might consider implementing a custom renderer or converter, where you have more control over the rendering process and could potentially inject or access additional data as needed [Custom Renderers](https://docs.grails.org/latest/guide/REST.html#customRenderers) [Custom Converters](https://docs.grails.org/latest/guide/theWebLayer.html#converters). If you need more details or have a specific scenario, please provide more context!
p
sorry, who added these AI bots?
s
Yeah the bots... They're annoying. I'm wondering if there's a chance they can be moved to an "opt-in" AI assisted channel.
👍 1
g
+1
p
Anyway, it seems there is no way to pass extra parameters to the custom marshallers, though Claude.ai suggested to use a class with a private static final ThreadLocal<Map> context = new ThreadLocal<Map>() for storing the params, which is kind of a singleton per thread thing. I'm not sure if that is the best solution but it works.
j
Let's give the bots a chance. They provide immediate feedback and let's see what their solve rate ends up looking like, after some optimization. We have control over the knowledgebase they are built on. 3rd party plugin are not part of their training currently. Kapa and Runllm are both paid solutions being donated to the ASF that were spearheaded by the Apache Superset team and presented at the conference this year. They are not a replacement for human answers in #C07M0GTDE, just first level, instant support. I've personally answered a lot of questions in this channel at all hours and all days of the week and know I will not be able to continue that pace in the future. I might be able to take a look 2 or 3 times a week.
👏 1
When I don't know an answer I normally hit an LLM anyway.
p
As I mentioned in the other thread, at least for this question the bots were not helpful, when I did the same on Claude.ai it came back with a solution. I'm questioning the capabilities of these LLMs, maybe their context is too small.
s
When I don't know an answer I normally hit an LLM anyway.
Choosing to ask AI is very different to having it forced upon us though. That's why I said an opt-in. Many people will be happier with no first level support and waiting for a human than having their question, shared without consent, with external services for little benefit as most of the free ones are limited and often contradictory. I realise we have the choice to leave the channel/community... too. But I was hoping for a less nuclear otpion.
👍 1