Skip to content

CommandLineInterface

Guy Davenport edited this page Feb 21, 2025 · 8 revisions

Quick Start

  1. Download the Command Line Interface (CLI) from the Releases page

  2. Run the application on your terminal, to get a help page of options

    brapi
    

Commands

There are three main commands, one to validate the JSON schema, one to generate files from the schema and another to analyse a BrAPI server based on the JSON schema.

Validate

Validates the JSON Schema and provides a list of errors if they are present. For example to validate the JSON schema files in the directory validate Specification\BrAPI-Schema, use the command

brapi validate Specification\BrAPI-Schema 

To list all the arguments for validate command use the following command to see the the help page

brapi validate -h 

Generate

Validate the JSON Schema and provides a list of errors if they are present and then generates different types of files. For example to generate the OpenAPI specification from the JSON schema files in the directory validate Specification\BrAPI-Schema, use the command

brapi generate Specification\BrAPI-Schema -l OPEN_API -f out\generated-files\brapi_openapi.json -c Specification\OpenAPI-Components

In this example the JSON Schema is in the Specification\BrAPI-Schema, the outputted language is Open API, which will be output to the out\generated-files\brapi_openapi.json file. Open API generation requires some adding information in the Specification\OpenAPI-Components directory to generate the specification.

Possible output 'languages' are

  • OPEN_API
  • GRAPHQL
  • OWL
  • MARKDOWN
  • XLSX

For some of the outputs you can provide options and/or metadata.

To list all the arguments for generate command use the following command to see the the help page

brapi generate -h 

Analyse

Analyses a BrAPI server based on the JSON schema.

To list all the arguments for analyse command use the following command to see the the help page

brapi analyse -h 
Clone this wiki locally