Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Jira Legacy
serverSystem JiraJIRA
serverId01505d01-b853-3c2e-90f1-ee9b165564fc
keyMODKBEKBJ-112

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
Code Block
{
  "id": "_jsonSchemas",
  "version": "1.0",
  "interfaceType" : "multiple",
  "handlers" : [
    {
      "methods" : [ "GET" ],
      "pathPattern" : "/_/jsonSchemas"
    }
  ]
}
  • for RAMLs API
Code Block
{
  "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

Code Block
<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>diku/interfaces/_jsonSchemas
		 http://localhost:9130/_/proxy/tenants/<tenant>diku/interfaces/_ramls
		 http://localhost:9130/_/proxy/tenants/<tenant>diku/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)

Code Block
<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 

Expand
titleSample JSON Schema response


To summarize the information let's list the service names 

RMB endpoints:

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

Okapi endpoints: 

  • /_/proxy
  • /_/discovery
  • /_/deployment
  • /_/env