Metadata Mapping Module REST api (MAP-8)

I have an initial implementation ready for the REST api but I assume there are still some things to improve. Please look at the tentative pull request.

Some questions (pick one or more):

  • I did not implement anything for the local concept source stuff (for example: createLocalConceptSourceFromImplementationId) as it could not be translated into a straight forward REST resource. What do you think we should do with this part of the module wrt REST api?
  • How to document the rest api for people developing clients? Any examples?
  • Anything else missing/wrong in metadata term mapping or metadata source resources?

The new unit test classes probably give an idea of all the features the REST apis support. Here are also some examples:

# get a single metadata source
http://localhost:8080/openmrs/ws/rest/v1/metadatamapping/metadatasource/f8b6fef1-fb42-11e5-a302-08002714c8d5

# search metadata term mappings
http://localhost:8080/openmrs/ws/rest/v1/metadatamapping/metadatatermmapping?limit=10&v=full

# search metadata term mappings that refer to care setting
# 6f0c9a92-6f24-11e3-af88-005056821db0
http://localhost:8080/openmrs/ws/rest/v1/metadatamapping/metadatatermmapping?limit=10&v=full&refClass=org.openmrs.CareSetting&refUuid=6f0c9a92-6f24-11e3-af88-005056821db0

# search metadata term mappings from metadata source 
# f8b6fef1-fb42-11e5-a302-08002714c8d5 that refer to care 
# setting 6f0c9a92-6f24-11e3-af88-005056821db0
http://localhost:8080/openmrs/ws/rest/v1/metadatamapping/metadatatermmapping?limit=10&v=full&refClass=org.openmrs.CareSetting&refUuid=6f0c9a92-6f24-11e3-af88-005056821db0&sourceUuid=f8b6fef1-fb42-11e5-a302-08002714c8d5

cc: @raff

Turns out we do have some sort of support for automatic generation of REST api documentation. If you have OpenMRS running you should be able to see the docs at http://localhost:8080/openmrs/module/webservices/rest/swaggerDoc.htm

It is not working very for Metadata Mapping Module as the ui lists operations like GET /metadatamapping/{uuid} when it should be GET /metadatamapping/metadatatermmapping/{uuid}, for example. Also, I wonder how to customize parameter descriptions and such things. I could not find any documentation for this Swagger feature. Any hints?