Skip to end of banner
Go to start of banner

RMB: JSON Schema and RAML interfaces overview

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 6 Current »

MODKBEKBJ-112 - Getting issue details... STATUS

The main goal of the spike mentioned above is to find out a way to load and use JSON schema for response validation in API tests.

There are some changes were announced to the RMB module recently, and especially we are interested in this commit, which introduces two additional endpoints for use, they are:

Those endpoints allow user to retrieve whether JSON schema or RAML file for specified module.

To include this functionality into your module you have to modify ModuleDescriptior.json file by adding following code

  • for  JSON Schemas API
{
  "id": "_jsonSchemas",
  "version": "1.0",
  "interfaceType" : "multiple",
  "handlers" : [
    {
      "methods" : [ "GET" ],
      "pathPattern" : "/_/jsonSchemas"
    }
  ]
}
  • for RAMLs API
{
  "id": "_ramls",
  "version": "1.0",
  "interfaceType" : "multiple",
  "handlers" : [
    {
      "methods" : [ "GET" ],
      "pathPattern" : "/_/ramls"
    }
  ]
}

After it is done re-deploy module if needed. 

Then, you may want to see those endpoints enabled for the module.

To check it, use following endpoints

<host>:<port>/_/proxy/tenants/<tenant>/interfaces - to see all interfaces
<host>:<port>/_/proxy/tenants/<tenant>/interfaces/<interface_name> - find modules which provide this interface
Example: http://localhost:9130/_/proxy/tenants/<tenant>/interfaces/_jsonSchemas
		 http://localhost:9130/_/proxy/tenants/<tenant>/interfaces/_ramls
		 http://localhost:9130/_/proxy/tenants/<tenant>/interfaces/users

Here is the sample response with the list of interfaces available to use

You should see similar response if you are specified interface

and finally you are able to retrieve JSON Schema for your needs (Do not forget to specify `X-Okapi-Module-Id` header)

<host>:<port>/_/jsonSchemas?path=<path_to_file>
Example: http://localhost:9130/_/jsonSchemas?path=types/packages/packageCollection.json

You can find the sample response below: To summarize the information let's list the service names 

 Sample JSON Schema response

To summarize the information let's list the service names 

RMB endpoints:

  • /_/jsonSchemas
  • /_/ramls
  • /_/tenant

Okapi endpoints: 

  • /_/proxy
  • /_/discovery
  • /_/deployment
  • /_/env
  • No labels