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 2 Next »

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"
    }
  ]
}

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/_jsonSchemas - find modules which provide this interface

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: 

 Sample JSON Schema response



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.

You are already familiar with Okapi endpoints, such are 

JSON Schemas

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"
    }
  ]
}

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/_jsonSchemas - find modules which provide this interface

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: 

 Sample JSON Schema response



  • No labels