REST API endpoint generation using github.com/brocaar/chirpstack-api/go

Continuing the discussion from [release] ChirpStack Application Server v3.6:

@brocaar
Hi, yes I am sorry for spamming release announcement topic, but I generated the api definitions in chirpstack-api/go repository only and then edited the go module in chirpstack-application-server . But I am still not getting my generated api’s in the localhost:8080/api.

The steps to make API modifications are:

2 Likes

Hi @brocaar,
I did all of the steps as above but I did not see the modified changes being reflected in the localhost:8080/api.

A little digging led me towards chirpstack-application-server/Makefile in which:

While building:

  • It is first removing the /tmp/chirpstack-api
  • Performing a fresh clone of the same from the github repository in /tmp
  • After that it copies the generated swagger definitions in static/swagger

Since I wanted my modified swagger definitions to show inside static/swagger and not the freshly cloned ones, I commented lines : 53, 54, and 55 in the Makefile.

  • After that I updated the .proto definitions in the /tmp/chirpstack-api repository.
  • Then, re-generated the chirpstack-api Go & Swagger code using make go & make all.
  • Built the chirpstack-application-server using make clean build.
  • The modified changes reflected at localhost:8080/api.

Previously, I only had to make modifications inside in the .proto definitions inside /api and see the reflected changes after using make api and make clean build, in chirpstack-application-server.

Now, is it necessary to perform all of the above mentioned steps every time I make any change in the proto definitions? or is there any other way round?

Hi @brocaar, I did as you suggested, (you can find it here & here.) but after this also, the source code could not take the modified api’s, and it was not reflected in swagger definitions.

I had to make these changes inside in application server's Makefile , so that it can take my modified API’s and not the default one’s. But I don’t think this is a valid and correct way of calling the modified api’s.

Since, I want to modify network-server api's also, I am doing the same way as above but i am getting this error.

Can you please suggest why am I getting these erros and how to correctly import the chirpstack-api (modified) for both application-server and network-server?

Thank you.