This API Generator generates API actions for the OpenSearch Ruby client based off of OpenSearch OpenAPI specification
Install all dependencies
bundle install
Import the API Generator and load the OpenSearch OpenAPI specification into a generator instance
require './lib/api_generator'
generator = ApiGenerator.new('./OpenSearch.openapi.json')
The generate
method accepts the path to the root directory of the opensearch-ruby
gem as a parameter. By default, it points to the parent directory of the folder containing the generator script. For example to generate all actions into the tmp
directory:
generator.generate('./tmp')
You can also target a specific API version by passing in the version number as a parameter. For example to generate all actions for version 1.0.0
into the tmp
directory:
generator.generate(version: '1.0.0')
The generator also support incremental generation. For example, to generate all actions of the cat
namespace:
generator.generate(namespace: 'cat')
To limit it to specific actions of a namespace:
generator.generate(namespace: 'cat', actions: %w[aliases allocation])
Note that the root namespace is presented by an empty string ''
. For example, to generate all actions of the root namespace for OS version 2.3:
generator.generate(version: '2.3', namespace: '')