Skip to content

CommandLineInterface

Guy Davenport edited this page Jan 17, 2025 · 7 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 two main commands, one to validate the JSON schema and the other to generate files from the 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 

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 use the following command to see the the help page

brapi generate -h 
Clone this wiki locally