Is it possible to retrieve response schema?


(Anton Griadchenko) #1


I’d like to consume web-api of SQ server via Golang and can’t find any ready library for that. I decided to create one.

The /api/webservices/list endpoint looks good to fetch the api definition and generate a client, but there are no schema for a response.
Is it possible to get via web-api a schema for response somehow in machine-readable view? (Similar to /api/webservices/response_example but schema). JSON Schema would be perfect, but any format that allows to generate client library code will be fine.

(Stas Vilchik) #2

Hi Anton,

No, SonarQube doesn’t provide a machine-readable web api schema.

Do you have good examples where we could get an inspiration?


(Anton Griadchenko) #3

Do you have good examples where we could get an inspiration?

No, unfortunately, I can’t provide an example from some project.

As I can see, you are using protobuf for generation your web-services (e.g. )?
Maybe it is possible to add one more endpoint to your API (or extend existing /api/webservices/list ) to return information about response format in json schema format (

One of the simple solutions - convert your *.proto files to JSONSchema and serve them as static files as you are doing with response_examples (e.g.
Quick googling brought me to this tools:

but I haven’t used them …

Off course, you may do this in runtime, but I’m not a Java-guy, so no tips from me in this question :-).

Alternative solution - maybe you have another network API, such as gRPC (since you are using proto-files)? This would be better for me as I won’t need to create a client library.

(Stas Vilchik) #6

Thanks for the suggestion! We’ll discuss it internally within the team.

No, we don’t have another network API.

(Anton Griadchenko) #7

Thank you!
It would be nice if you share your team plans related to adding this feature after you discussed.
I will adjust my tasks according to your decision.

(Anton Griadchenko) #8

P. S. After some digging up I’ve found that adding type to incoming parameters would be useful as well, but not so critical as a schema of response.