github.com/hyperledger/aries-framework-go@v0.3.2/scripts/generate-openapi-spec.sh (about)

     1  #!/bin/bash
     2  #
     3  # Copyright SecureKey Technologies Inc. All Rights Reserved.
     4  #
     5  # SPDX-License-Identifier: Apache-2.0
     6  #
     7  set -e
     8  
     9  SPEC_LOC="${SPEC_LOC}"
    10  SPEC_DIR="cmd/aries-agent-rest"
    11  WORKING_DIR="/opt"
    12  OUTPUT="$SPEC_LOC/openAPI.yml"
    13  IMAGE="${DOCKER_IMAGE:-quay.io/goswagger/swagger}"
    14  IMAGE_VERSION="${DOCKER_IMAGE_VERSION:-latest}"
    15  
    16  # generate and validate commands
    17  GENERATE_COMMAND="generate spec -w $SPEC_DIR -o $OUTPUT"
    18  VALIDATE_COMMAND="validate $OUTPUT"
    19  
    20  echo "Generating Open API spec"
    21  docker run --rm -v $(pwd):$WORKING_DIR -w $WORKING_DIR ${IMAGE}:${IMAGE_VERSION} $GENERATE_COMMAND
    22  
    23  echo "Validating generated spec"
    24  docker run --rm -v $(pwd):$WORKING_DIR -w $WORKING_DIR ${IMAGE}:${IMAGE_VERSION} $VALIDATE_COMMAND