spring-projects / spring-projects/spring-ai

BeanOutputConverter getFormat() and convert() format mismatch for List types

Open
#5,707 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

status: waiting-for-triage
Dominant language
Java
Stars
9.5k
Forks
2.9k
Avg merge
1d 7h
Merged PRs (30d)
6

Description

Please do a quick search on GitHub issues first, there might be already a duplicate issue for the one you are about to create.
If the bug is trivial, just go ahead and create the issue. Otherwise, please take a few moments and fill in the following sections:

Bug description

  • prompt
  • Your response should be in JSON format.
    Do not include any explanations, only provide a RFC8259 compliant JSON response following this format without deviation.
    Do not include markdown code blocks in your response.
    Remove the ```json markdown from the output.
    Here is the JSON Schema instance your output must adhere to:
  "$schema" : "https://json-schema.org/draft/2020-12/schema",
  "type" : "array",
  "items" : {
    "type" : "object",
    "properties" : {
      "sql" : {
        "type" : "string",
        "description" : "SQL语句"
      },
      "stepName" : {
        "type" : "string",
        "description" : "步骤名称"
      }
    },
    "required" : [ "sql", "stepName" ],
    "additionalProperties" : false
  }
}```
- getFormat() generates: {"type":"array","items":[...]}
- convert() expects: [{...},{...}]

**Environment**
spring ai 1.1.3

When LLM follows the format from getFormat(), convert() fails with:
MismatchedInputException: Cannot deserialize value of type ArrayList from Object value

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing BeanOutputConverter.getFormat() and convert() for List types, using the reported schema and Spring AI 1.1.3 behavior to reproduce the mismatch. Confirm that the format emitted for a list matches the structure convert() deserializes, and verify the bug is covered by a passing regression test.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.