Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swagger claims receive endpoint returns string, but it's an object #622

Open
1 of 2 tasks
crummy opened this issue Nov 27, 2024 · 1 comment
Open
1 of 2 tasks

Swagger claims receive endpoint returns string, but it's an object #622

crummy opened this issue Nov 27, 2024 · 1 comment

Comments

@crummy
Copy link
Contributor

crummy commented Nov 27, 2024

The problem

I ran the liblab API generator against the swagger code with:

liblab init --spec https://bbernhard.github.io/signal-cli-rest-api/src/docs/swagger.json
liblab build --language java

(I had to fix the /search endpoint missing {number}, but after that...)

When I call the /v1/receive endpoint, I get this error in my client:

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: (String)"[{"envelope":{"source":"+178...","sourceNumber":"+1781...","sourceUuid":"...","sourceName":"...","sourceDevice":2,"timestamp":1732652479395,"dataMessage":{"timestamp":1732652479395,"message":"...",...

The function func (a *Api) Receive(c *gin.Context) does seem to return a string, rather than a JSON object. But presumably it's a JSON string, returned from the client.

I think the fix would be to, in signal-cli-rest-api, parse the returned string into an object, return it with c.JSON(200, obj), and add the object type to the swagger comments. Does that sound right?

Are you using the latest released version?

  • Yes

Have you read the troubleshooting page?

  • Yes

What type of installation are you running?

signal-cli-rest-api Docker Container

In which mode are you using the docker container?

Native Mode

What's the architecture of your host system?

x86-64

Additional information

No response

@bbernhard
Copy link
Owner

Thanks for the report!

I think the fix would be to, in signal-cli-rest-api, parse the returned string into an object, return it with c.JSON(200, obj), and add the object type to the swagger comments. Does that sound right?

yeah, right. It is on my todo list since a while, but I haven't found time to work on that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants