Hello devs, It appears that some of the Rest End Points configured in modules don’t appear in the webservice RestApi docs via the legacy ui for example this ActiveVisit EndPoint in EMR-API but yet personImage End point in EMR-API does. My question: what is the criteria for an end point to make it to the docs. Is it when it is configured as a resource which would mean you have that bean for that resource that is persisted to the db? @dkayiwa @mksd @ssmusoke
@reagan for an end point to appear in the openmrs swagger spec then it has to implement the Model getGETModel(Representation) , Model getCREATEModel(Representation), Model getUPDATEModel(Representation) methods depending on what CRUD operations its supporting.
Kindly have a look at this to https://wiki.openmrs.org/display/docs/Documenting+REST+Resources
Spot on …Thanks @gcliff
Thanks for bringing this up @reagan , i have been researching about this error ticket, which i have not yet figured out where these error comes from. it has been there since 2017.I would think , while they were creating swaggerspecificationCreator.java in webservices.rest could have arose this error definition,@reagan @gcliff ,have you taken a look at that error
@sharif those errors are usually generated when an expected method is not defined in your resource…Havent looked deep into the code to see how the module scans them and handles the NPE which I think is the TO DO of the ticket…Nice coding and u continue researching it
@reagan Thanks , You are right this was defined in webservices.rest, however am still looking through it
Thanks @gcliff that was my initial links i followed though still researching where the problem could be.
Turning back to this: I seem to be able to archieve this pattern pretty well when creating a REST end point of a core Object, However I have a followup question. Is this still possible to reflect my endpoint in live docs when am writing an endpoint that is not based entirely on one core Object.such as this end point? @dkayiwa @ibacher @ssmusoke
Did you try it out?
@dkayiwa I couldnt think of a way to do it…So am wondering if it is possible anyway…
@dkayiwa The problem here is that we have a custom end-point which we would like to add to the swagger documentation. The underlying resource is concepts, and is a query, however we do not want to use the concept list as that will bring a performance penalty.
We just want to return the count of obs that contain the specified obs value.
On additional thoughts is there a performant way of returning the count of results for a GET call for a list of resources?