Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 

OpenAPI Generator Setup

To begin using the OpenAPI Generator, follow these steps:

  1. Install or download the latest OpenAPI Generator JAR file:

    wget https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/6.2.1/openapi-generator-cli-6.2.1.jar -O .openapi/generator/openapi-generator-cli.jar
  2. Set the API version as an environmental variable:

    API_VERSION="v1.39.0"
  3. Download the specified version of the Meraki OpenAPI spec:

    wget https://github.com/meraki/openapi/archive/refs/tags/$API_VERSION.zip && unzip -j $API_VERSION.zip '*/spec3.json'

    Note: A few API endpoints had to be manually removed from the spec to avoid generator errors. Both the modified spec3.json and the original are included in this repository.

  4. Remove any existing client code:

    rm -rf proto/
  5. Run the code generator JAR:

    java -jar .openapi/generator/openapi-generator-cli.jar generate \
      -i spec3.json \
      -g protobuf-schema \
      -o ${PWD}/proto \
      -p enumClassPrefix=true \
      -p structPrefix=true
  6. Cleanup the build files:

    rm $API_VERSION.zip

You are now set up to generate protocol buffer schema files based on the Meraki OpenAPI specification.