| 1 | #!/bin/bash |
| 2 | |
| 3 | # Copyright (c) Meta Platforms, Inc. and affiliates. |
| 4 | # All rights reserved. |
| 5 | # |
| 6 | # This source code is licensed under the terms described in the LICENSE file in |
| 7 | # the root directory of this source tree. |
| 8 | |
| 9 | PYTHONPATH=${PYTHONPATH:-} |
| 10 | |
| 11 | set -euo pipefail |
| 12 | |
| 13 | missing_packages=() |
| 14 | |
| 15 | check_package() { |
| 16 | if ! pip show "$1" &>/dev/null; then |
| 17 | missing_packages+=("$1") |
| 18 | fi |
| 19 | } |
| 20 | |
| 21 | check_package json-strong-typing |
| 22 | |
| 23 | if [ ${#missing_packages[@]} -ne 0 ]; then |
| 24 | echo "Error: The following package(s) are not installed:" |
| 25 | printf " - %s\n" "${missing_packages[@]}" |
| 26 | echo "Please install them using:" |
| 27 | echo "pip install ${missing_packages[*]}" |
| 28 | exit 1 |
| 29 | fi |
| 30 | |
| 31 | PYTHONPATH=$PYTHONPATH:../.. python -m docs.openapi_generator.generate $* |