typesense / typesense/typesense-api-spec

Invalid definition of conversation_history

Open
#113 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
No language data
Stars
23
Forks
33
PR merge metrics
No merged PRs in 30d

Description

https://raw.githubusercontent.com/typesense/typesense-api-spec/master/openapi.yml has this definition:

    SearchResultConversation:
      type: object
      required:
        - answer
        - conversation_history
        - conversation_id
        - query
      properties:
        answer:
          type: string
        conversation_history:
          type: array
          items:
            type: object
        conversation_id:
          type: string
        query:
          type: string

while the server (at least the one running inside Docker image typesense/typesense:30.1) to a POST request made to
/multi_search?conversation=true&conversation_model_id=some_id&q=some%20question endpoint returns this response:

{
	"conversation": {
		"answer": "Some answer",
		"conversation_history": {
			"conversation": [{
				"user": "some question"
			}, {
				"assistant": "some text"
			}],
			"last_updated": 1771040240
		},
		"conversation_id": "103244f3-2f0d-4bfa-acd8-62c881170018",
		"query": "some query"
	},
	"results": []
}

The issue is that conversation_history in openapi.yml is an array while in server's response it is an object. As the result, typesense-java library is built with wrong classes and I get a runtime error during deserialization of server's response:

com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize value of type `java.util.ArrayList<java.lang.Object>` from Object value (token `JsonToken.START_OBJECT`)
 at [Source: REDACTED (`StreamReadFeature.INCLUDE_SOURCE_IN_LOCATION` disabled); line: 1, column: 787] (through reference chain: org.typesense.model.MultiSearchResult["conversation"]->org.typesense.model.SearchResultConversation["conversation_history"])

Contributor guide

No contributing guide indexed for this repository

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

Open openapi.yml and inspect the SearchResultConversation schema, especially conversation_history. Compare its declared type with the example POST /multi_search response and check the generated client model or schema validation. Done means the specification represents the returned object shape and generated clients can deserialize conversation_history without a type mismatch.

Written by the indexing model from the issue text.

Assessment

Tech stack
openapi
Domain
api
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.