Skip to content

ADK in general and FunctionTool must allow injecting one's custom ObjectMapper instead of hard-coding it #473

Description

@vorburger

Describe the bug

ADK currently hard-codes new ObjectMapper().registerModule(new Jdk8Module()) in places like here.

This is well intended ("it works out of the box"), but it's not extensible, and blocks one from using a custom ObjectMapper; e.g. in my project I would like (have) to use this one instead; notably for:

mapper.registerModule(new JavaTimeModule());

But this (the JavaTimeModule) is really just one case - the point is that users should be able to inject their own.

The specific issue I've faced is that my ToDoTool here used a domain class ToDo with Instant fields, and that made choke.

I'm temporarily working around it with enola-dev/enola#1855 - but I shouldn't have to.

To Reproduce
Steps to reproduce the behavior:

  1. git clone https://github.com/enola-dev/enola.git
  2. Revert fix: Work around https://github.com/enola-dev/enola/issues/1854 enola-dev/enola#1855
  3. Run b test //java/dev/enola/todo/...
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.

Additional context

@Poggecci @Doris26 @shukladivyansh @Jacksunwei @glaforge agreed that this makes sense?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions